示例#1
0
 public HosterRepository(string fullName, string shortName, string cloneUrl, ScmType scm)
 {
     SetFullName(fullName);
     this.ShortName = shortName;
     this.CloneUrl  = cloneUrl;
     this.Scm       = scm;
 }
示例#2
0
 public HosterRepository(string fullName, string shortName, string cloneUrl, ScmType scm, bool haswiki, string wikiurl, bool hasissues, string issueurl)
 {
     SetFullName(fullName);
     this.ShortName = shortName;
     this.CloneUrl  = cloneUrl;
     this.Scm       = scm;
     SetWiki(haswiki, wikiurl);
     SetIssues(hasissues, issueurl);
 }
        /// <summary>
        /// Creates a default website with nothing deployed
        /// </summary>
        /// <param name="website">the website which will be created</param>
        /// <param name="scm"></param>
        public void Create(Website website, ScmType scm = ScmType.LocalGit)
        {
            website.WebsiteParameters.CurrentNumberOfWorkers = website.WebsiteParameters.CurrentNumberOfWorkers != 0 ?
                                                               website.WebsiteParameters.CurrentNumberOfWorkers : 1;

            website.Enabled  = true;
            website.State    = WebsiteState.Ready;
            website.Webspace = website.Webspace ?? WebspaceLocationConstants.NorthEuropeWebSpace;
            if (!String.IsNullOrEmpty(website.Webspace))
            {
                ValidateWebSpace(website.Webspace);
            }
            SetScalePotential(website);
            // check to see whether this is dedicate first
            // if((website.ServerFarm != null && website.ServerFarm.InstanceCount))


            // create the website
            var command = new CreateWebsiteCommand(website)
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command.Execute();
            // create the website repo
            // do this only if local git is selected
            var repoCommand = new CreateWebsiteRepositoryCommand(website)
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            repoCommand.Execute();
            WebsiteProperties = website;

            // TODO: fix this value in code!!!!
            website.WebsiteParameters.NumberOfWorkers = website.WebsiteParameters.NumberOfWorkers == 0
                                                            ? website.WebsiteParameters.CurrentNumberOfWorkers
                                                            : website.WebsiteParameters.NumberOfWorkers;
            WebsiteProperties = GetWebsiteIfExists();

            var command2 = new UpdateWebsiteConfigCommand(WebsiteProperties)
            {
                SubscriptionId = SubscriptionId,
                Certificate    = ManagementCertificate
            };

            command2.Execute();
            WebsiteProperties = GetWebsiteIfExists();
        }
示例#4
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="ScmType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ScmType.CreateFrom(sourceValue);
        /// <summary>
        /// Creates a default website with nothing deployed
        /// </summary>
        /// <param name="website">the website which will be created</param>
        /// <param name="scm"></param>
        public void Create(Website website, ScmType scm = ScmType.LocalGit)
        {
            website.WebsiteParameters.CurrentNumberOfWorkers = website.WebsiteParameters.CurrentNumberOfWorkers != 0 ?
                website.WebsiteParameters.CurrentNumberOfWorkers : 1;

            website.Enabled = true;
            website.State = WebsiteState.Ready;
            website.Webspace = website.Webspace ?? WebspaceLocationConstants.NorthEuropeWebSpace;
            if (!String.IsNullOrEmpty(website.Webspace))
            {
                ValidateWebSpace(website.Webspace);
            }
            SetScalePotential(website);
            // check to see whether this is dedicate first
               // if((website.ServerFarm != null && website.ServerFarm.InstanceCount))

            // create the website
            var command = new CreateWebsiteCommand(website)
                              {
                                  SubscriptionId = SubscriptionId,
                                  Certificate = ManagementCertificate
                              };
            command.Execute();
            // create the website repo
            // do this only if local git is selected
            var repoCommand = new CreateWebsiteRepositoryCommand(website)
                                    {
                                        SubscriptionId = SubscriptionId,
                                        Certificate = ManagementCertificate
                                    };
            repoCommand.Execute();
            WebsiteProperties = website;

            // TODO: fix this value in code!!!!
            website.WebsiteParameters.NumberOfWorkers = website.WebsiteParameters.NumberOfWorkers == 0
                                                            ? website.WebsiteParameters.CurrentNumberOfWorkers
                                                            : website.WebsiteParameters.NumberOfWorkers;
            WebsiteProperties = GetWebsiteIfExists();

            var command2 = new UpdateWebsiteConfigCommand(WebsiteProperties)
            {
                SubscriptionId = SubscriptionId,
                Certificate = ManagementCertificate
            };
            command2.Execute();
            WebsiteProperties = GetWebsiteIfExists();
        }