It has been a standard practice since 2009 to put all exported features into the "sites/all/modules/features" directory rather than just "sites/all/modules", likewise distributions put their custom features into "profiles/[distro]/modules/features". As a result, the default location in Features v2 should be to generate the exported features in "sites/all/modules/features" rather than "sites/all/modules".

Solution that was implemented

One can now run e.g.
drush vset features_default_export_path "sites/all/modules/features"
to set the destination directory.

Or go to "admin/structure/features/settings", there is an option "Default export path" at the bottom in "General settings".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
5.12 KB

This changes the default destination used by both the Drush integration and the website UI to use "sites/all/modules/features" instead of "sites/all/modules".

DamienMcKenna’s picture

Status: Needs review » Needs work
DamienMcKenna’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, features-n1915462-1.patch, failed testing.

DamienMcKenna’s picture

Version: 7.x-2.0-beta1 » 7.x-2.x-dev
Status: Needs work » Needs review
FileSize
5.53 KB

I'm not sure what the errors had to do with it, but I caught another occurrence of "sites/all/modules".

DamienMcKenna’s picture

FileSize
5.12 KB

Rerolled.

hefox’s picture

Makes some sense, but how about a variable_get('features_default_export_path', FEATURES_DEFAULT_EXPORT_PATH);? There's a settings tab now where such settings can go.

DamienMcKenna’s picture

Status: Needs review » Needs work

Good idea. I'll try to work on an updated patch this week.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
8.15 KB

How about this? One difficulty is that the Drush integration displays the path, so I've made it show the default 'sites/all/modules/features' if the module is not enabled and once it's enabled it checks the variable.

Status: Needs review » Needs work

The last submitted patch, features-n1915462-9.patch, failed testing.

hefox’s picture

Status: Needs work » Needs review

#9: features-n1915462-9.patch queued for re-testing.

mpotter’s picture

Status: Needs review » Fixed

Committed to 1fbf522.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Les Lim’s picture

Title: Generated features should go in sites/all/modules/features by default » Default export directory should be configurable for generated features
Status: Closed (fixed) » Needs review
FileSize
7.95 KB

The patch in #6 was committed, but not the patch in #9 that makes the default export directory configurable.

Re-rolled #9 against 7.x-2.x-dev.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

This seems to work well. Sorry I missed #9 somehow!

mpotter’s picture

Status: Reviewed & tested by the community » Needs work

Hrm. hefox raised a good question with me. How can we use a default of "sites/all/modules/features" (as in the patch) when that is the directory that Drupal downloads the actual Features module itself?

The default in the patch works well on sites that put contrib modules into sites/all/modules/contrib, but that doesn't happen by default.

DamienMcKenna’s picture

How about changing the default depending on where the Features module is installed? For example, if features.module is in sites/all/modules/features then use e.g. "sites/all/modules/custom_features", otherwise use "sites/all/modules/features"?

Les Lim’s picture

What about just "sites/all/modules/custom"? That's where we prefer to put our features where I work, which is why we wanted the configurable default. Since we often add hooks and other custom code into our feature modules, there isn't really a brightline between a "custom" module and a "feature" module.

DamienMcKenna’s picture

@Les: I use three paths for modules:

  • sites/all/modules/contrib - anything downloaded from d.o.
  • sites/all/modules/features - anything generated by the Features module, regardless of any customizations that are added.
  • sites/all/modules/custom - any custom modules not generated by Features.
hefox’s picture

Something I noticed last night

If you aren't using contrib directory drush dl features is at sites/all/modules/features

sooo you go into features create and go to use this tool.. and make your feature under features module? XD!

hefox’s picture

I finally figured out where I was going with the above insight

if drupal_get_path('module', 'features') == 'sites/all/modules/features' default directory needs to be sites/all/modules or such

impleri’s picture

Can this just be made into a variable (that can be exported) and let people decide for themselves? Perhaps have it set by default to sites/all/modules/features, but since it's a variable, it can be changed at will.

mpotter’s picture

Status: Needs work » Fixed

Modified the default to be sites/all/modules. But the patch #14 implements this as a variable (as per #22) so it can be changed as needed and that was still a useful addition.

Committed to b1549d8.

Somebody else can submit a patch to a new issue to change the default based upon the path of the Features module as a new feature request.

DamienMcKenna’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

donquixote’s picture

Issue summary: View changes

This is one of the first results in google when looking how to set the destination directory. And I did not find much else.
So we should add something helpful to the issue summary.

I am adding a section "Solution that was implemented", based on what I found from a quick look into the patch.
Please consider this a stub, to be expanded upon.
And if there is a doc page elsewhere, add a link!

donquixote’s picture

Issue summary: View changes