Пример #1
0
            private ScriptParser Build()
            {
                var parser = new ScriptParser();

                _rules.ForEach(r => parser.AddRule(r.Item1, r.Item2));
                if (_fallbackRule != null)
                {
                    parser.SetFallbackRule(_fallbackRule);
                }

                return(parser);
            }
Пример #2
0
        private static IScriptParserConsumer CreateParser()
        {
            var parser = new ScriptParser();

            parser.AddRule(ScriptConstants.Blocks.Catalog, txt => new CatalogBlock(txt));
            parser.AddRule(ScriptConstants.Blocks.Options, txt => new OptionsBlock(txt));
            parser.AddRule(ScriptConstants.Blocks.Need, txt => new NeedBlock(txt));
            parser.AddRule(ScriptConstants.Blocks.Ignore, txt => new IgnoreScriptBlock(txt));
            parser.AddRule(ScriptConstants.Blocks.Pre, txt => new SqlCommandBlock(ScriptConstants.Blocks.Pre, txt, SqlScriptPhase.Pre));
            parser.AddRule(ScriptConstants.Blocks.Main, txt => new SqlCommandBlock(ScriptConstants.Blocks.Main, txt, SqlScriptPhase.Main));
            parser.AddRule(ScriptConstants.Blocks.Post, txt => new SqlCommandBlock(ScriptConstants.Blocks.Post, txt, SqlScriptPhase.Post));

            parser.SetFallbackRule((kw, txt) => new UnexpectedBlock(kw, txt));

            return(parser);
        }
Пример #3
0
        protected override void OnSetup()
        {
            var parser = new ScriptParser();

            parser.AddRule("catalog", txt => new CatalogBlock(txt));
            parser.AddRule("options", txt => new OptionsBlock(txt));
            parser.AddRule("need", txt => new NeedBlock(txt));
            parser.AddRule("ignore", txt => new IgnoreScriptBlock(txt));
            parser.AddRule("pre", txt => new SqlCommandBlock("pre", txt, SqlScriptPhase.Pre));
            parser.AddRule("main", txt => new SqlCommandBlock("main", txt, SqlScriptPhase.Main));
            parser.AddRule("post", txt => new SqlCommandBlock("post", txt, SqlScriptPhase.Post));

            parser.SetFallbackRule((kw, txt) => new UnexpectedBlock(kw, txt));

            Given.Parser = parser;
        }
Пример #4
0
        protected override void OnSetup()
        {
            var parser = new ScriptParser();

            parser.AddRule("catalog", txt => new CatalogBlock(txt));
            parser.AddRule("options", txt => new OptionsBlock(txt));
            parser.AddRule("need", txt => new NeedBlock(txt));
            parser.AddRule("ignore", txt => new IgnoreScriptBlock(txt));
            parser.AddRule("pre", txt => new SqlCommandBlock("pre", txt, SqlScriptPhase.Pre));
            parser.AddRule("main", txt => new SqlCommandBlock("main", txt, SqlScriptPhase.Main));
            parser.AddRule("post", txt => new SqlCommandBlock("post", txt, SqlScriptPhase.Post));

            parser.SetFallbackRule((kw, txt) => new UnexpectedBlock(kw, txt));

            var loader = new ProjectLoader(@".\TestFiles\ProjectA", parser);

            loader.Load();
            Given.Configuration = loader.Configuration;
            Given.Scripts       = loader.AllScripts;
        }
        protected override void Creating()
        {
            var parser = new ScriptParser();

            parser.AddRule("catalog", txt => new CatalogBlock(txt));
            parser.AddRule("options", txt => new OptionsBlock(txt));
            parser.AddRule("need", txt => new NeedBlock(txt));
            parser.AddRule("ignore", txt => new IgnoreScriptBlock(txt));
            parser.AddRule("pre", txt => new SqlCommandBlock("pre", txt, SqlScriptPhase.Pre));
            parser.AddRule("main", txt => new SqlCommandBlock("main", txt, SqlScriptPhase.Main));
            parser.AddRule("post", txt => new SqlCommandBlock("post", txt, SqlScriptPhase.Post));
            parser.SetFallbackRule((kw, txt) => new UnexpectedBlock(kw, txt));

            var loader = new ProjectLoader(Given.Path, parser, null, Then.Logger);

            loader.Load();
            var config = Given.Config ?? ScriptDeployerConfig.Default;

            var project = new Project(loader.Configuration, loader.AllScripts);

            Then.Deployer = new SqlServerDeployer(config, project, Then.Manager, Then.Logger);
        }