Let's write a browser inside the browser, in Javascript!
How to get Drush Working on Localhost
Why is drush the shiznit?
drush cc clears the cache
drush sql-dump >> /my/file dumps the sql database
drush dl mymodule mymodle2 downloads modules
drush en mymodule mymodule2 enables modules
drush cron runs cron
drush cron runs cron
drush upgrade updates all modules
full tutorial for getting Drush to work.
First download drush. Maybe peruse some drush information.
Copy the folder to your local machine. Make the drush binary within executable. chmod
+x drushbinary
Test your drush setup:
In order for drush to work, it has to be in a valid drupal installation file tree. In a random drupal install, it first tries to access the database in sites/default. If this doesn't work, it gives you an error. You'll need to be in sites/localhost.com, which will contain a settings.php file that points to your localhost, for this to work.
Navigate to a local drupal installation.
/Users/Jeremy/bin/drush/drush status
Put a link in your alias file to the drush binary
echo "alias drush='/Users/Jeremy/bin/drush/drush'" >>
~/.bash_profile
And don't forget to reload your newly-created alias file:
source ~/.bash_profile
OPTIONAL:troubleshooting
If it isn't working with your PHP, like your using MAMP or something you might do a little troublshooting to figure out which php on your
Borges-like macports setup is being called and put the right link to php in your PATH or in your alias file:
which php
or also useful
which mysql
and put a link to the correct PHP, in my case like so
PATH=/Applications/MAMP/bin/php5.2/bin:\
/Applications/MAMP/Library/bin:$PATH
Drush: the aliasing
put this your drush folder in a file client.alias.drushrc.php
'root' => '/var/www/vhosts/your_drupal/sites/your_site',
'uri' => 'dev.clientsite.com',
'remote-host' => 'dev.yourcompany.com',
'remote-user' => 'your_remote_user_name',
);
Now, test this mutha by running
drush @client status
Sweet.







Comments
12 July 2007
22 hours 53 min
If you work on development involving a number of different servers - such as a standard local/dev/staging/live setup - the 'parent' configuration option can be very helpful.
The way I've found best to have this set up is to create a file that holds the basic settings for all your commonly used servers, including localhost. I call this servers.alias.drushrc.php and it contains something like this:
'path-aliases' => array(
'%files' => 'sites/default/files',
'%dump' => 'sync-dump.sql',
),
);
$aliases['local'] = array(
'parent' => '@default' ,
);
$aliases['dev-server'] = array(
'remote-host' => 'dev-server.echoditto.com',
'remote-user' => 'ethan',
'parent' => '@default' ,
);
$aliases['live-server'] = array(
'remote-host' => 'live-server.echoditto.com',
'remote-user' => 'ethan',
'parent' => '@default' ,
);
The 'parent' setting in the servers alias file is used to share default settings between all servers.
With this foundation set you can then set up individual project alias files that contain specific settings for that project across all servers. I tent to name these files according to the project name, and they contain settings like:
'uri' => 'trunk.client.local',
'root' => '/Users/ethan/Sites/trunk.client.local/',
'parent' => '@local',
);
$aliases['client-dev'] = array(
'uri' => 'client.dev.echoditto.com',
'root' => '/path/to/webroot/on/server',
'parent' => '@dev-server',
);
$aliases['client-live'] = array(
'uri' => 'client.live.echoditto.com',
'root' => '/path/to/webroot/on/server',
'parent' => '@live-server',
);
You can then rock out and run commands like
drush sql-sync @client-dev @client-localto effortlessly sync your local db to your dev server's.A further advantage of this setup is that you can copy all your alias files across all server you work on and need only change the information in the servers.alias.drushrc.php file from on server to the other, leaving everything else as is. Very cool.
Much like firebug, once you've got all this set up you wonder how you ever developed sites without it.
I'm told this avoids encoding issues:
drush sql-dump --result-file=/my/fileI always struggle to believe how drush just keeps getting better...