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

Allow RoboClass without setting RoboFile. #242

Closed
wants to merge 1 commit into from

Conversation

derhasi
Copy link

@derhasi derhasi commented Nov 27, 2015

When using robo within a script or an autoloaded environment, it is not necessary to provide the exact location of the RoboClass. So it would be nice to make that RoboFile optional.

This way we can do something like this.

$robo = new \Robo\Runner('\MyProject\MyRoboFile');
$robo->execute(array('robo', 'something'));

@derhasi derhasi changed the title Allow RoboClass without setting explicit location. Allow RoboClass without setting RoboFile. Nov 27, 2015
@boedah
Copy link
Contributor

boedah commented Dec 2, 2015

Robo itself has a RoboFile. Does it get autoloaded if installing Robo via composer?

@derhasi
Copy link
Author

derhasi commented Dec 3, 2015

No, it doesn't, as only src is added to the autoloader

@boedah
Copy link
Contributor

boedah commented Dec 5, 2015

Ah, of course ;)
Got confused because one needs to exclude Robos RoboFile in an IDE...

@greg-1-anderson
Copy link
Member

One of the main motivations for doing this is to run Robo directly from a Composer custom installer. Unfortunately, Composer only loads classes for custom installer's dependencies, not files. This makes components such as Guzzle, which depend on the inclusion of files, unusable in this context. See: composer/composer#4764

This feature may also be desirable in other scripting contexts, for environments where a script wishes to use Robo functionality without entering through the main robo file (e.g. a tool that has its own cli parser). However, in this context it might be better to support direct use of Robo tasks without the runner. That approach also requires a bit of work, and should be the subject of a separate PR.

This should stay open in case a use-case not involving autoload files presents itself. It probably wouldn't hurt to just merge it, although tests would be nice.

@greg-1-anderson
Copy link
Member

So, drupal-scaffold is now running Robo like this, except it is using a custom Runner sublcass to make it work.

We could remove this class if this PR was merged; I'd recommend putting it in.

@brad-jones
Copy link

My interim solution, if anyone else is interested.
https://github.com/brad-jones/robo-runner

@greg-1-anderson
Copy link
Member

The change from this PR is also included in #285.

@DavertMik
Copy link
Member

So I'm closing in favor of #285

@DavertMik DavertMik closed this Mar 13, 2016
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

Successfully merging this pull request may close these issues.

None yet

5 participants