Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
1.49 KB

Patch with a 'jqueryui download' command and also runs that command whenever someone calls drush enable jquery_ui.

moshe weitzman’s picture

Looks proper to me. Nice work.

RobLoach’s picture

Haha, nice.

turadg’s picture

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.

dawehner’s picture

FileSize
1.38 KB

Here is a updated patch for it. This fixes the drush-3 problems described above

j0nathan’s picture

Subscribing.

watcha’s picture

FileSize
1.38 KB

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.

watcha’s picture

Sorry, same patch, just named it properly

watcha’s picture

Status: Needs review » Reviewed & tested by the community

Works as expected. one can stipulate download destination with an argument. Setting this to Reviewed and tested.

j0nathan’s picture

Hi,
Would it be possible to choose version 1.7.3 ?

drewish’s picture

Yeah +1 for making the version configurable.

drewish’s picture

Taking a hint from #608282: Tell users to delete 'demos' directory in readme we should probably delete the demos folder for them.

watcha’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.36 KB

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

watcha’s picture

Status: Needs review » Reviewed & tested by the community
dman’s picture

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!!

watcha’s picture

The patch also adds some information to the README.

Please Note that for now, the command should be typed "drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui" This is due to http://drupal.org/node/489140 being unresolved and Jquery UI 1.7 requiring the Jquery Update module.

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

dman’s picture

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

YesCT’s picture

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:21:41--  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]#
watcha’s picture

drush -v jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui

Can you paste the output of the above ?

YesCT’s picture

# drush -v jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui
Initialized 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]
sun’s picture

Status: Reviewed & tested by the community » Needs work

Due to #489140: Libraries API, the library should be downloaded into sites/all/libraries/jquery.ui now.

YesCT’s picture

anyone have an updated patch they can post?

zany’s picture

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.

shark’s picture

Patch from #23 works, but now that #489140: Libraries API is closed, the README doesn't need this message:

Please Note that for now, the command should be typed "drush jqueryui-download 1.6 ./sites/all/modules/jquery_ui/jquery.ui"
This is due to http://drupal.org/node/489140 being unresolved and Jquery UI 1.7 requiring the Jquery Update module.

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

nod_’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes

Might be still relevant but with composer.