コード例 #1
0
        public WorkFlowProvider CreateWorkFlow(string requiredVersion, int mayorVersion, int minorVersion, int build)
        {
            var stringDictionary              = new Dictionary <string, string>();
            var currentVersionWriter          = new CurrentVersionWriter(_databaseProjectPath);
            var currentVersionProvider        = new CurrentVersionProvider(_databaseProjectPath);
            int finalBuild                    = 0;
            var storeProceduresCreatorCommand = new StoreProceduresCreatorCommand(_databaseProjectPath, null, OutputFolderSelect.Auto, new ScriptProvider(), requiredVersion, mayorVersion, minorVersion, build, 0, currentVersionWriter, ref finalBuild);
            var stepList = new List <FlowStep>();

            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath+ " checkout develop",null), "Checkout local Develop branch", 1));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " pull --progress origin",null), "Pull remote develop", 2));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " checkout --merge Release",null), "Checkout local release branch", 3));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " pull  --progress origin",null), "Pull remote release", 4));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " merge develop",null), "Merging locally develop->Release", 5));
            //stepList.Add(new FlowStep(new ShellCommand("C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe",_solutionPath +" /p:Configuration=Release /verbosity:quiet", null), "Build project", 6));
            //stepList.Add(new FlowStep(storeProceduresCreatorCommand,$"Create SQL deployment script ({requiredVersion}-{mayorVersion}.{minorVersion}.{build}.0)",7));
            //stepList.Add(new FlowStep(new ShellCommand(_databaseProjectPath+"\\maintenance\\reinstall-database.bat", "", _databaseProjectPath+"\\maintenance"),"Deploying DB locally", 8));
            //stepList.Add(new FlowStep(new TestRunnerCommand(_repositoryPath + "\\Tests"), "Run unit tests", 9));
            stepList.Add(new FlowStep(new BackupSchemaScriptsCommand(_databaseProjectPath, currentVersionProvider), "Backup current schema scripts", 10));
            //stepList.Add(new FlowStep(new ShellCommand("cmd.exe","/c gulp prod-site", _repositoryPath), "Gulp Javascript minification", 11));
            stepList.Add(new FlowStep(new ShellCommand("C:\\Program Files (x86)\\Microsoft SQL Server\\120\\DAC\\bin\\SqlPackage.exe", "/action:Extract /OverwriteFiles:true /tf:\"C:\\temp\\test.dacpac\" /SourceConnectionString:\"Data Source=.;Initial Catalog=TrueView;persist security info=True; Integrated Security = true;MultipleActiveResultSets=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;\"", null, stringDictionary), "DB Snapshot", 11));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " add .",null), "Adding script to repo", 9));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + _repositoryPath + " commit -m \"DB deployment\""), "Commiting script", 10));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + repositoryPath + " push"), "Pushing release to remote", 11));
            //stepList.Add(new FlowStep(new ShellCommand("git.exe", "-C " + repositoryPath + " checkout develop"), "Checkout local Develop branch", 12));
            //stepList.Add(new FlowStep(new SkypeMessage("#zigunova.olga/$1978b58b71643582", "Testing"), "Message for developers to change task state in TFS", 15));
            return(new WorkFlowProvider(stepList));
        }
コード例 #2
0
        public async Task ScriptCreatorSomething()
        {
            var mock       = new Mock <ICurrentVersionWriter>();
            int finalBuild = 0;
            var sc         = new StoreProceduresCreatorCommand("C:\\Projects\\Testing\\Database", null, OutputFolderSelect.Auto,
                                                               new ScriptProvider(), "1.0.0.0", 5, 6, 7, 0, mock.Object, ref finalBuild);
            var a = await sc.Execute();

            Debug.WriteLine(a.Output);
        }
コード例 #3
0
        static int Main(string[] args)
        {
            try
            {
                Console.WriteLine("---------------");
                var generatorArguments = new GeneratorArguments();

                if (!Parser.Default.ParseArguments(args, generatorArguments))
                {
                    return(1);
                }

                if (!Directory.Exists(generatorArguments.DatabaProjectFolder))
                {
                    Console.WriteLine("Couldn't find the database project folder. Aborting process...");
                    return(1);
                }

                if (!Directory.Exists(generatorArguments.OutputFolder))
                {
                    Console.WriteLine("Couldn't find the output folder. Creating it.");
                    Directory.CreateDirectory(generatorArguments.OutputFolder);
                }

                int    mayorVersion = 0, minorVersion = 0, build = 0;
                string requiredVersion = "";
                if (generatorArguments.MinorVersion != null || generatorArguments.MayorVersion != null ||
                    generatorArguments.Build != null || generatorArguments.RequiredVersion != null)
                {
                    if (!int.TryParse(generatorArguments.MayorVersion, out mayorVersion))
                    {
                        throw new ArgumentException("The system was not able to understand the mayor version argument !!");
                    }
                    if (!int.TryParse(generatorArguments.MinorVersion, out minorVersion))
                    {
                        throw new ArgumentException("The system was not able to understand the minor version argument !!");
                    }
                    if (!int.TryParse(generatorArguments.Build, out build))
                    {
                        throw new ArgumentException("The system was not able to understand the build version argument !!");
                    }
                }
                else
                {
                    Console.WriteLine("Using required version and current version from file");
                    var currentVersionProvider = new CurrentVersionProvider(generatorArguments.DatabaProjectFolder).GetVersion();
                    mayorVersion    = currentVersionProvider.Mayor;
                    minorVersion    = currentVersionProvider.Minor;
                    build           = currentVersionProvider.Build + 1;
                    requiredVersion = mayorVersion + "." + minorVersion + "." + currentVersionProvider.Build + ".0";
                }
                Console.WriteLine("\nParameters from command line:");
                Console.WriteLine(generatorArguments);

                Console.WriteLine("\nCurrent parameters:");
                Console.WriteLine($"RequiredVersion: {requiredVersion}");
                Console.WriteLine($"MayorVersion: {mayorVersion}");
                Console.WriteLine($"MinorVersion: {minorVersion}");
                Console.WriteLine($"Build: {build}");

                var currentVersionWriter          = new NullCurrentVersionWriter();
                int finalBuild                    = 0;
                var storeProceduresCreatorCommand = new StoreProceduresCreatorCommand(generatorArguments.DatabaProjectFolder,
                                                                                      generatorArguments.OutputFolder, OutputFolderSelect.Specified, new ScriptProvider(),
                                                                                      requiredVersion, mayorVersion, minorVersion, build, 0, currentVersionWriter, ref finalBuild);

                var result = storeProceduresCreatorCommand.Execute();
                Console.WriteLine(result.Result);
                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(1);
            }
        }