Esempio n. 1
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;
                }
            }
        }
Esempio n. 2
0
 /// <inheritdoc />
 public void Dispose()
 {
     if (!_isDisposed)
     {
         _isDisposed = true;
         _lockFile?.Dispose();
     }
 }