? 542940-libraries_drush-13.patch
? 864376-libraries-external-20.patch
? 919632-libraries-info-file-10.patch
? 919632-libraries_info_files-14.patch
? 919632-libraries_info_files-19.patch
? 919632-libraries_info_files-23.patch
? info_file.patch
? libraries_drush_list.patch
? review-me.patch
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 02:19:22 -0000
@@ -126,7 +126,7 @@ function libraries_get_libraries() {
  *   An array of info files, keyed by library name. The values are the paths of
  *   the files.
  */
-function libraries_info_files() {
+function libraries_scan_info_files() {
   global $profile;
   if (!isset($profile)) {
     $profile = variable_get('install_profile', 'default');
@@ -143,18 +143,17 @@ function libraries_info_files() {
   // Scan for info files.
   $files = array();
   foreach ($directories as $dir) {
-    $files += file_scan_directory($dir, '/[a-z[a-z0-9_]+.info/', array(
-      'key' => 'name',
-      'recurse' => FALSE,
-    ));
-  }
-
-  foreach ($files as &$file) {
-    $file = $file->uri;
+    if (file_exists($dir)) {
+      $files = array_merge($files, file_scan_directory($dir, '@^[\.a-z0-9_-]+\.info$@', array(
+        'key' => 'name',
+        'recurse' => FALSE,
+      )));
+    }
   }
 
   return $files;
 }
+
 /**
  * Returns information about registered libraries.
  *
@@ -178,23 +177,27 @@ function libraries_info($library = NULL)
   $libraries = &drupal_static(__FUNCTION__);
 
   if (!isset($libraries)) {
-    $libraries = array();
+    // Gather information from hook_libraries_info().
     foreach (module_implements('libraries_info') as $module) {
       foreach (module_invoke($module, 'libraries_info') as $name => $properties) {
         $properties['module'] = $module;
-        $properties['name'] = $name;
         $libraries[$name] = $properties;
       }
     }
+
     // Gather information from .info files.
-    foreach (libraries_info_files() as $name => $path) {
-      $file = "$path/$name.info";
-      $libraries[$name] = drupal_parse_info_file($file);
+    // .info files override module definitions.
+    foreach (libraries_scan_info_files() as $name => $file) {
+      $filepath = DRUPAL_ROOT . '/' . $file->uri;
+      $properties = drupal_parse_info_file($filepath);
+      $properties['info file'] = $filepath;
+      $libraries[$name] = $properties;
     }
-
+debug($libraries['example_info_file']);
     // Provide defaults.
     foreach ($libraries as $name => &$properties) {
       $properties += array(
+        'name' => $name,
         'title' => $name,
         'vendor url' => '',
         'download url' => '',
Index: tests/libraries.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/libraries/tests/libraries.test,v
retrieving revision 1.5
diff -u -p -r1.5 libraries.test
--- tests/libraries.test	9 Oct 2010 22:26:03 -0000	1.5
+++ tests/libraries.test	10 Oct 2010 02:19:22 -0000
@@ -27,9 +27,10 @@ class LibrariesTestCase extends DrupalWe
    */
   public function testLibraries() {
     // Test a library specified with an .info file gets detected.
-    $library = libraries_info('example');
+    $library = libraries_info('example_info_file');
     $expected = array(
-      'title' => 'example',
+      'name' => 'example_info_file',
+      'title' => 'Example info file',
       'vendor url' => '',
       'download url' => '',
       'path' => '',
@@ -39,6 +40,7 @@ class LibrariesTestCase extends DrupalWe
       'variants' => array(),
       'versions' => array(),
       'integration files' => array(),
+      'info file' => DRUPAL_ROOT . '/' . drupal_get_path('module', 'libraries_test') . '/example/example_info_file.info',
     );
     $this->assertEqual($library, $expected, 'Library specified with an .info file found');
 
Index: tests/example/example_info_file.info
===================================================================
RCS file: tests/example/example_info_file.info
diff -N tests/example/example_info_file.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/example/example_info_file.info	10 Oct 2010 02:19:22 -0000
@@ -0,0 +1,5 @@
+; $Id: example.info,v 1.1 2010/10/09 22:26:03 tstoeckler Exp $
+title = Example info file
+
+; This is an example info file for a library used for testing purposes.
+
