diff -u b/libraries.drush.inc b/libraries.drush.inc --- b/libraries.drush.inc +++ b/libraries.drush.inc @@ -11,21 +11,22 @@ $commands = array(); $commands['libraries-list'] = array( - 'description' => dt('Lists registered library information.'), + 'description' => dt('List of registered libraries.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, 'aliases' => array('libl', 'liblist'), ); $commands['libraries-download'] = array( - 'description' => dt('Download all non-existent libraries from "hook_libraries_info()". You able to specify necessary libraries separating their names by spaces or download all non-existent libraries.'), + 'description' => dt('Download registered libraries.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, 'aliases' => array('libd', 'libget'), 'options' => array( - 'profile' => dt('Specify this empty option if you want to download libraries into profile installation folder. In this case the "--uri" parameter will be ignored.'), - 'all' => dt('Download all defined, non-existent libraries.'), + 'profile' => dt('Download to folder of current Drupal profile. In this case the "--uri (-l)" parameter will be ignored.'), + 'all' => dt('Download all defined, non-existent libraries. All specified arguments (library names) will be ignored.'), ), 'examples' => array( - 'drush ld [--uri|-l ]' => dt('Download defined libraries.'), + 'drush libget ' => dt('Multiple arguments are allowed.'), + 'drush libget -l site.com -r /var/drupal' => dt('Drush arguments are allowed.'), ), ); @@ -73,6 +74,7 @@ $rows[] = array( dt('Name'), dt('Status'), + dt('Module'), dt('Version'), dt('Variants'), dt('Dependencies'), @@ -91,6 +93,7 @@ $rows[] = array( $name, $library['installed'] ? dt('OK') : drupal_ucfirst($library['error']), + $library['module'], $library['installed'] || empty($library['version']) ? '-' : $library['version'], empty($variants) ? '-' : implode(', ', $variants), empty($library['dependencies']) ? '-' : implode(', ', $library['dependencies']), @@ -99,7 +102,7 @@ // Make the possible values for the 'Status' column and the 'Version' header // wrap nicely. - drush_print_table($rows, TRUE, array(0, 12, 7, 0, 0)); + drush_print_table($rows, TRUE); } } @@ -118,29 +121,31 @@ } else { $path = sprintf('%s/%s/libraries', drush_locate_root(), _drush_libraries_download_path()); - $libraries = libraries_get_libraries(); - $downloaded = _drush_libraries_download($path, $libraries, $info); - if (!empty($downloaded) && drush_confirm(dt('The next libraries were already downloaded: "!libs". Do you want re-download them? Old data will be erased!', array('!libs' => implode('", "', $downloaded))))) { - // Reset an array with items for downloading. - $download = array(); - - // Set affirmative context to "TRUE", because a user gave his consent - // for re-downloading. - drush_set_context('DRUSH_AFFIRMATIVE', TRUE); - - foreach ($downloaded as $machine_name => $name) { - if (drush_delete_dir($libraries[$machine_name], TRUE)) { - // Allow to re-download successfully deleted libraries only. - $download[$machine_name] = $info[$machine_name]; - } - else { - drush_log(dt('Cannot remove the "@dir" directory.', array('@dir' => $libraries[$machine_name])), 'error'); + // Create empty directory if not exist. + if (drush_mkdir($path, TRUE)) { + $libraries = libraries_get_libraries(); + $downloaded = _drush_libraries_download($path, $info, $libraries); + + if (!empty($downloaded) && drush_confirm(dt('The next libraries were already downloaded: "!libs". Do you want re-download them? Old data will be erased!', array('!libs' => implode('", "', $downloaded))))) { + // Reset an array with items for downloading. + $download = array(); + + // Set affirmative context to "TRUE", because a user gave his consent + // for re-downloading. + drush_set_context('DRUSH_AFFIRMATIVE', TRUE); + + foreach ($downloaded as $machine_name => $name) { + if (drush_delete_dir($libraries[$machine_name], TRUE)) { + // Allow to re-download successfully deleted libraries only. + $download[$machine_name] = $info[$machine_name]; + } + else { + drush_log(dt('Cannot remove the "@dir" directory.', array('@dir' => $libraries[$machine_name])), 'error'); + } } - } - if (!empty($download)) { - _drush_libraries_download($path, array(), $download); + _drush_libraries_download($path, $download); } } } @@ -153,16 +158,16 @@ * * @param string $path * Destination path. - * @param array $existing - * An empty or returned by {@link libraries_get_libraries()} array. * @param array $download * Structured array from {@link libraries_info()} function. + * @param array $existing + * An empty or returned by {@link libraries_get_libraries()} array. * * @return array * An empty array if nothing has been downloaded or filled by names of * downloaded libraries. */ -function _drush_libraries_download($path, array $existing, array $download) { +function _drush_libraries_download($path, array $download, array $existing = array()) { $downloaded = array(); foreach ($download as $name => $library) { @@ -222,6 +227,8 @@ /** * Determine downloading destination. * + * @internal + * * @return string * Relative path for downloading. */