Exemplo n.º 1
0
 public PackageInstaller(EnvironmentSettings environmentSettings,
                         IApplicationClientFactory applicationClientFactory, IApplication application,
                         IPackageArchiver packageArchiver, ISqlScriptExecutor scriptExecutor,
                         IServiceUrlBuilder serviceUrlBuilder, IFileSystem fileSystem, ILogger logger)
 {
     environmentSettings.CheckArgumentNull(nameof(environmentSettings));
     applicationClientFactory.CheckArgumentNull(nameof(applicationClientFactory));
     application.CheckArgumentNull(nameof(application));
     packageArchiver.CheckArgumentNull(nameof(packageArchiver));
     scriptExecutor.CheckArgumentNull(nameof(scriptExecutor));
     serviceUrlBuilder.CheckArgumentNull(nameof(serviceUrlBuilder));
     fileSystem.CheckArgumentNull(nameof(fileSystem));
     _environmentSettings      = environmentSettings;
     _applicationClientFactory = applicationClientFactory;
     _application             = application;
     _packageArchiver         = packageArchiver;
     _scriptExecutor          = scriptExecutor;
     _serviceUrlBuilder       = serviceUrlBuilder;
     _fileSystem              = fileSystem;
     _logger                  = logger;
     _applicationClient       = _applicationClientFactory.CreateClient(_environmentSettings);
     _applicationClientForLog = _applicationClientFactory.CreateClient(_environmentSettings);
     _developerModeEnabled    = _environmentSettings.DeveloperModeEnabled.HasValue &&
                                _environmentSettings.DeveloperModeEnabled.Value;
 }
Exemplo n.º 2
0
 public override int Execute(RegAppOptions options)
 {
     try {
         var environment = new EnvironmentSettings {
             Login                = options.Login,
             Password             = options.Password,
             Uri                  = options.Uri,
             Maintainer           = options.Maintainer,
             Safe                 = options.SafeValue.HasValue ? options.SafeValue : false,
             IsNetCore            = options.IsNetCore ?? false,
             DeveloperModeEnabled = options.DeveloperModeEnabled
         };
         if (!string.IsNullOrWhiteSpace(options.ActiveEnvironment))
         {
             if (_settingsRepository.IsEnvironmentExists(options.ActiveEnvironment))
             {
                 _settingsRepository.SetActiveEnvironment(options.ActiveEnvironment);
                 Console.WriteLine($"Active environment set to {options.ActiveEnvironment}");
                 return(0);
             }
             else
             {
                 throw new Exception($"Not found environment {options.ActiveEnvironment} in settings");
             }
         }
         _settingsRepository.ConfigureEnvironment(options.Name, environment);
         environment = _settingsRepository.GetEnvironment(options);
         _settingsRepository.ShowSettingsTo(Console.Out, options.Name);
         Console.WriteLine();
         Console.WriteLine($"Try login to {environment.Uri} with {environment.Login} credentials ...");
         var creatioClient = _applicationClientFactory.CreateClient(environment);
         creatioClient.Login();
         Console.WriteLine($"Login successfull");
         return(0);
     } catch (Exception e) {
         Console.WriteLine($"{e.Message}");
         return(1);
     }
 }