Skip to content

Commit a17990a

Browse files
committed
Make sure source repo is cloned BEFORE trying to access its contents
1 parent 113d1ce commit a17990a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/Moryx.Cli.Commands/CommandBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ public class CommandBase
77
{
88
public static CommandResult Exec(Template template, Func<CommandResult> func)
99
{
10-
TemplateRepository.Clone(template.Settings);
10+
return Exec(template.Settings, func);
11+
}
12+
13+
public static CommandResult Exec(TemplateSettings settings, Func<CommandResult> func)
14+
{
15+
TemplateRepository.Clone(settings);
1116
return func();
1217
}
1318
}

src/Moryx.Cli.Commands/CreateNew.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ public static CommandResult Solution(NewOptions options, [NotNull] Action<string
3535
var settings = config.AsTemplateSettings(dir, solutionName);
3636
settings.Pull = options.Pull;
3737

38-
string errorMessage = "";
39-
var configuration = TemplateConfigurationFactory.Load(settings.SourceDirectory, error =>
38+
return CommandBase.Exec(settings, () =>
4039
{
41-
errorMessage = error;
42-
});
43-
if (configuration == null)
44-
return CommandResult.WithError(errorMessage);
40+
string errorMessage = "";
41+
var configuration = TemplateConfigurationFactory.Load(settings.SourceDirectory, error =>
42+
{
43+
errorMessage = error;
44+
});
45+
if (configuration == null)
46+
return CommandResult.WithError(errorMessage);
4547

46-
var template = Template.Load(settings, configuration);
48+
var template = Template.Load(settings, configuration);
4749

48-
return CommandBase.Exec(template, () =>
49-
{
5050
Directory.CreateDirectory(solutionName);
5151
CreateBareSolution(template);
5252
config.Save(dir);

0 commit comments

Comments
 (0)