Commit 2eb30967 authored by Matt Glaman's avatar Matt Glaman

Issue #2122045 - Move to Features 2.x

parent daef48dd
......@@ -60,6 +60,8 @@ install:
- cd drupal
- drush make --yes profiles/commerce_kickstart/drupal-org-core.make --prepare-install
- drush make --yes profiles/commerce_kickstart/drupal-org.make --no-core --contrib-destination=profiles/commerce_kickstart
# Download Diff module for checking overridden features through Drush.
- drush dl diff
- cd ../
# Verify that all the .make files will work on Drupal.org.
......@@ -94,7 +96,7 @@ before_script:
- cd ../drupal
# If we're an upgrade test, run the upgrade process.
- if [[ "$UPGRADE" != none ]]; then cp -a ../commerce_kickstart-$UPGRADE/sites/default/* sites/default/ && drush updb --yes; fi
- if [[ "$UPGRADE" != none ]]; then cp -a ../commerce_kickstart-$UPGRADE/sites/default/* sites/default/ && drush updb --yes; drush cc all; fi
# Start server
- drush runserver --server=builtin 8888 > /dev/null 2>&1 &
......@@ -103,6 +105,10 @@ before_script:
script:
# If this isn't an upgrade, we test if any features are overridden.
- if [[ "$UPGRADE" == none ]]; then ../../scripts/check-overridden.sh; fi
# Run Behat tests.
- ./bin/behat --config behat.travis.yml
notifications:
......
......@@ -298,6 +298,9 @@ function commerce_kickstart_configure_store_form_submit(&$form, &$form_state) {
variable_set('commerce_kickstart_choose_tax_country', $form_state['values']['commerce_kickstart_choose_tax_country']);
variable_set('commerce_default_currency', $form_state['values']['commerce_default_currency']);
variable_set('commerce_enabled_currencies', array($form_state['values']['commerce_default_currency'] => $form_state['values']['commerce_default_currency']));
// Kickstart features rebuild themselves in their hook_enable() hooks, disable
// features_modules_enabled() until the end of install.
variable_set('features_rebuild_on_module_install', FALSE);
}
/**
......@@ -483,6 +486,33 @@ function commerce_kickstart_install_finished(&$install_state) {
variable_set('install_profile', drupal_get_profile());
variable_set('install_task', 'done');
// Restore features behavior.
variable_set('features_rebuild_on_module_install', TRUE);
// There is an issue with Features and menu_links when profile installed
// through Drush. We need to revert the menu_links and autosku patterns.
if (drupal_is_cli()) {
$feature_install_fix = array(
// Fix AutoSKU
'commerce_kickstart_product' => array('commerce_autosku_patterns'),
// Fences has issues in Features
'commerce_kickstart_blog' => array('field_instance'),
);
features_revert($feature_install_fix);
// Fix Menu Links
$features_menu_link_fix = array(
'commerce_kickstart_block',
'commerce_kickstart_social',
'commerce_kickstart_user',
);
foreach ($features_menu_link_fix as $module) {
if ($menu_links = features_get_default('menu_links', $module)) {
menu_links_features_rebuild_ordered($menu_links, TRUE);
}
}
}
// Flush all caches to ensure that any full bootstraps during the installer
// do not leave stale cached data, and that any content types or other items
// registered by the install profile are registered correctly.
......@@ -688,6 +718,37 @@ function commerce_kickstart_install() {
// Check DFP User Agreement.
variable_set('commerce_kickstart_dfp_eula', TRUE);
// Creating needed fields
$field_image = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_image',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'image',
'settings' => array(
'default_image' => 0,
'uri_scheme' => 'public',
),
'translatable' => 1,
'type' => 'image',
);
field_create_field($field_image);
}
/**
......
......@@ -261,3 +261,31 @@ function commerce_kickstart_crumbs_get_info() {
return $crumbs;
}
/**
* Rebuilds a feature using the same logic as features_modules_enabled().
*
* Called from the hook_enable() of every Kickstart feature.
*
* features_modules_enabled() runs too late, so when a feature's hook_enable()
* or hook_install() runs, the feature hasn't been rebuild yet, no exported
* structures exist in the system and can't be modified.
* It also rebuilds all features at once, which makes it prone to timeouts.
* This is why Kickstart disables features_modules_enabled() and rebuilds
* each feature manually in its hook_enable() hook.
*/
function commerce_kickstart_rebuild_feature($module) {
$feature = features_load_feature($module, TRUE);
$items[$module] = array_keys($feature->info['features']);
// Need to include any new files.
features_include_defaults(NULL, TRUE);
_features_restore('enable', $items);
// Rebuild the list of features includes.
features_include(TRUE);
// Reorders components to match hook order and removes non-existant.
$all_components = array_keys(features_get_components());
foreach ($items as $module => $components) {
$items[$module] = array_intersect($all_components, $components);
}
_features_restore('rebuild', $items);
}
......@@ -19,12 +19,11 @@ projects[views_bulk_operations][version] = 3.2
projects[views_bulk_operations][subdir] = "contrib"
projects[addressfield][version] = 1.1
projects[addressfield][subdir] = "contrib"
projects[features][version] = 1.0
projects[features][patch][] = "http://drupal.org/files/1572578-part-one.patch"
projects[features][patch][] = "http://drupal.org/files/1597186-1-features-do-not-cache-includes.patch"
projects[features][patch][] = "http://drupal.org/files/927566-multiple-link_path.patch"
projects[features][patch][] = "http://drupal.org/files/1669720-fix-features-flush-cache.patch"
projects[features][patch][] = "http://drupal.org/files/1588596-11-features-array_diff_assoc_recursive.patch"
projects[features][version] = "2.5"
projects[features][subdir] = "contrib"
projects[features][patch][1572578] = "http://drupal.org/files/issues/1572578-27-allow-rebuild-to-be-disabled.patch"
projects[features][patch][2143765] = "http://drupal.org/files/issues/features-fix-modules-enabled-2143765-1.patch"
projects[features][patch][2479803] = "https://www.drupal.org/files/issues/ignore_hidden_modules-2479803-1.patch"
projects[features][subdir] = "contrib"
projects[strongarm][version] = 2.0
projects[strongarm][subdir] = "contrib"
......@@ -58,6 +57,7 @@ projects[commerce_migrate][version] = 1.1
projects[commerce_migrate][subdir] = "contrib"
projects[commerce_discount][version] = 1.0-alpha4
projects[commerce_discount][subdir] = "contrib"
projects[commerce_discount][patch][2480191] = "https://www.drupal.org/files/issues/discount_date_views-2480191-1.patch"
projects[commerce_checkout_progress][version] = 1.3
projects[commerce_checkout_progress][subdir] = "contrib"
projects[commerce_extra_price_formatters][version] = 1.x-dev
......
......@@ -7,8 +7,7 @@
/**
* Implements hook_ctools_plugin_api().
*/
function commerce_kickstart_block_ctools_plugin_api() {
list($module, $api) = func_get_args();
function commerce_kickstart_block_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
......
......@@ -21,11 +21,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_about-us:node/2',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => -50,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_company-info:<nolink>',
);
// Exported menu link: menu-footer-navigation_company-info:<nolink>
......@@ -41,11 +42,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'toolbar_break' => 0,
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '1',
'weight' => '-50',
'hidden' => 0,
'external' => 0,
'has_children' => 1,
'expanded' => 1,
'weight' => -50,
'customized' => 1,
);
// Exported menu link: menu-footer-navigation_our-security-policy:node/8
$menu_links['menu-footer-navigation_our-security-policy:node/8'] = array(
......@@ -60,11 +62,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_our-security-policy:node/8',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-49',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => -49,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_security--privacy:<nolink>',
);
// Exported menu link: menu-footer-navigation_press-links:node/6
......@@ -78,11 +81,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_press-links:node/6',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-49',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => -49,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_company-info:<nolink>',
);
// Exported menu link: menu-footer-navigation_security--privacy:<nolink>
......@@ -98,11 +102,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'toolbar_break' => 0,
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '1',
'weight' => '-48',
'hidden' => 0,
'external' => 0,
'has_children' => 1,
'expanded' => 1,
'weight' => -48,
'customized' => 1,
);
// Exported menu link: menu-footer-navigation_service--support:<nolink>
$menu_links['menu-footer-navigation_service--support:<nolink>'] = array(
......@@ -117,11 +122,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'toolbar_break' => 0,
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '1',
'weight' => '-49',
'hidden' => 0,
'external' => 0,
'has_children' => 1,
'expanded' => 1,
'weight' => -49,
'customized' => 1,
);
// Exported menu link: menu-footer-navigation_service-agreements:node/7
$menu_links['menu-footer-navigation_service-agreements:node/7'] = array(
......@@ -136,11 +142,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_service-agreements:node/7',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => -50,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_service--support:<nolink>',
);
// Exported menu link: menu-footer-navigation_shipping--returns:<nolink>
......@@ -156,11 +163,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'toolbar_break' => 0,
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '1',
'weight' => '-47',
'hidden' => 0,
'external' => 0,
'has_children' => 1,
'expanded' => 1,
'weight' => -47,
'customized' => 1,
);
// Exported menu link: menu-footer-navigation_shipping-fees:node/5
$menu_links['menu-footer-navigation_shipping-fees:node/5'] = array(
......@@ -175,11 +183,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_shipping-fees:node/5',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '1',
'expanded' => '0',
'weight' => '-50',
'hidden' => 0,
'external' => 0,
'has_children' => 1,
'expanded' => 0,
'weight' => -50,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_shipping--returns:<nolink>',
);
// Exported menu link: menu-footer-navigation_terms-of-use:node/3
......@@ -193,11 +202,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-footer-navigation_terms-of-use:node/3',
),
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => -50,
'customized' => 1,
'parent_identifier' => 'menu-footer-navigation_security--privacy:<nolink>',
);
// Exported menu link: menu-payment-methods_american-express:<front>
......@@ -217,11 +227,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-payment-methods_american-express:<front>',
),
'module' => 'menu',
'hidden' => '0',
'external' => '1',
'has_children' => '0',
'expanded' => '0',
'weight' => '-47',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => -47,
'customized' => 1,
);
// Exported menu link: menu-payment-methods_mastercard:<front>
$menu_links['menu-payment-methods_mastercard:<front>'] = array(
......@@ -240,11 +251,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-payment-methods_mastercard:<front>',
),
'module' => 'menu',
'hidden' => '0',
'external' => '1',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => -50,
'customized' => 1,
);
// Exported menu link: menu-payment-methods_paypal:<front>
$menu_links['menu-payment-methods_paypal:<front>'] = array(
......@@ -263,11 +275,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-payment-methods_paypal:<front>',
),
'module' => 'menu',
'hidden' => '0',
'external' => '1',
'has_children' => '0',
'expanded' => '0',
'weight' => '-49',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => -49,
'customized' => 1,
);
// Exported menu link: menu-payment-methods_visa:<front>
$menu_links['menu-payment-methods_visa:<front>'] = array(
......@@ -286,11 +299,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'menu-payment-methods_visa:<front>',
),
'module' => 'menu',
'hidden' => '0',
'external' => '1',
'has_children' => '0',
'expanded' => '0',
'weight' => '-48',
'hidden' => 0,
'external' => 1,
'has_children' => 0,
'expanded' => 0,
'weight' => -48,
'customized' => 1,
);
// Exported menu link: secondary-navigation_about:node/2
$menu_links['secondary-navigation_about:node/2'] = array(
......@@ -302,11 +316,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'secondary-navigation_about:node/2',
),
'module' => 'system',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '2',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => 2,
'customized' => 1,
);
// Exported menu link: secondary-navigation_contact:node/1
$menu_links['secondary-navigation_contact:node/1'] = array(
......@@ -318,11 +333,12 @@ function commerce_kickstart_block_menu_default_menu_links() {
'identifier' => 'secondary-navigation_contact:node/1',
),
'module' => 'system',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '1',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => 1,
'customized' => 1,
);
// Translatables
// Included for use with string extractors like potx.
......
......@@ -2,7 +2,6 @@ name = Commerce Kickstart Block
description = Provides blocks and menus.
core = 7.x
package = Commerce Kickstart
php = 5.2.4
dependencies[] = block
dependencies[] = ctools
dependencies[] = features
......@@ -10,7 +9,7 @@ dependencies[] = menu
dependencies[] = special_menu_items
dependencies[] = strongarm
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:1
features[features_api][] = api:2
features[menu_custom][] = menu-footer-navigation
features[menu_custom][] = menu-payment-methods
features[menu_custom][] = secondary-navigation
......
......@@ -8,19 +8,7 @@
* Implements hook_enable().
*/
function commerce_kickstart_block_enable() {
// Rebuild the features static caches.
features_include(TRUE);
$module = 'commerce_kickstart_block';
$feature = feature_load($module);
$items[$module] = array_keys($feature->info['features']);
_features_restore('enable', $items);
_features_restore('rebuild', $items);
// For some unknown reason, we need to manually trigger the rebuild of the
// menu links, in features otherwise they won't appear.
// @todo Investigate.
features_revert(array($module => array('menu_links')));
commerce_kickstart_rebuild_feature('commerce_kickstart_block');
$default_theme = variable_get('theme_default', 'omega_kickstart');
// Make sure that the region list is populated for our theme.
......
<?php
/**
* @file
* commerce_kickstart_blog.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commerce_kickstart_blog_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_blog_category'
$field_bases['field_blog_category'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_blog_category',
'indexes' => array(
'tid' => array(
0 => 'tid',
),
),
'locked' => 0,
'module' => 'taxonomy',
'settings' => array(
'allowed_values' => array(
0 => array(
'vocabulary' => 'blog_category',
'parent' => 0,
),
),
),
'translatable' => 0,
'type' => 'taxonomy_term_reference',
);
// Exported field_base: 'field_tags'
$field_bases['field_tags'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_tags',
'indexes' => array(
'tid' => array(
0 => 'tid',
),
),
'locked' => 0,
'module' => 'taxonomy',
'settings' => array(
'allowed_values' => array(
0 => array(
'vocabulary' => 'tags',
'parent' => 0,
),
),
),
'translatable' => 0,
'type' => 'taxonomy_term_reference',
);
return $field_bases;
}
<?php
/**
* @file
* commerce_kickstart_blog.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function commerce_kickstart_blog_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'node-blog_post-body'
$field_instances['node-blog_post-body'] = array(
'bundle' => 'blog_post',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 1,
),
'product_in_cart' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'product_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(
'trim_length' => 600,
),
'type' => 'text_summary_or_trimmed',
'weight' => 1,
),
),
'entity_type' => 'node',
'fences_wrapper' => '',
'field_name' => 'body',
'label' => 'Description',
'required' => 0,
'settings' => array(
'display_summary' => 1,
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'rows' => 20,
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
'weight' => 1,
),
);
// Exported field_instance: 'node-blog_post-field_blog_category'
$field_instances['node-blog_post-field_blog_category'] = array(
'bundle' => 'blog_post',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'inline',
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => 2,
),
'product_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'inline',
'module' => 'taxonomy',
'settings' => array(),
'type' => 'taxonomy_term_reference_link',
'weight' => 2,