Drush command to add a new module dependency to a function

Is there a drush command to update a function when adding a new module dependency? I know that you can use the FU command to update changes to already added views, content types, etc., but I'm wondering how to add new views, content types, and module dependencies. So far, the only way to enable these changes in Feature is to reload it.

Fortunately, Git has made this process much easier than before with SVN.

+7
source share
3 answers

If you are comfortable editing your .info file, the format used to determine which components should be exported is pretty simple. For example:

features[node][] = "node_type" features[view][] = "view_name" features[variable][] = "variable_name" 

When you add any of them to your .info file and run drush fu , the resulting module will include the specified components if they have not been previously exported. Features will take care of adding any other bits and pieces that, in his opinion, should be there.

Module dependencies for functions work the same as module dependencies for any module in Drupal, just add dependencies[] = "module_name" to your .info file ..

This is the main way to update functions, and in a few more steps you can create and enable an empty module and "reinforce it" by adding component components to your .info file in this way.

A drush command can be created, such as drush features-add-component featurename --node=new_type , but I don't think there is a published command that does this. There are several drush scenarios with advanced function administration functions, scattered in turn problematic functions and several projects under development. The main advantage of such a command will be the command line version of the function interface, showing the property constructor, the components of which are available for export. This utility is somewhat limited if you are comfortable editing the .info file.

+8
source

The current way to do this in drush is "feature-export" or "fe". (add-functions are deprecated)

 drush fe my_existing_feature dependencies:my_new_dependency 

A few more tidbits:

A command can also be used to create a new function, in the same way, with a component. The only difference is that the function name does not yet exist as a function. For example, this will create a new function containing the node type:

 drush fe my_new_feature node:my_node_type 

Finally, it goes hand in hand with the features-components (fc) team. You can see a list of all non-exported components, for example:

 drush fc --not-exported 

As a shortcut, you can specify the type of components to search for:

 drush fc --not-exported field 

You can leave --not-exported to see exported components, but I find in practice that I want to see only not exported components. This allows me to go crazy in Drupal by creating stuff, and then after I finish, go to the command line and make sure that everything I created is exported to a function.

+5
source

Now you can do the same using the drush-add (drush fa) functions. "drush fa" will create a list of elements that you can add to your function. If you are familiar with editing the .info file or have ever looked at the names of machines in the function interface, you will recognize the names of these elements that can be decorated.

Example:

 drush fa feature_name dependencies:views views_view:user_questions 

This will add the Views module as a dependency and view of "user_questions" to "feature_name".

Warning: this command seems to have been added relatively recently; I needed to upgrade the features to 7.x-1.x-beta6 to get it. Unfortunately, it has not yet been ported to D6, but this, hopefully, will happen soon; see this question for progress and the patch that will give you "drush fa" on D6. There is also some discussion about team naming / functionality; stay tuned here to find out how this happens. I will try to update this post.

+3
source

All Articles