Example #1
0
        public Task Execute(IJobExecutionContext context)
        {
            JobKey key     = context.JobDetail.Key;
            var    dataMap = context.MergedJobDataMap;
            var    state   = (ArrayList)dataMap["stateData"];

            Apply((int)state[state.Count - 1]);
            state.Add(DatabaseConnectionManager.GetLastId());
            var log = "Instance " + key + " done";

            return(Console.Out.WriteAsync(log));
        }
Example #2
0
        static void Main(string[] args)
        {
            //last id = 145
            //Work.ApplyAllSources();
            //Work.Apply(0);

            //Change 145 here into actual lastID

            /*Application.Start(145).GetAwaiter().GetResult();
             * Console.ReadKey();*/
            DatabaseConnectionManager.ReadAllLogs(145);
            //DatabaseConnectionManager.ReadLog(145);
        }
Example #3
0
        public static void Apply(int lastID)
        {
            var iGit = new GitInterface();

            iGit.Apply(DatabaseConnectionManager.ReadAllLogs(lastID));
        }
Example #4
0
        //Commit and push all source files which are not in the log table
        public void InitSources()
        {
            var  almzSources        = DatabaseConnectionManager.GetAlmzSourceNames();
            var  bpmonline_pSources = DatabaseConnectionManager.GetBpmonline_pSourceNames();
            bool isDirectory;

            // Commit all sources from Almz scheme
            foreach (var source in almzSources)
            {
                // If type eq package or package body, create a folder then add log there
                if (source.Type.Contains("PACKAGE"))
                {
                    isDirectory = true;
                    Directory.CreateDirectory(RepoPath + "\\" + "almz" + "\\" + source.Name);
                    using (StreamWriter writer =
                               File.CreateText(RepoPath + "\\" + "almz" + "\\" + source.Name + "\\" + "PACKAGEBODY.sql"))
                    {
                        writer.Write(source.Text);
                    }
                }
                //else just write it in current directory
                else
                {
                    isDirectory = false;
                    using (StreamWriter writer =
                               File.CreateText(RepoPath + "\\" + "almz" + "\\" + source.Name + ".sql"))
                    {
                        writer.Write(source.Text);
                    }
                }

                // Stage and commit last file
                using (var repo = new Repository(RepoPath))
                {
                    const string user = "******";
                    string       path;
                    if (isDirectory)
                    {
                        path = RepoPath + "\\" + "almz" + "\\" + source.Name + "/";
                    }
                    else
                    {
                        path = RepoPath + "\\" + "almz" + "\\" + source.Name + ".sql";
                    }
                    Commands.Stage(repo, path);
                    var author = new Signature(user, user + "@aebit.local",
                                               DateTimeOffset.Now);
                    try
                    {
                        var commit = repo.Commit("No comments", author, author);
                        Console.WriteLine("File " + source.Name + " commited.");
                    }
                    catch (
                        LibGit2SharpException e
                        )
                    {
                        Console.WriteLine("Commit skipped " + source.Name + "\nError message " + e.Message);
                    }
                }
            }

            // Commit all sources from bpmonline_p scheme
            foreach (var source in bpmonline_pSources)
            {
                // If type eq package or package body, create a folder then add log there
                if (source.Type.Contains("PACKAGE"))
                {
                    isDirectory = true;
                    Directory.CreateDirectory(RepoPath + "\\" + "bpmonline_p" + "\\" + source.Name);
                    using (StreamWriter writer =
                               File.CreateText(RepoPath + "\\" + "bpmonline_p" + "\\" + source.Name + "\\" +
                                               "PACKAGEBODY.sql"))
                    {
                        writer.Write(source.Text);
                    }
                }
                //else just write it in current directory
                else
                {
                    isDirectory = false;
                    using (StreamWriter writer =
                               File.CreateText(RepoPath + "\\" + "bpmonline_p" + "\\" + source.Name + ".sql"))
                    {
                        writer.Write(source.Text);
                    }
                }

                // Stage and commit last file
                using (var repo = new Repository(RepoPath))
                {
                    const string user = "******";
                    string       path;
                    if (isDirectory)
                    {
                        path = RepoPath + "\\" + "bpmonline_p" + "\\" + source.Name + "/";
                    }
                    else
                    {
                        path = RepoPath + "\\" + "bpmonline_p" + "\\" + source.Name + ".sql";
                    }
                    Commands.Stage(repo, path);
                    var author = new Signature(user, user + "@aebit.local",
                                               DateTimeOffset.Now);
                    try
                    {
                        var commit = repo.Commit("No comments", author, author);
                        Console.WriteLine("File " + source.Name + " commited.");
                    }
                    catch (
                        LibGit2SharpException e
                        )
                    {
                        Console.WriteLine("Commit skipped " + source.Name + "\nError message " + e.Message);
                    }
                }
            }
        }