Define tasks in `tasks` directory with separate files #16

wants to merge 5 commits into

3 participants


A new directory tasks has been added and Phakefile resolver updated such that it looks for file related with certain task.
This way the tasks can be maintained in different files in tasks folder and would be easier for modular development.
Just like rake tasks are kept in lib/tasks/task-file-for-individual-gems

@clue clue referenced this pull request Aug 20, 2013

Improve Builder #27


Thanks for this PR! 👍

I really like the idea of organizing Phakefile's groups into separate folders. I've personally run into the situation where a single Phakefile easily outgrows 500+ lines and becomes a hard to manage mess.

However, this PR breaks with quite a few existing Phakefiles as it changes it so that every group is always expected to be in a "task" folder.

Instead, I'd like to see a more explicit approach where we can explicitly opt-in to include others files somewhat like this (just a sketch / pseudo-code):


task('default', 'a:sub');

group('a', function() {


task('sub', function() {
  echo '...';

I agree with @clue - it's a good feature idea but it should't impose structure on the filesystem. We're not Java developers, after all.

I imagine a couple of functions would be all that is necessary, load_tasks and load_tasks_recursive perhaps? Or even just one function that accepts a glob.

load_tasks: load all tasks from a given file/dir (basically just a relative require())
load_tasks_recursively: recursively load tasks from a dir structure (again, just a relative require())
load_task_groups: load all tasks, recursively, from a folder structure, implicitly creating groups for each subdirectory encountered

@broncha broncha closed this Jun 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment