Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
Archivo: Git.cs Proyecto: 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
Archivo: Git.cs Proyecto: 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);
                //}
            }
        }
Ejemplo n.º 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);
                //}
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 12
0
Archivo: Svn.cs Proyecto: 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);
        }
Ejemplo n.º 13
0
 public GitTemplateExtractor(TargetDir target, string templateName)
 {
     _target = target;
     _templateName = templateName;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 16
0
 public GitTemplateExtractor(TargetDir target, string templateName)
 {
     _target       = target;
     _templateName = templateName;
 }