Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define tasks in tasks directory with separate files #16

Closed
wants to merge 5 commits into from
Closed

Define tasks in tasks directory with separate files #16

wants to merge 5 commits into from

Conversation

broncha
Copy link

@broncha broncha commented Feb 24, 2013

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 mentioned this pull request Aug 20, 2013
@clue
Copy link
Collaborator

clue commented Dec 20, 2013

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):

Phakefile.php

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

group('a', function() {
    load('task/a.php');
});

task/a.php

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

@jaz303
Copy link
Owner

jaz303 commented Dec 20, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants