Example #1
0
        public void Export(string sourceControlWarmupLocation, string templateName, TargetDir targetDir)
        {
            string baseDir = Path.Combine(sourceControlWarmupLocation, templateName);

            Console.WriteLine("Copying to: {0}", targetDir.FullPath);
            CopyDirectory(baseDir, targetDir.FullPath);
        }
Example #2
0
File: Git.cs Project: gusa98/warmup
        public void Export(string sourceControlWarmupLocation, string templateName, TargetDir targetDir)
        {
            var baseUri = new Uri(WarmupConfiguration.settings.SourceControlWarmupLocation + templateName);

            Console.WriteLine("git exporting to: {0}", targetDir.FullPath);
            Clone(baseUri, targetDir);
        }
Example #3
0
        static void Main(string[] args)
        {
            //parse out command line
            // warmup web FHLBank.Grouping
            string templateName = args[0];
            string name = args[1];

            var td = new TargetDir(name);
            IExporter exporter = GetExporter();
            exporter.Export(WarmupConfiguration.settings.SourceControlWarmupLocation, templateName, td);
            Console.WriteLine("replacing tokens");
            td.ReplaceTokens(name);
        }
Example #4
0
        static void Main(string[] args)
        {
            //parse out command line
            // warmup web FHLBank.Grouping
            string templateName = args[0];
            string name = args[1];

            //svn only
            var baseUri = new Uri(ConfigurationManager.AppSettings["source_control"] + templateName);
            var td = new TargetDir(name);
            Svn.Export(baseUri, td);
            td.ReplaceTokens(name);
        }
Example #5
0
        static void Main(string[] args)
        {
            //parse out command line
            // warmup web FHLBank.Grouping
            var useDefaultTemplate = args.Length < 2;
            string templateName = useDefaultTemplate ? WarmupConfiguration.settings.DefaultTemplate : args[0];
            string name = useDefaultTemplate ? args[0] : args[1];
            string target = null;
            if (args.Length > 2) target = args[2];

            var td = new TargetDir(name);
            IExporter exporter = GetExporter();
            exporter.Export(WarmupConfiguration.settings.SourceControlWarmupLocation, templateName, td);
            Console.WriteLine("replacing tokens");
            td.ReplaceTokens(name);
            td.MoveToDestination(target);
        }
Example #6
0
        static void Main(string[] args)
        {
            if (args == null || args.Length < 2)
            {
                ShowHelp();
                Environment.Exit(-1);
            }
            //parse out command line
            // warmup web newprojName
            string templateName = args[0];
            string name = args[1];
            string target = null;
            if (args.Length > 2) target = args[2];

            var td = new TargetDir(name);
            IExporter exporter = GetExporter();
            exporter.Export(WarmupConfiguration.settings.SourceControlWarmupLocation, templateName, td);
            Console.WriteLine("replacing tokens");
            td.ReplaceTokens(name);
            td.MoveToDestination(target);
        }
Example #7
0
        static void Main(string[] args)
        {
            //parse out command line
            // warmup web FHLBank.Grouping
            string templateName = args[0];
            string name         = args[1];
            string target       = null;

            if (args.Length > 2)
            {
                target = args[2];
            }

            var       td       = new TargetDir(name);
            IExporter exporter = GetExporter();

            exporter.Export(WarmupConfiguration.settings.SourceControlWarmupLocation, templateName, td);
            Console.WriteLine("replacing tokens");
            td.ReplaceTokens(name);
            td.MoveToDestination(target);
        }
Example #8
0
File: Git.cs Project: gusa98/warmup
        public static void Clone(Uri sourceLocation, TargetDir target)
        {
            var separationCharacters = new[] { ".git" };

            string[] piecesOfPath = sourceLocation.ToString().Split(separationCharacters, StringSplitOptions.RemoveEmptyEntries);
            if (piecesOfPath != null && piecesOfPath.Length > 0)
            {
                string sourceLocationToGit = piecesOfPath[0] + ".git";

                var psi = new ProcessStartInfo("cmd",
                                               string.Format(" /c git clone {0} {1}", sourceLocationToGit, target.FullPath));

                psi.UseShellExecute        = false;
                psi.CreateNoWindow         = true;
                psi.RedirectStandardOutput = true;
                psi.RedirectStandardError  = true;

                //todo: better error handling
                Console.WriteLine("Running: {0} {1}", psi.FileName, psi.Arguments);
                string output, error = "";
                using (Process p = Process.Start(psi))
                {
                    output = p.StandardOutput.ReadToEnd();
                    error  = p.StandardError.ReadToEnd();
                }

                Console.WriteLine(output);
                Console.WriteLine(error);

                var templateName = piecesOfPath[1];
                GitTemplateExtractor extractor = new GitTemplateExtractor(target, templateName);
                extractor.Extract();
                //string git_directory = Path.Combine(target.FullPath, ".git");
                //if (Directory.Exists(git_directory))
                //{
                //    Console.WriteLine("Deleting {0} directory", git_directory);
                //    Directory.Delete(git_directory, true);
                //}
            }
        }
Example #9
0
        public static void Clone(Uri sourceLocation, TargetDir target)
        {
            var separationCharacters = new[] {".git"};
            string[] piecesOfPath = sourceLocation.ToString().Split(separationCharacters, StringSplitOptions.RemoveEmptyEntries);
            if (piecesOfPath != null && piecesOfPath.Length > 0)
            {
                string sourceLocationToGit = piecesOfPath[0] + ".git";

                var psi = new ProcessStartInfo("cmd",
                                               string.Format(" /c git clone {0} {1}", sourceLocationToGit, target.FullPath));

                psi.UseShellExecute = false;
                psi.CreateNoWindow = true;
                psi.RedirectStandardOutput = true;
                psi.RedirectStandardError = true;

                //todo: better error handling
                Console.WriteLine("Running: {0} {1}", psi.FileName, psi.Arguments);
                string output, error = "";
                using (Process p = Process.Start(psi))
                {
                    output = p.StandardOutput.ReadToEnd();
                    error = p.StandardError.ReadToEnd();
                }

                Console.WriteLine(output);
                Console.WriteLine(error);

                var templateName = piecesOfPath.Length > 1 ? piecesOfPath[1] : piecesOfPath[0];
                GitTemplateExtractor extractor = new GitTemplateExtractor(target, templateName);
                extractor.Extract();
                //string git_directory = Path.Combine(target.FullPath, ".git");
                //if (Directory.Exists(git_directory))
                //{
                //    Console.WriteLine("Deleting {0} directory", git_directory);
                //    Directory.Delete(git_directory, true);
                //}
            }
        }
Example #10
0
        public static void SvnExport(Uri sourceLocation, TargetDir target)
        {
            var psi = new ProcessStartInfo("svn",
                                           string.Format("export {0} {1}", sourceLocation, target.FullPath));

            psi.UseShellExecute = false;
            psi.CreateNoWindow = true;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError = true;

            //todo: better error handling
            Console.WriteLine("Running: {0} {1}", psi.FileName, psi.Arguments);
            string output, error = "";
            using (Process p = Process.Start(psi))
            {
                output = p.StandardOutput.ReadToEnd();
                error = p.StandardError.ReadToEnd();
            }

            Console.WriteLine(output);
            Console.WriteLine(error);
        }
Example #11
0
        public void Export(string sourceControlWarmupLocation, string templateName, TargetDir targetDir)
        {
            var gitUri = WarmupConfiguration.settings.SourceControlWarmupLocation + templateName;
            Console.WriteLine("git exporting to: {0}", targetDir.FullPath);

            var separationCharacters = new[] {".git"};
            var piecesOfPath = gitUri.Split(separationCharacters, StringSplitOptions.RemoveEmptyEntries);
            if (piecesOfPath.Length <= 0) return;

            var sourceLocationToGit = piecesOfPath[0] + ".git";

            var cloneCommand = string.Format("git clone {0} {1}", sourceLocationToGit, targetDir.FullPath);
            RunGitCommandInExternalProcess(cloneCommand, null);

            if (WarmupConfiguration.settings.GitBranch != null)
            {
                var checkoutCommand = string.Format("git checkout {0}", WarmupConfiguration.settings.GitBranch);
                RunGitCommandInExternalProcess(checkoutCommand, targetDir.FullPath);
            }

            var exportTemplateName = piecesOfPath.Length > 1 ? piecesOfPath[1] : WarmupConfiguration.settings.DefaultTemplate;
            new GitTemplateExtractor(targetDir, exportTemplateName).Extract();
        }
Example #12
0
File: Svn.cs Project: gusa98/warmup
        public static void SvnExport(Uri sourceLocation, TargetDir target)
        {
            var psi = new ProcessStartInfo("svn",
                                           string.Format("export {0} {1}", sourceLocation, target.FullPath));

            psi.UseShellExecute        = false;
            psi.CreateNoWindow         = true;
            psi.RedirectStandardOutput = true;
            psi.RedirectStandardError  = true;

            //todo: better error handling
            Console.WriteLine("Running: {0} {1}", psi.FileName, psi.Arguments);
            string output, error = "";

            using (Process p = Process.Start(psi))
            {
                output = p.StandardOutput.ReadToEnd();
                error  = p.StandardError.ReadToEnd();
            }

            Console.WriteLine(output);
            Console.WriteLine(error);
        }
Example #13
0
 public GitTemplateExtractor(TargetDir target, string templateName)
 {
     _target = target;
     _templateName = templateName;
 }
Example #14
0
 public void Export(string sourceControlWarmupLocation, string templateName, TargetDir targetDir)
 {
     var baseUri = new Uri(WarmupConfiguration.settings.SourceControlWarmupLocation + templateName);
     Console.WriteLine("git exporting to: {0}", targetDir.FullPath);
     Clone(baseUri, targetDir);
 }
Example #15
0
 public void Export(string sourceControlWarmupLocation, string templateName, TargetDir targetDir)
 {
     string baseDir = Path.Combine(sourceControlWarmupLocation, templateName);
     Console.WriteLine("Copying to: {0}", targetDir.FullPath);
     CopyDirectory(baseDir, targetDir.FullPath);
 }
Example #16
0
 public GitTemplateExtractor(TargetDir target, string templateName)
 {
     _target       = target;
     _templateName = templateName;
 }