Пример #1
0
        private void Process(CommandLineArguments parser)
        {
            var processorManfiest = GetProcessorManfiest(parser.ManifestFile);

            Tuple<string, string> configSettings = GetConfigFilePaths(parser.Environment, processorManfiest, parser.ManifestFile);

            IDictionary<string, string> properties;

            properties = LoadProperties(configSettings, parser);

            ProcessManifest(properties, processorManfiest, parser);
        }
Пример #2
0
        public void Run(string[] args)
        {
            if (args == null) throw new ArgumentNullException("args");

            CommandLineArguments parser = new CommandLineArguments();
            CommandLineParser.ParseArguments(parser, args);

            log.Info("Commandline parameters:");
            log.InfoFormat("Environment: {0}", parser.Environment);
            log.InfoFormat("ManifestFile: {0}", parser.ManifestFile);
            Process(parser);
        }
Пример #3
0
        private IDictionary<string, string> LoadProperties(Tuple<string, string> configSettings, CommandLineArguments parser)
        {
            IDictionary<string, string> properties;

            if (configSettings.Item2 == null)
            {
                properties = this.propertyManager.LoadProperties(configSettings.Item1);
            }
            else
            {
                properties = this.propertyManager.LoadProperties(configSettings.Item1, configSettings.Item2);
            }
           
            return properties;
        }
Пример #4
0
        private void ProcessManifest(IDictionary<string, string> properties, PreProcessorManifest manifest, CommandLineArguments parser)
        {
            Group[] groups = null;
            if (manifest.Environments != null)
            {
                var env = manifest.Environments.FirstOrDefault(x => x.Name == parser.Environment);
                if (env != null)
                {
                    if (env.Groups != null)
                    {
                        groups = env.Groups;
                    }
                }
            }
            if (groups == null)
            {
                log.DebugFormat(
                    "Group config for Environment {0} not found in PreProcessorManifest file.  Using Default group.",
                    parser.Environment);

                groups = manifest.Default.Groups;
                if (groups == null )
                {
                    throw new XmlDidNotPassValidationException(string.Format("No specific Groups specified for environment {0} but no DefaultGroups specified either.", parser.Environment));
                }
            }
            else
            {
                log.DebugFormat(
                    "Using group config for Environment {0} in PreProcessorManifest file.",
                    parser.Environment);
                
            }

            var root = fileSystem.GetDirectoryFullPath(parser.ManifestFile);

            foreach (var group in groups)
            {
                log.InfoFormat("PreProcess group: {0}", group.Name);

                foreach (var command in group.Commands)
                {
                    var source = ResolvePath(root, command.Source);
                    var destination = ResolvePath(root, command.Destination);

                    log.InfoFormat("PreProcess Source: {0}.  Destination:{1}", source, destination);
                    tokeniser.ProcessSingleTemplate(properties, source, destination);
                }   
            }
        }