Update: This script has been improved here.
While developing a new Drupal site, one tends to install lots of modules to shape his site into something specific. The problem is, doing so through a GUI takes much more time than I care to spend.
- Click the "download" link on a drupal module page
- Open the folder where my download was sent
- Open your "modules" folder on my drupal site's local copy
- Extract the files from the .tar.gz bundle
- Delete the .tar.gz download file because I'm done with it
- Drag and drop my files into my module directory
- Open an FTP client
- Upload the new files in my module directory to my site's server.
For every module I install, that's about 90 seconds of boring work that requires my undivided attention. YUCK.
There's a much better way. Logged into my shell on the server, I wrote a relatively simple function in my .bashrc file.
function getmod {
if [ -z "$1" ]
then
echo "Error: specify a URL."
return
fi
FILE="wget.tar.gz"
cd ~/html/sites/all/modules/
wget $1 -O $FILE
tar -xvf $FILE
rm $FILE
return
}
In a nutshell, this downloads and installs a module directly onto the server in one easy step on my part. As soon as I find a module I want on drupal.org, I right-click the "download" link and copy the file's address. Then, in my bash shell, all I have to do is type
getmod [paste URL of .tar.gz file]
and it's done. The real benefit isn't so much the 60 seconds of time it saves; it's the automation that lets me stay focused on the big picture without having to mentally switch gears to do back-end work. It just makes the whole design process a little bit less stressful.