diff --git a/clio/Command/AddSchema.cs b/clio/Command/AddSchema.cs index ab5c8be..8c5c605 100644 --- a/clio/Command/AddSchema.cs +++ b/clio/Command/AddSchema.cs @@ -1,5 +1,6 @@ using Clio.Common; using CommandLine; +using System.Net.Security; namespace Clio.Command; @@ -50,5 +51,6 @@ public override int Execute(AddSchemaOptions options){ } #endregion - + + } \ No newline at end of file diff --git a/clio/Command/CreateWorkspaceCommand.cs b/clio/Command/CreateWorkspaceCommand.cs index 0f3db79..3d68044 100644 --- a/clio/Command/CreateWorkspaceCommand.cs +++ b/clio/Command/CreateWorkspaceCommand.cs @@ -16,8 +16,6 @@ public class CreateWorkspaceCommandOptions : WorkspaceOptions #region Properties: Public - [Option('a', "AppCode", Required = false, HelpText = "Application code")] - public string AppCode { get; set; } internal override bool RequiredEnvironment => false; diff --git a/clio/Command/RestoreWorkspaceCommand.cs b/clio/Command/RestoreWorkspaceCommand.cs index a507f44..d7dc4ef 100644 --- a/clio/Command/RestoreWorkspaceCommand.cs +++ b/clio/Command/RestoreWorkspaceCommand.cs @@ -1,6 +1,7 @@ namespace Clio.Command { using System; + using System.IO; using Clio.Common; using Clio.Workspaces; using CommandLine; @@ -22,6 +23,9 @@ public WorkspaceOptions() { [Option("IsCreateSolution", Required = false, HelpText = "True if you need to create the Solution", Default = true)] public bool? IsCreateSolution { get; set; } + [Option('a', "AppCode", Required = false, HelpText = "Application code")] + public string AppCode { get; set; } + } [Verb("restore-workspace", Aliases = new string[] { "restorew", "pullw", "pull-workspace" }, @@ -42,15 +46,17 @@ public class RestoreWorkspaceCommand : Command private readonly IWorkspace _workspace; private readonly ILogger _logger; + private readonly CreateWorkspaceCommand _createWorkspaceCommand; #endregion #region Constructors: Public - public RestoreWorkspaceCommand(IWorkspace workspace, ILogger logger) { + public RestoreWorkspaceCommand(IWorkspace workspace, ILogger logger, CreateWorkspaceCommand createWorkspaceCommand) { workspace.CheckArgumentNull(nameof(workspace)); _workspace = workspace; _logger = logger; + _createWorkspaceCommand = createWorkspaceCommand; } #endregion @@ -62,12 +68,45 @@ public override int Execute(RestoreWorkspaceOptions options) { _workspace.Restore(options); _logger.WriteInfo("Done"); return 0; + } catch (FileNotFoundException ex) { + return _createWorkspaceCommand.Execute(CloneFromRestoreOptions(options)); } catch (Exception e) { _logger.WriteError(e.Message); return 1; } } + private CreateWorkspaceCommandOptions CloneFromRestoreOptions(RestoreWorkspaceOptions options) { + return new CreateWorkspaceCommandOptions { + IsNugetRestore = options.IsNugetRestore, + IsCreateSolution = options.IsCreateSolution, + AppCode = options.AppCode, + Uri = options.Uri, + Password = options.Password, + Login = options.Login, + IsNetCore = options.IsNetCore, + Environment = options.Environment, + Maintainer = options.Maintainer, + DevMode = options.DevMode, + WorkspacePathes = options.WorkspacePathes, + DeveloperModeEnabled = options.DeveloperModeEnabled, + Safe = options.Safe, + ClientId = options.ClientId, + ClientSecret = options.ClientSecret, + AuthAppUri = options.AuthAppUri, + IsSilent = options.IsSilent, + RestartEnvironment = options.RestartEnvironment, + DbServerUri = options.DbServerUri, + DbUser = options.DbUser, + DbPassword = options.DbPassword, + BackUpFilePath = options.BackUpFilePath, + DbWorknigFolder = options.DbWorknigFolder, + DbName = options.DbName, + Force = options.Force, + CallbackProcess = options.CallbackProcess + }; + } + #endregion } diff --git a/clio/Package/BasePackageInstaller.cs b/clio/Package/BasePackageInstaller.cs index a5784d0..3f2daf3 100644 --- a/clio/Package/BasePackageInstaller.cs +++ b/clio/Package/BasePackageInstaller.cs @@ -209,6 +209,7 @@ private string InstallPackageOnServer(string fileName, EnvironmentSettings envir PackageInstallOptions packageInstallOptions) { string packageName = UploadPackage(filePath, environmentSettings); string packageCode = packageName.Split('.')[0]; + _logger.WriteInfo($"{environmentSettings.Uri}"); if (!CreateBackupPackage(packageCode, filePath, environmentSettings)) { return (false, "Dont created backup."); } diff --git a/clio/Workspace/Workspace.cs b/clio/Workspace/Workspace.cs index 0a5c66a..9945481 100644 --- a/clio/Workspace/Workspace.cs +++ b/clio/Workspace/Workspace.cs @@ -124,7 +124,7 @@ public void PublishZipToFolder(string zipFileName, string destionationFolderPath _workspaceInstaller.Publish(WorkspaceSettings.Packages, zipFileName, destionationFolderPath, overrideFile); } - + public string PublishToFolder(string workspacePath, string appStorePath, string appName, string appVersion, string branch = null) { var hasBranch = !string.IsNullOrEmpty(branch);