0

I thought I had installed successfully module builder as drush plugin : typing help mb returns complete help story...

But when I try to use it, ie typing mb easyresponsive_panels ctools_plugin_directory menu --write, it gives me the following error :

Command mb-build needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. The drush command 'mb easyresponsive_panels' could not be executed. Could not find a Drupal settings.php file at sites/default/settings.php.

I have a multi site install, this is why no sites/default/settings.php is found.

I tried to specify root and site explicitly, as per these answers, running --root=path/to/drupal --uri=mysite.com status, this returns the correct complete status :

Drupal version : 7.24 
Site URI : visages_20131224:8082 
Database driver : mysql 
Database username : drupaluser 
Database name : visages_20131224 
Database : Connected 
Drupal bootstrap : Successful 
Drupal user : 
Default theme : neptune 
Administration theme : adaptivetheme_admin 
PHP executable : php.exe 
PHP configuration : C:\wamp\bin\php\php5.3.13\php.ini 
PHP OS : WINNT
Drush version : 7.0-dev 
Drush configuration : 
Drush alias files : 
Drupal root : C:\Users\Thierry\Sites\visages_20131224\ 
Site path : sites/visages_20131224 
File directory path : sites/visages_20131224/files 
Temporary file directory path : c:\windows\temp

(my dev config : Windows 7, Acquia Dev Deskstop, Netbeans, D7)

Related Q&A didn't enlightened me yet, any help is welcome.

5
  • 1
    The normal method is to set up Drush aliases, and use drush @alias ... to target a particular site
    – Clive
    Mar 13, 2014 at 16:49
  • Many thanks for the link @Clive, I read it quickly, but don't understand how it could help in my case ? says : "drush aliases allow you to run a drush commands on your local server but actually execute the command on a remote server. " very useful indeed, but at the moment I don't have any remote install for that dev ... It's a localhost pb
    – Kojo
    Mar 13, 2014 at 17:07
  • 1
    Sorry, this link would've been better :)
    – Clive
    Mar 13, 2014 at 17:11
  • Yep @Clive got it working, narrow-minded I was : @ mysite.local mb mymodule hook1 hook2 --write Please write both links as answer, both were useful. Or if you prefer I'll redact answer myself. Many thanks again
    – Kojo
    Mar 13, 2014 at 17:56
  • If you wouldn't mind posting your last edit as an answer (with any other steps if there were any) that would be awesome, I'm sure it would help some future visitors
    – Clive
    Mar 13, 2014 at 18:56

1 Answer 1

1

Thanks to Clive comments, and as explained in Drupal, Drush aliases and how to use them, I solved it as following.

Add an alias conf file named sitename.aliases.drushrc.php in .drush folder in your home directory :

/**
 * Local
 */
// The site in sites/default/
$aliases['default.local'] = array(
  'uri' => 'default',
  'root' => '/path/to/drupal',
  'path-aliases' => array(
    '%dump-dir' => '/tmp'
  ),
);
// The site in sites/sitename/ 
$aliases['sitename.local'] = array(
  'uri' => 'sitename_URI',
  'root' => '/path/to/drupal',
  'path-aliases' => array(
    '%dump-dir' => '/tmp'
  ),
);

Don't forget to clear cache : drush cache-clear drush.

Test your alias : @sitename.local status.

Now you can run i.e @sitename.local mb mymodule hook1 hook2 --write

Really powerful !

See Drush multi-site aliases for complete configuration of local/remote aliases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.