Posted by Dave Reid on January 4, 2010 at 3:34am
14 followers
| Project: | jQuery UI |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Dave Reid |
| Status: | needs work |
Issue Summary
We should make it easy for people to download libraries!
Comments
#1
Patch with a 'jqueryui download' command and also runs that command whenever someone calls drush enable jquery_ui.
#2
Looks proper to me. Nice work.
#3
Haha, nice.
#4
Thanks for this. I just ran it with the HEAD of Drush and got this error:
Notice: "jqueryui download" must be renamed to "jqueryui-download" in[error]
order to work with this version of drush. If you are the maintainer
for the module that defines this command, please rename it
immediately. If you are a user of this command, you may enable
spaces in commands for a while by setting "allow-spaces-in-commands"
in your drush configuration file. See example.drushrc.php.
It's a one character fix. After doing that it downloads, but to sites/all/libraries. The JQuery UI module won't find it there until #489140: Libraries API is resolved. For now I just moved it under /sites/all/modules/jquery_ui/ per the README.
#5
Here is a updated patch for it. This fixes the drush-3 problems described above
#6
Subscribing.
#7
Just a small correction on #5, gets rid of "WD php: Undefined offset: 0 in /var/www/d6/sites/all/modules/jquery_ui/jquery_ui.drush.inc on line 22." error.
#8
Sorry, same patch, just named it properly
#9
Works as expected. one can stipulate download destination with an argument. Setting this to Reviewed and tested.
#10
Hi,
Would it be possible to choose version 1.7.3 ?
#11
Yeah +1 for making the version configurable.
#12
Taking a hint from #608282: Tell users to delete 'demos' directory in readme we should probably delete the demos folder for them.
#13
Updated patch adds documentation for the drush command to README.txt and allows version configurable downloads of Jquery ui.
I have ignored the request to delete the download folder, as a line in README.txt is more than sufficient. I dont believe the demo's folder should be removed unless the user wants to.
I added my thoughts to #608282: Tell users to delete 'demos' directory in readme
#14
#15
Nice.
Because I couldn't pm-enable it until the library was available, and because jquery_ui.drush wouldn't (seem to) be available until the module was enabled, I had to add a --include path to make it work.
$ drush dl jquery_ui
Project jquery_ui (6.x-1.4) downloaded to /Library/WebServer/Documents/drupal6-test/sites/all/modules/jquery_ui. [success]
Project jquery_ui contains 1 modules: jquery_ui.
$ pushd ../all/modules/
$ wget http://drupal.org/files/issues/jquery-ui-drush-dl-673492-13_1.patch
$ cd jquery_ui
$ patch < ../jquery-ui-drush-dl-673492-13_1.patch
patching file README.txt
patching file jquery_ui.drush.inc
dan@gregn:jquery_ui $ popd
$ drush --include=../all/modules/jquery_ui/ jqueryui-download
jQuery UI version 1.6 has been downloaded to /Library/WebServer/Documents/drupal6-test/sites/all/libraries/jquery.ui. [success]
ls ../all/libraries/jquery.ui/
AUTHORS.txt MIT-LICENSE.txt jquery-1.2.6.js tests ui
GPL-LICENSE.txt demos release themes version.txt
$ drush pm-enable jquery_ui
Module jquery_ui don't meet the requirements to be enabled. [error]
There were no projects that could be enabled. [ok]
The jQuery UI plugin is missing. Download and extract it to your jquery_ui module directory. (Currently using jQuery UI [error]
Not found)
An error occurred at function : drush_pm_enable [error]
So ... close but ... ?
I guess the issue in #4 is still outstanding before this will work out-of-the box.
The download does what is needed though!!
#16
The patch also adds some information to the README.
The drush command accepts 2 arguments: version and path. These args default to "1.6" and "./sites/all/libraries/jquery.ui"
The reason I let it default to the libraries folder is because hopefully the libraries api patch wont take too long.
So the command as it stands now should be typed "drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui" as the README states.
EDIT: Thats why jquery_ui wouldnt enable. It wasn't finding jquery ui library where it should be, in .sites/all/modules/jquery_ui/jquery.ui
Is there any chance a maintainer can pop in and leave a comment ? would be much appreciated
#17
Confirmed and understood. I agree that the libraries folder is the best default, even though not automatically used just yet. Keep it like that
$ drush help jqueryui-download
Download the jQuery UI library.
Arguments:
version Optional. A version number for jquery.ui. Should be in the form "1.6" or "1.7.3".
Defaults to 1.6.
path Optional. A path to the download folder. If omitted Drush will use the default location
(sites/all/libraries/jquery.ui).
All nice and as it should be
#18
I'm trying the patch in #13.
I think I'm not understanding drush or not understanding patching drush...
first I tried to patch drush, but the readme hunk failed.
then I figured: oh! patch jquery.
That went better.
Then I did:
drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui
and got an error.
Here is a transcript. What should I do different?
# wget http://drupal.org/files/issues/jquery-ui-drush-dl-673492-13_1.patch--20:... http://drupal.org/files/issues/jquery-ui-drush-dl-673492-13_1.patch
=> `jquery-ui-drush-dl-673492-13_1.patch'
Resolving drupal.org... 140.211.166.21, 140.211.166.6
Connecting to drupal.org|140.211.166.21|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,416 (2.4K) [text/plain]
100%[===================================================================>] 2,416 --.--K/s
20:21:41 (261.32 MB/s) - `jquery-ui-drush-dl-673492-13_1.patch' saved [2416/2416]
me@example.com [~/bin]# man patch
me@example.com [~/bin]# ls
./ ../ drush@ jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~/bin]# cd drush
-bash: cd: drush: Not a directory
me@example.com [~/bin]# ls
./ ../ drush@ jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~/bin]# cd ..
me@example.com [~]# ls
./ etc/ public_ftp/ www@
../ .cpanel/ .trash/ bin/ fixes public_html/
.bash_history .dns .viminfo cpbackup-exclude.conf mail/ ssl/
.bash_profile .gemrc access-logs@ drush/ moodledata/ tmp/
.bashrc .htpasswds/ bfusa/ drush-6.x-3.3.tar.gz problemsubdir webalizer.conf
me@example.com [~]# patch < bin/
drush jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~]# patch < bin/
drush jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~]# patch < bin/jquery-ui-drush-dl-673492-13_1.patch
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|=== modified file 'README.txt'
|--- README.txt 2010-10-18 10:40:49 +0000
|+++ README.txt 2010-10-18 10:58:29 +0000
--------------------------
File to patch: EOF
Skip this patch? [y] y
Skipping patch.
1 out of 1 hunk ignored
patching file jquery_ui.drush.inc
me@example.com [~]# cd drush
me@example.com [~/drush]# patch < ../bin/jquery-ui-drush-dl-673492-13_1.patch
patching file README.txt
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED -- saving rejects to file README.txt.rej
patching file jquery_ui.drush.inc
me@example.com [~/drush]# drush status
PHP configuration : /etc/php.ini
Drush version : 3.3
Drush configuration :
me@example.com [~/drush]# vi ../bin/jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~/drush]# ls
./ README.txt commands/ drush.bat drush_logo-black.png jquery_ui.drush.inc
../ README.txt.orig drush* drush.info examples/
LICENSE.txt README.txt.rej drush.api.php drush.php* includes/
me@example.com [~/drush]# vi ../bin/jquery-ui-drush-dl-673492-13_1.patch
me@example.com [~/drush]# vi README.txt
me@example.com [~/drush]# man patch
me@example.com [~/drush]# patch -R < ../bin/jquery-ui-drush-dl-673492-13_1.patch
patching file README.txt
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED -- saving rejects to file README.txt.rej
patching file jquery_ui.drush.inc
me@example.com [~/drush]# cd
me@example.com [~]# cd public_html/
me@example.com [~/public_html]# cd live
me@example.com [~/public_html/live]# cd sites/all/modules/
me@example.com [~/public_html/live/sites/all/modules]# cd jquery_ui/
me@example.com [~/public_html/live/sites/all/modules/jquery_ui]# patch < ~/bin/jquery-ui-drush-dl-673492-13_1.patch
patching file README.txt
patching file jquery_ui.drush.inc
me@example.com [~/public_html/live/sites/all/modules/jquery_ui]# man popd
me@example.com [~/public_html/live/sites/all/modules/jquery_ui]# vi README.txt
me@example.com [~/public_html/live/sites/all/modules/jquery_ui]# drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui
Drush was unable to download the jQuery UI library version 1.6 to [error]
./sites/all/modules/jquery_ui/jquery.ui.
me@example.com [~/public_html/live/sites/all/modules/jquery_ui]# cd ../..
me@example.com [~/public_html/live/sites/all]# cd ../..
me@example.com [~/public_html/live]# drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui
Drush was unable to download the jQuery UI library version 1.6 to [error]
./sites/all/modules/jquery_ui/jquery.ui.
me@example.com [~/public_html/live]# ls sites/all/modules/jquery_ui/
./ CHANGELOG.txt README.txt jquery_ui.info jquery_ui.module
../ LICENSE.txt jquery_ui.drush.inc jquery_ui.install translations/
me@example.com [~/public_html/live]#
#19
drush -v jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.uiCan you paste the output of the above ?
#20
# drush -v jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.uiInitialized Drupal 6.19 root directory at /home1/myaccount/public_html/live [notice]
Initialized Drupal site default at sites/default [notice]
Executing: svn checkout http://jquery-ui.googlecode.com/svn/tags/1.6/ [notice]
./sites/all/modules/jquery_ui/jquery.ui
Drush was unable to download the jQuery UI library version 1.6 to [error]
./sites/all/modules/jquery_ui/jquery.ui.
Command dispatch complete [notice]
#21
Due to #489140: Libraries API, the library should be downloaded into sites/all/libraries/jquery.ui now.
#22
anyone have an updated patch they can post?
#23
Updated patch with "svn checkout" changed to "svn export" so no ".svn" directories are created.
Added 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, to $items so that it works even without a site or config.
#24
Patch from #23 works, but now that #489140: Libraries API is closed, the README doesn't need this message:
That has been removed in the attached patch (which is identical except for that, and also a trailing space was removed).
I tested this, and it works for downloading jquery_ui 1.6 by default or 1.7.3 with the --version 1.7.3 option.
The only trick is that before the module is enabled the drush command isn't available, so in that case it has to be run with the --include option. For example, from the modules/jquery_ui directory I ran:
drush --include=. jqueryui-download