function drush_baguettebox_download in baguetteBox.js 7
Command to download the BaguetteBox library.
File
- ./
baguettebox.drush.inc, line 29 - Drush integration for BaguetteBox module.
Code
function drush_baguettebox_download() {
$libraries_dir = 'sites/all/libraries';
if (!is_dir($libraries_dir)) {
return drush_set_error('BAGUETTEBOX', dt('Directory !libraries_dir does not exist.', array(
'!libraries_dir' => $libraries_dir,
)));
}
if (is_dir(BAGUETTEBOX_LIBRARY_DIR)) {
if (drush_confirm(dt('Install location !dir already exists. Do you want to overwrite it?', array(
'!dir' => BAGUETTEBOX_LIBRARY_DIR,
)))) {
drush_delete_dir(BAGUETTEBOX_LIBRARY_DIR, TRUE);
}
else {
return drush_log(dt('Aborting.'));
}
}
drush_mkdir(BAGUETTEBOX_LIBRARY_DIR);
drush_shell_exec('wget --timeout=15 -O %s %s', BAGUETTEBOX_LIBRARY_DIR . '/baguetteBox.min.js', BAGUETTEBOX_DOWNLOAD_JS_URL);
drush_shell_exec('wget --timeout=15 -O %s %s', BAGUETTEBOX_LIBRARY_DIR . '/baguetteBox.min.css', BAGUETTEBOX_DOWNLOAD_CSS_URL);
$js_file_found = drush_file_not_empty(BAGUETTEBOX_LIBRARY_DIR . '/baguetteBox.min.js');
$css_file_found = drush_file_not_empty(BAGUETTEBOX_LIBRARY_DIR . '/baguetteBox.min.css');
if (!$js_file_found || !$css_file_found) {
return drush_set_error('BAGUETTEBOX', dt('Could not download baguetteBox library from GitHub.'));
}
else {
drush_log(dt('BaguetteBox library has been installed in @path', array(
'@path' => BAGUETTEBOX_LIBRARY_DIR,
)), 'success');
}
}