Skip to content

Commit

Permalink
loads additional cake files in the root folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Thompson committed Jul 20, 2018
1 parent 16bd7a1 commit fe7adba
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/TaskRunner/TaskRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,22 @@ private ITaskRunnerNode LoadHierarchy(string configPath)
ITaskRunnerNode root = new TaskRunnerNode("Cake");

// Build
var buildDev = CreateTask(cwd, $"Default ({configFileName})", "Runs 'cake build.cake'", configFileName);
var tasks = TaskParser.LoadTasks(configPath);
var commands =
tasks.Select(
t =>
CreateTask(cwd, t.Key, $"Runs {configFileName} with the \"{t.Key}\" target",
buildDev.Command.Args + $" {t.Value}"));
var nodes = commands as IList<TaskRunnerNode> ?? commands.ToList();
buildDev.Children.AddRange(nodes);
root.Children.Add(buildDev);
CakePackage.Dte.ShowStatusBarText($"Loaded {nodes.Count} tasks from {configFileName}");
string[] filePaths = Directory.GetFiles(cwd, "*.cake");
foreach (var filePath in filePaths)
{
var file = Path.GetFileName(filePath);
var buildDev = CreateTask(cwd, $"{file}", $"Runs 'cake {file}'", file);
var tasks = TaskParser.LoadTasks(filePath);
var commands =
tasks.Select(
t =>
CreateTask(cwd, t.Key, $"Runs {file} with the \"{t.Key}\" target",
buildDev.Command.Args + $" {t.Value}"));
var nodes = commands as IList<TaskRunnerNode> ?? commands.ToList();
buildDev.Children.AddRange(nodes);
root.Children.Add(buildDev);
CakePackage.Dte.ShowStatusBarText($"Loaded {nodes.Count} tasks from {file}");
}
return root;
}

Expand Down

0 comments on commit fe7adba

Please sign in to comment.