Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Getting options for a custom taks #566

Closed
acmitch opened this issue Aug 6, 2015 · 3 comments
Closed

Getting options for a custom taks #566

acmitch opened this issue Aug 6, 2015 · 3 comments
Assignees
Milestone

Comments

@acmitch
Copy link

acmitch commented Aug 6, 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 acmitch changed the title Creating Options for a custom taks Getting options for a custom taks Aug 6, 2015
@acmitch
Copy link
Author

acmitch commented 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
Copy link
Member

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

@Anahkiasen
Copy link
Member

Issue moved to rocketeers/docs #31 via ZenHub

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

No branches or pull requests

2 participants