Example #1
0
 public void Preview(TemplatePlanContext context)
 {
     Console.WriteLine("Template plan for {0}", context.Input.ProjectName);
     Steps
     .Each(step =>
     {
         var description = step.Describe(context);
         if (description.IsNotEmpty())
         {
             Console.WriteLine("* {0}", description);
         }
     });
 }
Example #2
0
 public void Preview(TemplatePlanContext context)
 {
     Console.WriteLine("Template plan for {0}", context.Input.ProjectName);
     Steps
         .Each(step =>
                   {
                       var description = step.Describe(context);
                       if(description.IsNotEmpty())
                       {
                           Console.WriteLine("* {0}", description);
                       }
                   });
 }
        public void Execute(NewCommandInput input, TemplatePlan plan, Action <TemplatePlanContext> continuation)
        {
            var context = new TemplatePlanContext
            {
                Input   = input,
                TempDir = createTempDir()
            };

            _fileSystem.CreateDirectory(context.TempDir);

            var targetPath = input.ProjectName;

            if (input.OutputFlag.IsNotEmpty())
            {
                targetPath = input.OutputFlag;
            }
            else if (input.SolutionFlag.IsNotEmpty())
            {
                targetPath = _fileSystem.GetDirectory(input.SolutionFlag);
            }

            context.TargetPath = Path.Combine(Environment.CurrentDirectory, targetPath);

            plan.Preview(context);

            try
            {
                plan
                .Steps
                .Each(step => step.Execute(context));
            }
            catch (Exception exc)
            {
                context.RegisterError(exc.Message);
                context.RegisterError(exc.StackTrace);
            }

            continuation(context);
            _fileSystem.DeleteDirectory(context.TempDir);
        }
Example #4
0
        public void Execute(NewCommandInput input, TemplatePlan plan, Action<TemplatePlanContext> continuation)
        {
            var context = new TemplatePlanContext
                              {
                                  Input = input,
                                  TempDir = createTempDir()
                              };

            _fileSystem.CreateDirectory(context.TempDir);

            var targetPath = input.ProjectName;
            if(input.OutputFlag.IsNotEmpty())
            {
                targetPath = input.OutputFlag;
            }
            else if(input.SolutionFlag.IsNotEmpty())
            {
                targetPath = _fileSystem.GetDirectory(input.SolutionFlag);
            }

            context.TargetPath = Path.Combine(Environment.CurrentDirectory, targetPath);

            plan.Preview(context);

            try
            {
                plan
                    .Steps
                    .Each(step => step.Execute(context));
            }
            catch (Exception exc)
            {
                context.RegisterError(exc.Message);
                context.RegisterError(exc.StackTrace);
            }

            continuation(context);
            _fileSystem.DeleteDirectory(context.TempDir);
        }
Example #5
0
 public void Execute(TemplatePlanContext context)
 {
 }
Example #6
0
 public string Describe(TemplatePlanContext context)
 {
     return "";
 }