function respondjs_drush_respondjs_download in Respond.js 8
Same name and namespace in other branches
- 7 drush/respondjs.drush.inc \respondjs_drush_respondjs_download()
This is where the action takes place.
In this function, all of Drupals API is (usually) available, including any functions you have added in your own modules/themes.
To print something to the terminal window, use drush_print().
1 call to respondjs_drush_respondjs_download()
- drush_respondjs_post_pm_enable in drush/
respondjs.drush.inc - Implements drush_MODULE_post_COMMAND().
1 string reference to 'respondjs_drush_respondjs_download'
- respondjs_drush_command in drush/
respondjs.drush.inc - Implementation of hook_drush_command().
File
- drush/
respondjs.drush.inc, line 65 - drush integration for respondjs.
Code
function respondjs_drush_respondjs_download() {
$args = func_get_args();
if ($args[0]) {
$path = $args[0];
}
elseif (function_exists('libraries_get_path')) {
$path = libraries_get_path('respondjs');
}
else {
$path = drupal_get_path('module', 'respondjs') . '/lib';
}
// Create the path if it does not exist yet.
if (!is_dir($path)) {
drush_mkdir($path);
}
// Download the file and report back
if (is_file($path . '/respond.min.js')) {
drush_log('Respond.js already present. No download required.', 'ok');
}
elseif (drush_op('chdir', $path) && drush_shell_exec('wget --no-check-certificate https://raw.github.com/scottjehl/Respond/master/respond.min.js')) {
drush_log(dt('The latest respond.js library has been downloaded to @path', array(
'@path' => $path,
)), 'success');
}
else {
drush_log(dt('Drush was unable to download the respond.js library to @path', array(
'@path' => $path,
)), 'error');
}
}