Пример #1
0
 /// <summary>
 /// The main execution method for TFS Deployer it is this
 /// method that does all the work
 /// </summary>
 /// <param name="statusChanged"></param>
 public void ExecuteDeploymentProcess(BuildStatusChangeEvent statusChanged)
 {
     try
     {
         TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Build Status Changed: Team Project {0}  Team Build Version: {1} From {2} : {3}",
                                      statusChanged.TeamProject, statusChanged.Id, statusChanged.StatusChange.OldValue, statusChanged.StatusChange.NewValue);
         var info = new BuildInformation(GetBuildDetail(statusChanged));
         DeploymentMappings mappings = ConfigurationReader.Read(statusChanged.TeamProject, info.Data);
         if (mappings != null)
         {
             foreach (Mapping mapping in mappings.Mappings)
             {
                 TraceHelper.TraceInformation(TraceSwitches.TfsDeployer, "Processing Mapping: Computer:{0}, Script:{1}", mapping.Computer, mapping.Script);
                 if (IsInterestedStatusChange(statusChanged, mapping, statusChanged.StatusChange))
                 {
                     IRunner runner = DetermineRunner(mapping);
                     runner.Execute(ConfigurationReader.WorkingDirectory, mapping, info);
                     ApplyRetainBuild(mapping, runner, info.Detail);
                     Alerter.Alert(mapping, info.Data, runner);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         TraceHelper.TraceError(TraceSwitches.TfsDeployer, ex);
     }
 }
Пример #2
0
        public void Run(string basePath)
        {
            messageWriter.Write("Reading current state");
            var executedScripts = runner.GetExecuted().ToDictionary(x => x.Name);

            var monitorPath = Path.Combine(basePath, GetMonitorPath());

            messageWriter.Write($"Reading path {monitorPath}");
            var files = Directory.GetFiles(monitorPath)
                        .OrderBy(x => x);

            foreach (var file in files)
            {
                var scriptName = Path.GetFileNameWithoutExtension(file);
                if (executedScripts.ContainsKey(scriptName))
                {
                    continue;
                }

                messageWriter.Write($"Processing {scriptName}");
                var scriptInfo = new ScriptInfo
                {
                    Id            = Guid.NewGuid(),
                    ExecutionDate = DateTimeOffset.UtcNow,
                    Name          = scriptName
                };

                //Assuming the files are not specially huge in size
                var data = File.ReadAllText(file);
                runner.Execute(scriptInfo, data);
            }
        }
Пример #3
0
        public IList <Actor> GetAll()
        {
            var sql =
                $"select actor_id as Id,first_name as FirstName,last_name as LastName,last_update as LastUpdate from actor;";
            var result = _runner.Execute <Actor>(sql, null);

            return(result.ToList());
        }
Пример #4
0
        // GET
        public IActionResult Index()
        {
            var sql =
                @"select actor_id as Id,first_name as FirstName,last_name as LastName,last_update as LastUpdate from actor order by actor_id;";
            var result = _runner.Execute <Actor>(sql, null);

            return(View(result));
        }
Пример #5
0
        public IEnumerable <Artist> GetAll()
        {
            var query = @"select artist_id as Id , name as Name from artist;";

            return(_runner.Execute <Artist>(query));
        }
Пример #6
0
        public IEnumerable <Actor> GetAll()
        {
            var sql = "select actor_id as Id ,first_name as FirstName,last_name as LastName,last_update as ModifiedAt from actor order by actor_id;";

            return(_runner.Execute <Actor>(sql, null));
        }
Пример #7
0
        public IEnumerable <Film> GetAllMovies()
        {
            var sql = "select film_id as Id,title as Title,description as Description,release_year as ReleaseYear,length,replacement_cost as cost,last_update as ModifiedAt , length as Length from film;";

            return(_runner.Execute <Film>(sql, null));
        }
Пример #8
0
 static void Main(string[] args)
 {
     _runner = new MemberDiagnosisRunner();
     _runner.Execute();
 }
Пример #9
0
        public IEnumerable <PlayList> GetAll()
        {
            var palyListSql = @"select playlist_id as Id,name as Name from playlist order by playlist_id;";

            return(_runner.Execute <PlayList>(palyListSql, null));
        }
Пример #10
0
 public void SetRunner(IRunner runner, string workingDirectory)
 {
     _runner = runner;
     _runner.Runspace = _runspace;
     _runner.Execute(new RunnerArgs { Script = "cd " + workingDirectory});
     _repl.Runner = runner;
 }
Пример #11
0
        public void GetAll()
        {
            var result = _runner.Execute <Artist>("select artist_id as Id,name as Name from artist;", null);

            Assert.Equal(275, result.Count());
        }
Пример #12
0
        public IEnumerable <Album> GetAll()
        {
            var sql = "select album_id as Id,title as Title,artist_id as ArtistId from album where album_id=@0";

            return(_runner.Execute <Album>(sql, null));
        }