public static bool Ruby() { var result = ShellHelper.Cmd("command -v ruby"); return(result != string.Empty); }
public static bool Homebrew() { var result = ShellHelper.Cmd("command -v brew"); return(result != string.Empty); }
public static bool AzureCLI() { var result = ShellHelper.Cmd("command -v az"); return(result != string.Empty); }
public async Task CreateWebApp() { var appProfile = GetAppProfile(); IWebApp webApp = null; await Spinner.StartAsync("", async spinner => { spinner.Text = $"Starting deployment for {appProfile.profile.PublishName}"; if (appProfile.isNew) { spinner.Text = $"Creating web app {appProfile.profile.PublishName}"; // create the webapp try { if (appProfile.profile.PricingTier == PricingTier.SharedD1) { webApp = await GetSdkClient() .WebApps.Define(appProfile.profile.PublishName) .WithRegion(appProfile.profile.Region) .WithNewResourceGroup(appProfile.profile.ResourceGroup) .WithNewSharedAppServicePlan() .CreateAsync(); } else { webApp = await GetSdkClient() .WebApps.Define(appProfile.profile.PublishName) .WithRegion(appProfile.profile.Region) .WithNewResourceGroup(appProfile.profile.ResourceGroup) .WithNewWindowsPlan(appProfile.profile.PricingTier) .CreateAsync(); } } catch (LogingException loginEx) { spinner.Fail(loginEx.Message); return; } catch (Exception ex) { spinner.Fail($"Error creating web app {appProfile.profile.PublishName} - " + ex.Message); return; } } else { spinner.Text = $"{appProfile.profile.PublishName} already published, updating files."; webApp = GetSdkClient() .WebApps.GetByResourceGroup(appProfile.profile.ResourceGroup, appProfile.profile.PublishName); } // get the zipdeploy url var webUri = new Uri(string.Format("https://{0}.scm.azurewebsites.net/api/zipdeploy", appProfile.profile.PublishName)); spinner.Text = "Retrieving publishing profile."; // get the publishing profile and create the auth token var publishProfile = webApp.GetPublishingProfile(); var ftpUser = publishProfile.FtpUsername.Split('\\')[1]; var val = Convert.ToBase64String(Encoding.Default.GetBytes($"{ftpUser}:{publishProfile.FtpPassword}")); string authToken = $"Basic {val}"; try { spinner.Text = "Running dotnet publish."; // run dotnet publish on application try { var results = ShellHelper.Cmd($"dotnet publish {AppPath} -c Release -o {AppPath}/publish"); if (results.Contains(": error")) { throw new DotNetPublishException("Error building application", new Exception(results)); } } catch (DotNetPublishException dnex) { spinner.Fail(dnex.Message); return; } spinner.Text = "Preparing files for upload."; //zip publish folder var zipFile = ZipContents(appProfile.profile); spinner.Text = "Uploading application."; var published = await UploadFiles(webUri, zipFile, authToken); if (published) { spinner.Text = $"App {appProfile.profile.PublishName} published."; appProfile.profile.LastPublish = DateTime.Now; SaveAppProfile(appProfile.profile); } else { throw new Exception("Could not deploy files, please try again."); } } catch (Exception ex) { spinner.Fail($"Error creating web app {appProfile.profile.PublishName} - " + ex.Message); throw ex; // throwing so caller can handle } spinner.Succeed($"Browse to https://{appProfile.profile.PublishName}.azurewebsites.net"); }); }