public static DeploySettings SetWhatIf(this DeploySettings settings, bool whatIf = true) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.WhatIf = whatIf; return(settings); }
public static DeploySettings SetPublishUrl(this DeploySettings settings, string url) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.PublishUrl = url; return(settings); }
public static DeploySettings SetTraceLevel(this DeploySettings settings, TraceLevel level) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.TraceLevel = level; return(settings); }
public static DeploySettings SetAllowUntrusted(this DeploySettings settings, bool untrusted = true) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.AllowUntrusted = untrusted; return(settings); }
public static DeploySettings SetDelete(this DeploySettings settings, bool delete = true) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.Delete = delete; return(settings); }
public static DeploySettings UseAgentType(this DeploySettings settings, RemoteAgent agentType) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.AgentType = agentType; return(settings); }
public static DeploySettings FromSourcePath(this DeploySettings settings, string path) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.SourcePath = (FilePath)path; return(settings); }
public static DeploySettings UseUsername(this DeploySettings settings, string username) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.Username = username; return(settings); }
public static DeploySettings AddSkipRule(this DeploySettings settings, SkipRule rule) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.SkipRules.Add(rule); return(settings); }
public static DeploySettings UsePassword(this DeploySettings settings, string password) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.Password = password; return(settings); }
public static DeploySettings UsePort(this DeploySettings settings, int port) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.Port = port; return(settings); }
public static DeploySettings AddParameter(this DeploySettings settings, string key, string value) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.Parameters[key] = value; return(settings); }
public static DeploySettings UseNTLM(this DeploySettings settings, bool ntlm = true) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.NTLM = ntlm; return(settings); }
public static DeploySettings UseComputerName(this DeploySettings settings, string name) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.ComputerName = name; return(settings); }
public static DeploySettings AddSkipRule(this DeploySettings settings, string name, string skipAction, string objectName, string absolutePath, string xpath = null) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } settings.SkipRules.Add(new SkipRule(name, skipAction, objectName, absolutePath, xpath)); return(settings); }
private DeploymentBaseOptions GetBaseOptions(DeploySettings settings) { DeploymentBaseOptions deploymentBaseOptions = new DeploymentBaseOptions(); deploymentBaseOptions.ComputerName = settings.PublishUrl; deploymentBaseOptions.UserName = settings.Username; deploymentBaseOptions.Password = settings.Password; deploymentBaseOptions.AuthenticationType = settings.NTLM ? "ntlm" : "basic"; if (!settings.AllowUntrusted) { return(deploymentBaseOptions); } ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(this.OnCertificateValidation); return(deploymentBaseOptions); }
public DeploymentChangeSummary Deploy(DeploySettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } DeploymentBaseOptions baseOptions1 = new DeploymentBaseOptions(); DeploymentBaseOptions baseOptions2 = this.GetBaseOptions(settings); FilePath sourcePath = settings.SourcePath; string str1; if (sourcePath == null) { str1 = (string)null; } else { ICakeEnvironment environment = this.environment; FilePath filePath = sourcePath.MakeAbsolute(environment); str1 = filePath != null ? ((Path)filePath).FullPath : (string)null; } string path1 = str1; FilePath destinationPath = settings.DestinationPath; string str2; if (destinationPath == null) { str2 = (string)null; } else { ICakeEnvironment environment = this.environment; FilePath filePath = destinationPath.MakeAbsolute(environment); str2 = filePath != null ? ((Path)filePath).FullPath : (string)null; } string path2 = str2; LogExtensions.Information(this.log, (Verbosity)2, "CCC", new object[0]); baseOptions2.TraceLevel = settings.TraceLevel; baseOptions2.Trace += new EventHandler <DeploymentTraceEventArgs>(this.OnTraceEvent); if (settings.DestProvider == DeploymentWellKnownProvider.Auto) { path2 = settings.SiteName; } DeploymentSyncOptions deploymentSyncOptions = new DeploymentSyncOptions(); int num1 = !settings.Delete ? 1 : 0; deploymentSyncOptions.DoNotDelete = num1 != 0; int num2 = settings.WhatIf ? 1 : 0; deploymentSyncOptions.WhatIf = num2 != 0; DeploymentSyncOptions syncOptions = deploymentSyncOptions; if (settings.DeclareParamFile != null) { syncOptions.DeclaredParameters.Load(((Path)settings.DeclareParamFile.MakeAbsolute(this.environment)).FullPath); } foreach (SkipRule skipRule in settings.SkipRules) { syncOptions.Rules.Add((DeploymentRule) new DeploymentSkipRule(skipRule.Name, skipRule.SkipAction, skipRule.ObjectName, skipRule.AbsolutePath, skipRule.XPath)); } LogExtensions.Information(this.log, (Verbosity)2, "Deploying Website...", new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-siteName '{0}'", (object)settings.SiteName), new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-destination '{0}'", (object)settings.PublishUrl), new object[0]); LogExtensions.Debug(this.log, (Verbosity)2, string.Format("-source '{0}'", (object)path1), new object[0]); LogExtensions.Debug(this.log, string.Empty, new object[0]); using (DeploymentObject deploymentObject = DeploymentManager.CreateObject(settings.SourceProvider, path1, baseOptions1)) { foreach (KeyValuePair <string, string> parameter in settings.Parameters) { deploymentObject.SyncParameters[parameter.Key].Value = parameter.Value; } return(deploymentObject.SyncTo(settings.DestProvider, path2, baseOptions2, syncOptions)); } }
public static DeploymentChangeSummary Sync(this ICakeContext context, DeploySettings settings) { return(new MsDeployManager(context.Environment, context.Log).Deploy(settings)); }