Features-fetch (ff) is a simple drush command extension that simplifies deploying (rebuilt) Drupal Feature modules to a specific Drupal project.

Features are a collection of Drupal entities (like content types, views, contexts and imagecache presets) that taken together satisfy a certain use case. Developing a feature typically involves selecting the appropriate entities and downloading the custom feature module that the Features module generates.

You can modify a feature's entities (like add a display to a view) and update the feature module itself using the drush features-update command, but adding new components requires rebuilding and downloading the updated feature module. During the course of project development, you can end up rebuilding your feature modules quite a few times.

That is where features-fetch comes in. Instead performing the manual deployment steps over and over again, just run drush ff example_feature_module from within your Drupal project directory.

What it does:

  • Backs up any existing version of example_feature_module to DRUPALROOT/backups
  • Grabs the most recent example_feature_module.tar file from your downloads directory
  • unpacks it to your features destination directory

Current limitations:

  • uses machine wide config settings. Support for project specific settings is coming up
  • needs some code cleanup

Go ahead and grab it from the features-fetch github repo.

To save people a moment of

To save people a moment of downloading and then do it the git way after reading the installation file, while features_fetch lives on github (and after drupal.org moves to git!) the best way to add this drush extension is:


mkdir ~/.drush # if necessary
cd ~/.drush
git clone git://github.com/jpoesen/features-fetch.git

Then to get the latest updates of this project we can just:

git pull

Nice work! "adding new

Nice work!

"adding new components requires rebuilding and downloading the updated feature module"

Just a quick FYI -- you can add components to a feature without recreating it in the UI/redownloading it by adding components to your feature's .info file and running drush features-update. See the Add components to a feature section in API.txt.

And thanks for this. I was

And thanks for this. I was asking people about exporting features from the command line. This makes it configuration and then one click, which is as good as it can be. Is there a way it could magically know to pick the latest download (for instance, when the browser adds a (2) after it to prevent overwriting). Or to move or delete the file rather than just copying.

Also to everyone before starting, don't forget to set the download path in the .ini file, which is certain to be incorrect unless your username is "username". For instance mine on Ubuntu had to change from /Users/username/Downloads/ to /home/ben/Downloads.

@ Benjamin Melançon: Thanks

@ Benjamin Melançon:
Thanks for the git and .ini additions, Ben. I assumed people would consult the README.txt but I forgot about adding the git clone installation info.

Features-fetch does in fact grab the latest version it finds, so if you have an example_feature.tar and and example_feature (1).tar and so on, it'll grab the latter.

@yhahn:
Ah, didn't know about adding components through the .info file. Sweet!

@ Benjamin Melançon: re: the

@ Benjamin Melançon:
re: the option to move rather than untar it into the destination directory: I can add a general setting in the .ini file and a command line switch to override. Would that do?

re: That it finds the latest

re:

That it finds the latest is fantastic. An option to delete would be nice for people who like to clean up... I'm just happy that it works :-)

@ Benjamin Melançon: ff now

@ Benjamin Melançon:
ff now has a cleanup variable in the .ini file. Set it to 1 to perform cleanup. Command line switch to override on a case by case basis is coming.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p><em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><br><h2><h3><h4><h5><table><th><tr><td>
  • Lines and paragraphs break automatically.

More information about formatting options