? 542940-libraries_drush-13.patch ? 542940-libraries_drush-17.patch ? 542940-libraries_drush-18.patch ? 542940-libraries_drush-20.patch ? 542940-libraries_drush-21.patch ? 919632-libraries_info_files-23.patch ? info_file.patch ? libraries_drush_list.patch ? review-me.patch Index: libraries.drush.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/libraries/libraries.drush.inc,v retrieving revision 1.1 diff -u -p -r1.1 libraries.drush.inc --- libraries.drush.inc 19 Aug 2010 00:06:41 -0000 1.1 +++ libraries.drush.inc 10 Oct 2010 03:22:47 -0000 @@ -10,18 +10,18 @@ * Implements hook_drush_command(). */ function libraries_drush_command() { - return; $items['libraries-list'] = array( 'callback' => 'libraries_drush_list', 'description' => dt('Lists registered library information.'), + 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, ); - $items['libraries-download'] = array( + /**$items['libraries-download'] = array( 'callback' => 'libraries_drush_download', 'description' => dt('Downloads a registered library into the libraries directory for the active site.'), 'arguments' => array( 'name' => dt('The internal name of the registered library.'), ), - ); + );*/ return $items; } @@ -41,6 +41,54 @@ See libraries-list for a list of registe } /** + * Lists registered library information. + */ +function libraries_drush_list() { + $libraries = libraries_detect(libraries_info()); + ksort($libraries); + + if (empty($libraries)) { + drush_print('There are no registered libraries.'); + } + + else { + $header = array('Name', 'Status', 'Version', 'Variants'); + $rows = array(); + foreach ($libraries as $library_name => $library) { + $version = $library['version']; + if ($library['installed']) { + $status = 'OK'; + } + else { + $status = drupal_ucfirst($library['error']); + $version = (empty($library['version']) ? '-' : $library['version']); + } + if (empty($library['variants'])) { + $variants = '-'; + } + else { + $variants = array(); + foreach ($library['variants'] as $variant_name => $variant) { + if ($variant['installed']) { + $variants[] = $variant_name; + } + } + if (empty($variants)) { + $variants = '-'; + } + else { + $variants = implode(', ', $variants); + } + } + + $rows[] = array($library_name, $status, $version, $variants); + } + $table = new Console_Table(); + drush_print($table->fromArray($header, $rows)); + } +} + +/** * Downloads a library. * * @param $name Index: libraries.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/libraries/libraries.module,v retrieving revision 1.7 diff -u -p -r1.7 libraries.module --- libraries.module 9 Oct 2010 22:26:03 -0000 1.7 +++ libraries.module 10 Oct 2010 03:22:47 -0000 @@ -260,7 +260,8 @@ function libraries_detect_library(&$libr $library['library path'] = libraries_get_path($name); } if (!file_exists($library['library path'])) { - $library['error'] = t('%library could not be found.', array('%library' => $library['title'])); + $library['error'] = 'not found'; + $library['error message'] = t('%library could not be found.', array('%library' => $library['title'])); return; } @@ -275,7 +276,8 @@ function libraries_detect_library(&$libr $library['version'] = $library['version callback']($library, $library['version arguments']); } if (empty($library['version'])) { - $library['error'] = t('The version of %library could not be detected.', array('%library' => $library['title'])); + $library['error'] = 'not detected'; + $library['error message'] = t('The version of %library could not be detected.', array('%library' => $library['title'])); return; } @@ -289,7 +291,8 @@ function libraries_detect_library(&$libr } } if (!$version) { - $library['error'] = t('The installed version %version of %library is not supported.', array( + $library['error'] = 'not supported'; + $library['error message'] = t('The installed version %version of %library is not supported.', array( '%version' => $library['version'], '%library' => $library['title'], )); @@ -318,7 +321,8 @@ function libraries_detect_library(&$libr $variant['installed'] = $variant['variant callback']($library, $name, $variant['variant arguments']); } if (empty($variant['installed'])) { - $variant['error'] = t('The %variant variant of %library could not be found.', array( + $variant['error'] = 'not found'; + $variant['error message'] = t('The %variant variant of %library could not be found.', array( '%variant' => $name, '%library' => $library['title'], )); Index: tests/libraries_test.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/libraries/tests/libraries_test.module,v retrieving revision 1.4 diff -u -p -r1.4 libraries_test.module --- tests/libraries_test.module 9 Oct 2010 22:26:03 -0000 1.4 +++ tests/libraries_test.module 10 Oct 2010 03:22:48 -0000 @@ -188,21 +188,6 @@ function libraries_test_libraries_info() 'variant callback' => '_libraries_test_return_installed', 'variant arguments' => array(TRUE), ), - 'example_variant_2' => array( - 'files' => array( - 'js' => array( - 'example_4.js', - ), - 'css' => array( - 'example_4.css', - ), - 'php' => array( - 'example_4.php', - ), - ), - 'variant callback' => '_libraries_test_return_installed', - 'variant arguments' => array(TRUE), - ), ), );