Exemplo n.º 1
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));
        }
Exemplo n.º 2
0
        public async Task <DeploySummary> SyncTo(DeploymentBaseOptions baseOptions,
                                                 DeploymentSyncOptions syncOptions,
                                                 CancellationToken cancellationToken = default)
        {
            void Configure(List <string> arguments)
            {
                string dest = CreateDestination(baseOptions);

                arguments.AddRange(new[] { "-verb:delete", dest, "-verbose" });

                if (!string.IsNullOrWhiteSpace(Path) && !string.IsNullOrWhiteSpace(DeploymentBaseOptions.SiteName))
                {
                    string destinationParameter = GetDestinationParameter(DeploymentBaseOptions.SiteName, Path);
                    arguments.Add(destinationParameter);
                }
            }

            return(await SyncToInternal(baseOptions,
                                        syncOptions,
                                        Configure,
                                        cancellationToken));
        }