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

Getting options for a custom taks #31

Open
Anahkiasen opened this issue Jul 19, 2016 · 0 comments
Open

Getting options for a custom taks #31

Anahkiasen opened this issue Jul 19, 2016 · 0 comments

Comments

@Anahkiasen
Copy link
Member

@acmitch commented on Thu Aug 06 2015

So I've created a custom task, however, when trying to call $this->getOption('start_date'); I get the error

  [RuntimeException]
  The "--start_date" option does not exist

deploy:custom [-P|--parallel] [-p|--pretend] [-C|--on="..."] [-S|--stage="..."] [-B|--branch="..."] [--host="..."] [--username="..."] [--password="..."] [--key="..."] [--keyphrase="..."] [--agent="..."] [--repository="..."]

Looking at the migration tasks and others. It seems custom options can be passed through?


@acmitch commented on Tue Aug 11 2015

Wanted to follow up for anyone having similar issues. This is very possible.

All you have to do is create a custom command which extends BaseTaskCommand and override the getOptions child function.

To get your newly created command class to autoload, simply place your code in one of the autoloaded folders such as 'strategies' or 'tasks'.

I know this comment is very broad, so check out how Anahkiasen handles extending the 'deploy' command here.

You can see he has a class doing what I just described above. @Anahkiasen you really need some documenation on this. I love this library but to use it as a task runner the ability to have rocketeer as an extension of my libraries is really helpful.

For the short term just simply autoloading a 'commands' directory if it exists would be great!


@Anahkiasen commented on Tue Aug 11 2015

As you may have noticed I'm rather buys currently so Rocketeer is a bit in pause, but all PRs are welcome to the rocketeer/docs repo

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

No branches or pull requests

1 participant