You are here

function _modernizr_drush_custom_build in Modernizr 7.3

Same name and namespace in other branches
  1. 8 drush/modernizr.drush.inc \_modernizr_drush_custom_build()

Helper function that generates a list of Modernizr tests from other modules and sends them to the node.js CLI builder.

1 string reference to '_modernizr_drush_custom_build'
modernizr_drush_command in drush/modernizr.drush.inc
Implements hook_drush_command().

File

drush/modernizr.drush.inc, line 75
drush integration for modernizr.

Code

function _modernizr_drush_custom_build() {
  $output_args = array();
  $args = modernizr_api_list();
  $output = '';

  // Get the map of Modernizr args.
  include_once drupal_get_path('module', 'modernizr') . '/modernizr.args.inc';

  // Fetch all the tests, and record which modules supplied them.
  foreach ($args as $key => $test) {
    $meta = _modernizr_args_return($key);
    $type = $meta['type'];
    $output_args[$type][] = $key;
  }

  // Collapse tests into the format accepted by the node builder.
  $tests = isset($output_args['tests']) ? ' -t ' . implode(' ', $output_args['tests']) : '';
  $extras = isset($output_args['extras']) ? ' -e ' . implode(' ', $output_args['extras']) : '';
  $groups = isset($output_args['groups']) ? ' -g ' . implode(' ', $output_args['groups']) : '';
  $not = isset($output_args['not']) ? ' -n ' . implode(' ', $output_args['not']) : '';
  $output = $tests . $extras . $groups . $not;
  return $output;
}