function _modernizr_drush_download_dev in Modernizr 8
Same name and namespace in other branches
- 7.3 drush/modernizr.drush.inc \_modernizr_drush_download_dev()
Helper function downloads the uncompressed development copy of Modernizr.
1 call to _modernizr_drush_download_dev()
- drush_modernizr_post_pm_enable in drush/
modernizr.drush.inc - Implements drush_MODULE_post_COMMAND().
1 string reference to '_modernizr_drush_download_dev'
- modernizr_drush_command in drush/
modernizr.drush.inc - Implementation of hook_drush_command().
File
- drush/
modernizr.drush.inc, line 72 - drush integration for modernizr.
Code
function _modernizr_drush_download_dev() {
$args = func_get_args();
$dir = '';
$drush_context = '';
// If the user supplied a destination, use that path
if ($args[0]) {
$dir = $args[0];
}
else {
$drush_context = drush_get_context('DRUSH_DRUPAL_ROOT');
// Can we use Libraries API?
if (module_exists('libraries') && function_exists('libraries_get_path')) {
$libraries_dir = libraries_get_path('modernizr');
}
// Load the path
$dir = $libraries_dir ? $drush_context . '/' . $libraries_dir : $drush_context . '/sites/all/libraries/modernizr';
}
// Build full path including filename
$path = _modernizr_scan_for_library(array(
$dir,
));
// If the directory exists and contains a recognized file, we're finished.
if (modernizr_get_path()) {
drush_log('Modernizr already present. No download required.', 'ok');
return;
}
else {
// The file was not present. Create the directory to hold it.
drush_mkdir($dir);
// Attempt to download the file and log the outcome.
if (drush_op('chdir', $dir) && drush_shell_exec('wget ' . MODERNIZR_DOWNLOAD_DEV)) {
drush_log(dt('The latest Modernizr dev library has been downloaded to @path', array(
'@path' => $dir,
)), 'success');
}
else {
drush_log(dt('Drush was unable to download Modernizr dev to @path', array(
'@path' => $dir,
)), 'error');
}
}
}