Skip to content

Commit fe7adba

Browse files
author
Chris Thompson
committed
loads additional cake files in the root folder
1 parent 16bd7a1 commit fe7adba

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/TaskRunner/TaskRunner.cs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,22 @@ private ITaskRunnerNode LoadHierarchy(string configPath)
105105
ITaskRunnerNode root = new TaskRunnerNode("Cake");
106106

107107
// Build
108-
var buildDev = CreateTask(cwd, $"Default ({configFileName})", "Runs 'cake build.cake'", configFileName);
109-
var tasks = TaskParser.LoadTasks(configPath);
110-
var commands =
111-
tasks.Select(
112-
t =>
113-
CreateTask(cwd, t.Key, $"Runs {configFileName} with the \"{t.Key}\" target",
114-
buildDev.Command.Args + $" {t.Value}"));
115-
var nodes = commands as IList<TaskRunnerNode> ?? commands.ToList();
116-
buildDev.Children.AddRange(nodes);
117-
root.Children.Add(buildDev);
118-
CakePackage.Dte.ShowStatusBarText($"Loaded {nodes.Count} tasks from {configFileName}");
108+
string[] filePaths = Directory.GetFiles(cwd, "*.cake");
109+
foreach (var filePath in filePaths)
110+
{
111+
var file = Path.GetFileName(filePath);
112+
var buildDev = CreateTask(cwd, $"{file}", $"Runs 'cake {file}'", file);
113+
var tasks = TaskParser.LoadTasks(filePath);
114+
var commands =
115+
tasks.Select(
116+
t =>
117+
CreateTask(cwd, t.Key, $"Runs {file} with the \"{t.Key}\" target",
118+
buildDev.Command.Args + $" {t.Value}"));
119+
var nodes = commands as IList<TaskRunnerNode> ?? commands.ToList();
120+
buildDev.Children.AddRange(nodes);
121+
root.Children.Add(buildDev);
122+
CakePackage.Dte.ShowStatusBarText($"Loaded {nodes.Count} tasks from {file}");
123+
}
119124
return root;
120125
}
121126

0 commit comments

Comments
 (0)