public void AddSite(string profilePath)
        {
            HashSet<Site> sites = new HashSet<Site>(_sites);
            Site newSite = new Site(profilePath);
            if (!sites.Contains(newSite))
            {
                sites.Add(newSite);
            }

            _sites = sites;
        }
예제 #2
0
        public async Task<DeploymentChangeSummary> PublishContentToSingleSite(Site site)
        {
            string lockPath = Path.Combine(site.FilePath, "deployment.lock");
            LockFile lockFile = null;

            Trace.TraceInformation("Sync to single site: {0}", site.Name);

            try
            {
                if (LockFile.TryGetLockFile(lockPath, out lockFile))
                {
                    WebDeployHelper webDeployHelper = new WebDeployHelper();
                    return await Task<DeploymentChangeSummary>.Run(() =>
                        webDeployHelper.DeployContentToOneSite(
                            Repository,
                            Environment.Instance.ContentPath,
                            site.Settings.FilePath));
                }

                return null;
            }
            catch (Exception e)
            {
                Trace.TraceError("Error processing {0}: {1}", Path.GetFileName(site.Settings.FilePath), e.ToString());
                return null;
            }
            finally
            {
                if (lockFile != null)
                {
                    lockFile.Dispose();
                    lockFile = null;
                }
            }

        }