public async Task ExecuteAsync(IPluginJobContext context) { if (!CliUtils.ParseArgs(_options, context.Args)) { return; } if (_isHelp) { PrintUsage(); return; } if (string.IsNullOrEmpty(_account)) { _account = ReadUtils.GetString("Username:"******"Password:"******"you have successful logged in"); } else { await WriteUtils.PrintErrorAsync(failureMessage); } }
public async Task ExecuteAsync(IPluginJobContext context) { if (!CliUtils.ParseArgs(_options, context.Args)) { return; } if (_isHelp) { PrintUsage(); return; } if (!await _configRepository.IsNeedInstallAsync()) { await WriteUtils.PrintErrorAsync($"SS CMS has been installed in {_settingsManager.ContentRootPath}"); return; } var userName = string.IsNullOrEmpty(_userName) ? ReadUtils.GetString("Super administrator username:"******"Super administrator password:"******"index.html"), Constants.Html5Empty); await WriteUtils.PrintSuccessAsync("Congratulations, SS CMS was installed successfully!"); }
public async Task ExecuteAsync(IPluginJobContext context) { if (!CliUtils.ParseArgs(_options, context.Args)) { return; } if (_isHelp) { PrintUsage(); return; } var contentRootPath = _settingsManager.ContentRootPath; if (!CliUtils.IsSsCmsExists(contentRootPath)) { var(success, result, failureMessage) = await _apiService.GetReleasesAsync(_settingsManager.Version, null); if (!success) { await WriteUtils.PrintErrorAsync(failureMessage); return; } var proceed = ReadUtils.GetYesNo($"Do you want to install SS CMS in {contentRootPath}?"); if (!proceed) { return; } Console.WriteLine($"Downloading SS CMS {result.Cms.Version}..."); var directoryPath = CloudUtils.Dl.DownloadCms(_pathManager, _settingsManager.OSArchitecture, result.Cms.Version); await WriteUtils.PrintSuccessAsync($"{result.Cms.Version} download successfully!"); DirectoryUtils.Copy(directoryPath, contentRootPath, true); } InstallUtils.Init(contentRootPath); if (!await _configRepository.IsNeedInstallAsync()) { await WriteUtils.PrintErrorAsync($"SS CMS has been installed in {contentRootPath}"); return; } var databaseTypeInput = ReadUtils.GetSelect("Database type", new List <string> { DatabaseType.MySql.GetValue().ToLower(), DatabaseType.SqlServer.GetValue().ToLower(), DatabaseType.PostgreSql.GetValue().ToLower(), DatabaseType.SQLite.GetValue().ToLower() }); var databaseType = TranslateUtils.ToEnum(databaseTypeInput, DatabaseType.MySql); var databaseName = string.Empty; var databaseHost = string.Empty; var isDatabaseDefaultPort = true; var databasePort = 0; var databaseUserName = string.Empty; var databasePassword = string.Empty; if (databaseType != DatabaseType.SQLite) { databaseHost = ReadUtils.GetString("Database hostname / IP:"); isDatabaseDefaultPort = ReadUtils.GetYesNo("Use default port?"); if (!isDatabaseDefaultPort) { databasePort = ReadUtils.GetInt("Database port:"); } databaseUserName = ReadUtils.GetString("Database userName:"******"Database password:"******"Database name", databaseNames); } var databaseConnectionString = InstallUtils.GetDatabaseConnectionString(databaseType, databaseHost, isDatabaseDefaultPort, databasePort, databaseUserName, databasePassword, databaseName); var isProtectData = ReadUtils.GetYesNo("Protect settings in sscms.json?"); _settingsManager.SaveSettings(isProtectData, false, false, databaseType, databaseConnectionString, string.Empty, string.Empty, null, null); await WriteUtils.PrintSuccessAsync("SS CMS was download and ready for install, please run: sscms install database"); }