예제 #1
0
 public DeploymentObject(DeploymentWellKnownProvider provider,
                         string path,
                         DeploymentBaseOptions deploymentBaseOptions,
                         ILogger logger)
 {
     _logger  = logger;
     Provider = provider;
     Path     = path;
     DeploymentBaseOptions = deploymentBaseOptions;
 }
예제 #2
0
        public async Task <DeploySummary> SyncTo(
            DeploymentWellKnownProvider destinationProvider,
            string?destinationPath,
            DeploymentBaseOptions deploymentBaseOptions,
            DeploymentSyncOptions syncOptions,
            CancellationToken cancellationToken = default)
        {
            Action <List <string> > action;

            if (Provider == DeploymentWellKnownProvider.ContentPath &&
                destinationProvider == DeploymentWellKnownProvider.ContentPath)
            {
                action = arguments =>
                {
                    string dest = CreateDestination(deploymentBaseOptions);

                    arguments.AddRange(new[] { "-verb:sync", $"-source:contentPath=\"{Path}\"", dest, "-verbose" });

                    if (!string.IsNullOrWhiteSpace(destinationPath) &&
                        !string.IsNullOrWhiteSpace(deploymentBaseOptions.SiteName))
                    {
                        string destinationParameter =
                            GetDestinationParameter(deploymentBaseOptions.SiteName, destinationPath: null);

                        arguments.Add(destinationParameter);
                    }
                };
            }
            else if (Provider == DeploymentWellKnownProvider.DirPath &&
                     destinationProvider == DeploymentWellKnownProvider.DirPath)
            {
                action = arguments =>
                {
                    string dest = CreateDestination(deploymentBaseOptions) + "=" + destinationPath;

                    arguments.AddRange(new[] { "-verb:sync", $"-source:dirPath=\"{Path}\"", dest, "-verbose" });
                };
            }
            else
            {
                throw new NotSupportedException(
                          $"The current provider {Provider.Name} to provider {destinationProvider.Name} is not supported");
            }

            return(await SyncToInternal(
                       deploymentBaseOptions,
                       syncOptions,
                       action,
                       cancellationToken));
        }
 public static DeploymentObject CreateObject(DeploymentWellKnownProvider provider,
                                             string path,
                                             DeploymentBaseOptions deploymentBaseOptions,
                                             ILogger logger) =>