I've modified the drush function that handles the downloading of defined libraries so that they are actually downloaded. It is based on the drush functionality for downloading projects. The patch I've included contains all code to get it working. But aware that it only provides the base for getting the download functionality in the module. If there is anything I can do to help, let me know!

Comments

MKorostoff’s picture

Issue summary:View changes
Status:Active» Needs review
MKorostoff’s picture

StatusFileSize
new8.18 KB
PASSED: [[SimpleTest]]: [MySQL] 149 pass(es).
[ View ]
new651 bytes

Great patch! I had to make one small bug fix to get it working.

When I applied the patch, and ran it, I got this error:

$ drush libraries-download erta -v
Initialized Drupal 7.31 root directory at /Users/matt/Sites/vmt.local/docroot    [notice]
Initialized Drupal site default at sites/default    [notice]
Executing: mysql --defaults-extra-file=/private/tmp/drush_Pg4LDA --database=vmt --host=127.0.0.1 --port=3306 --silent  < /private/tmp/drush_XQU1mx
Using destination directory /Users/matt/Sites/vmt.local/docroot/sites/all/libraries  [notice]
Downloading library erta to /tmp/drush_tmp_1409240715_53ff4e8b9ac0f ...        [notice]
Executing: wget --version
Executing: wget -q --timeout=30 -O /private/tmp/download_fileTPnfOz https://github.com/samsono/Easy-Responsive-Tabs-to-Accordion/archive/master.zip
Downloading erta was successful.          [notice]
Mime type for /tmp/drush_tmp_1409240715_53ff4e8b9ac0f/master.zip is application/zip        [notice]
Executing: unzip /tmp/drush_tmp_1409240715_53ff4e8b9ac0f/master.zip -d /tmp/drush_tmp_1409240715_53ff4e8b9ac0f
Undefined offset: 0 libraries.drush.inc:127        [notice] <--------- **here's the bug**
Drush command terminated abnormally due to an unrecoverable error.        [error]
Error: Maximum function nesting level of '100' reached, aborting! in /usr/local/Cellar/drush/HEAD/libexec/includes/environment.inc, line 571

.

Basically, the problem was that drush_tarball_extract() returned an array whose first key was 1, not 0 (weird right?). I just threw in a $file_list = array_values($file_list); and it worked!

Thanks again :-)

BR0kEN’s picture

Assigned:Unassigned» BR0kEN
StatusFileSize
new10.52 KB
PASSED: [[SimpleTest]]: [MySQL] 149 pass(es).
[ View ]

Hi guys.

At first I've created a sandbox in which implemented the Drush command for downloading non-existent libraries. I did not publish a project and used the command by downloading it via Composer. Now, when I've upgrade it, think it's ready for the Libraries module.

Abilities and use cases:

  1. You can download all non-existent libraries by execution of one command. Use drush ld to do that.
  2. You able to download (or move them from sites/all/libraries if they are exist there) libraries to profiles/<PROFILE>/libraries. Use drush ld --profile to do that.
  3. You able to download libraries, specified in command line. Use drush ld twitteroauth parsedown to do that.
  4. You can see the help for this command by executing the drush help ld.
  5. You can combine command arguments and parameters as you want.
  6. Patch can be applied to 7.x-2.x and 7.x-3.x branches.

I hope for attention for this patch.

BR0kEN’s picture

StatusFileSize
new10.58 KB
PASSED: [[SimpleTest]]: [MySQL] 149 pass(es).
[ View ]
new1023 bytes

This patch differs from previous only by using human-readable names for libraries instead of machine names in dialog for re-downloading.