I think this should be possible, but I'm lost as to how to accomplish it.

Acquia's Dev Desktop creates sites/[something].localhost/settings.php files for you. I do this a lot when importing a client's site locally.

It would be nice to add something to my ~/.drush folder to tell drush I want to use *.localhost for my default settings.php instead of sites/default/settings.php.

Any ideas or am I off on the wrong track?

Comments

moshe weitzman’s picture

Status: Active » Fixed

I assume you are trying to install Drupal? See the --sites-subdir option for site-install command.

kscheirer’s picture

Status: Fixed » Needs review

No, this isn't for installing Drupal - just for making Drush work better with dev desktop.

I have a very bad shell script that does what I'm looking for (use sites/*.localhost instead of sites/default).
I'd appreciate any comments - shell scripts are definitely not my thing :) but I'm not sure if anyone else find this ability useful.

Karls-MacBook-Pro:default karl$ cat ~/www/drush/drush.1
#!/bin/bash

site=default

for i in $(find . -name "settings.php" ) ; do
  found=$(basename $(dirname $i))

  if [[ "$found" == *.localhost* ]]
  then
    site=$found
    break
  fi
done


if [ "$site" != "default" ]; then
  "/Users/karl/www/drush/drush" --uri=http://$site "$@"
else 
  "/Users/karl/www/drush/drush" "$@"
fi
greg.1.anderson’s picture

Status: Needs review » Active

I think this might be acceptable, if someone provided a patch. There is no patch here, though, so setting status to "active".

greg.1.anderson’s picture

Category: support » feature

Oh, and this is a feature request.

kscheirer’s picture

If you can point me to the right place to patch Drush, I'll work on it. The code I provided above is a shell script that I use to execute Drush, so I don't really know where that would go. Maybe a help file? Someone at Acquia want to provide this as part of dev desktop...? :D

greg.1.anderson’s picture

See _drush_bootstrap_selected_uri() in includes/bootstrap.inc; that looks like the most likely candidate to me.

greg.1.anderson’s picture

Version: 7.x-5.7 » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.