Ejemplo n.º 1
0
        private IEnumerable <AsimovVersion> FetchAvailableFiles()
        {
            string html = webClient.DownloadString(Uri);

            string basePath = Uri.ToString();

            foreach (Uri uri in anchorPattern.Matches(html).Cast <Match>().Select(m => CreateUrl(m.Groups["url"].Value)))
            {
                string cleanedName = uri.ToString();
                if (!cleanedName.StartsWith(basePath))
                {
                    continue;
                }

                cleanedName = cleanedName.Remove(0, basePath.Length);
                cleanedName = cleanedName.TrimStart('/');

                if (cleanedName.Contains("/"))
                {
                    continue;
                }

                cleanedName = cleanedName.Replace(".zip", "");

                AsimovVersion asimovVersion = GetAsimovVersionByName(cleanedName);
                if (asimovVersion != null)
                {
                    yield return(asimovVersion);
                }
            }
        }
Ejemplo n.º 2
0
        public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user)
        {
            var task = new DeployTask(this, version, parameterValues, user);

            task.AddDeployStep <PowerShellDeployStep>();
            return(task);
        }
Ejemplo n.º 3
0
        public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId)
        {
            var task = new DeployTask(this, version, parameterValues, user, correlationId);

            task.AddDeployStep <FileCopyDeployStep>();
            return(task);
        }
 public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId)
 {
     var task = new DeployTask(this, version, parameterValues, user, correlationId);
     task.AddDeployStep<UpdateWebSite>();
     foreach (var action in Actions.OfType<VerifyCommandUnitAction>())
     {
         task.AddDeployStep(new ExecuteUnitAction(action, user));
     }
     return task;
 }
Ejemplo n.º 5
0
        public DeployTask(DeployUnit deployUnit, AsimovVersion version, ParameterValues parameterValues, AsimovUser user)
        {
            _deployUnit      = deployUnit;
            _version         = version;
            _parameterValues = parameterValues;
            _user            = user;

            AddDeployStep <CleanTempFolder>();
            AddDeployStep <CopyPackageToTempFolder>();
        }
        public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user)
        {
            var task = new DeployTask(this, version, parameterValues, user);

            task.AddDeployStep <UpdateWebSite>();
            foreach (var action in Actions.OfType <VerifyCommandUnitAction>())
            {
                task.AddDeployStep(new ExecuteUnitAction(action, user));
            }
            return(task);
        }
        public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId)
        {
            var task = new DeployTask(this, version, parameterValues, user, correlationId);

            task.AddDeployStep <UpdateWindowsService>();
            foreach (var action in Actions.OfType <CommandUnitAction>())
            {
                task.AddDeployStep(new ExecuteUnitAction(action, user));
            }
            return(task);
        }
        private AsimovVersion GetVersionInfoFromFile(FileInfo fileInfo)
        {
            var version = AsimovVersion.Parse(Pattern, fileInfo.Name, fileInfo.LastAccessTime);

            if (version != null)
            {
                version.Id = fileInfo.FullName.Replace(Uri.LocalPath, "");
                version.Id = version.Id.TrimStart(new[] { '\\' });
            }
            return(version);
        }
Ejemplo n.º 9
0
        public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user,
                                                 string correlationId)
        {
            var task = new DeployTask(this, version, parameterValues, user, correlationId);

            if (CanInstall())
            {
                task.AddDeployStep(new InstallWebSite(this));
            }
            else
            {
                task.AddDeployStep <UpdateWebSite>();
            }
            foreach (var action in Actions.OfType <VerifyCommandUnitAction>())
            {
                task.AddDeployStep(new ExecuteUnitAction(action, user));
            }
            return(task);
        }
Ejemplo n.º 10
0
        private AsimovVersion GetAsimovVersionByName(string cleanedName)
        {
            Match match = Regex.Match(cleanedName, Pattern);

            if (!match.Success)
            {
                return(null);
            }

            var version = new AsimovVersion();

            version.Id = cleanedName;

            version.Number    = match.Groups["version"].Value;
            version.Branch    = match.Groups["branch"].Value;
            version.Commit    = match.Groups["commit"].Value;
            version.Timestamp = DateTime.UtcNow;

            return(version);
        }
Ejemplo n.º 11
0
        public void StartingDeploy(AsimovVersion newVersion, string logFileName, AsimovUser user, ParameterValues parameters)
        {
            DeployStatus = DeployStatus.Deploying;
            Version      = new DeployedVersion()
            {
                DeployTimestamp  = DateTime.Now,
                VersionId        = newVersion.Id,
                VersionNumber    = newVersion.Number,
                VersionBranch    = newVersion.Branch,
                VersionTimestamp = newVersion.Timestamp,
                VersionCommit    = newVersion.Commit,
                LogFileName      = logFileName,
                UserId           = user.UserId,
                UserName         = user.UserName,
                DeployFailed     = false,
                Parameters       = parameters.GetInternalDictionary()
            };

            NotificationPublisher.PublishNotifications(new DeployStartedEvent(Name, Version));
        }
        private AsimovVersion GetVersionInfoFromFile(FileInfo fileInfo)
        {
            var match = Regex.Match(fileInfo.Name, Pattern);

            if (!match.Success)
            {
                return(null);
            }

            var version = new AsimovVersion();

            version.Id = fileInfo.FullName.Replace(Uri.LocalPath, "");
            version.Id = version.Id.TrimStart(new[] { '\\' });

            version.Number    = match.Groups["version"].Value;
            version.Branch    = match.Groups["branch"].Value;
            version.Commit    = match.Groups["commit"].Value;
            version.Timestamp = fileInfo.LastAccessTime;

            return(version);
        }
Ejemplo n.º 13
0
        public void StartingDeploy(AsimovVersion newVersion, string logFileName, AsimovUser user, string correlationId, ParameterValues parameters)
        {
            DeployStatus = DeployStatus.Deploying;
            Version = new DeployedVersion
            {
                DeployTimestamp = DateTime.Now,
                VersionId = newVersion.Id,
                VersionNumber = newVersion.Number,
                VersionBranch = newVersion.Branch,
                VersionTimestamp = newVersion.Timestamp,
                VersionCommit = newVersion.Commit,
                LogFileName = logFileName,
                UserId = user.UserId,
                UserName = user.UserName,
                DeployFailed = false,
                CorrelationId = correlationId,
                Parameters = parameters.GetInternalDictionary()
            };

            NotificationPublisher.PublishNotifications(new DeployStartedEvent(Name, Version));
        }
 private AsimovVersion ParseVersion(Object @object)
 {
     return(AsimovVersion.Parse(Pattern, @object.Name, @object.TimeCreated ?? DateTime.MinValue));
 }
        private AsimovVersion GetVersionInfoFromFile(FileInfo fileInfo)
        {
            var match = Regex.Match(fileInfo.Name, Pattern);
            if (!match.Success)
                return null;

            var version = new AsimovVersion();
            version.Id = fileInfo.FullName.Replace(Uri.LocalPath, "");
            version.Id = version.Id.TrimStart(new[] { '\\' });

            version.Number = match.Groups["version"].Value;
            version.Branch = match.Groups["branch"].Value;
            version.Commit = match.Groups["commit"].Value;
            version.Timestamp = fileInfo.LastAccessTime;

            return version;
        }
Ejemplo n.º 16
0
 public abstract AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user);
 public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId)
 {
     var task = new DeployTask(this, version, parameterValues, user, correlationId);
     task.AddDeployStep<PowerShellDeployStep>();
     return task;
 }
Ejemplo n.º 18
0
 public abstract AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId);
 public override AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user)
 {
     var task = new DeployTask(this, version, parameterValues, user);
     task.AddDeployStep<FileCopyDeployStep>();
     return task;
 }
        private AsimovVersion GetAsimovVersionByName(string cleanedName)
        {
            Match match = Regex.Match(cleanedName, Pattern);
            if (!match.Success)
                return null;

            var version = new AsimovVersion();
            version.Id = cleanedName;

            version.Number = match.Groups["version"].Value;
            version.Branch = match.Groups["branch"].Value;
            version.Commit = match.Groups["commit"].Value;
            version.Timestamp = DateTime.UtcNow;

            return version;
        }
Ejemplo n.º 21
0
 public abstract AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user, string correlationId);
Ejemplo n.º 22
0
 public abstract AsimovTask GetDeployTask(AsimovVersion version, ParameterValues parameterValues, AsimovUser user);
Ejemplo n.º 23
0
 private AsimovVersion ParseVersion(string key, DateTime xLastModified)
 {
     return(AsimovVersion.Parse(Pattern, key, xLastModified));
 }