Hello,
The use case for my feature request is fairly easy. I need to download the library TinyMCE, and also a language pack. But that language pack (which is an archive containing many files) must be extracted inside TinyMCE's folder tree, without any containing folder (the archive contains many files that go in many directories inside TinyMCE tree).
The problem is that, at the moment, this is impossible to achieve using drush_make, as it stops with an error, if trying to extract a project in a non empty directory.
The attached patch provides the new option "overwrite" in Drush Make. I a project (or library) has this option set to 1, then it can be extracted in a non empty folder. For example, the drush make lines concerning TinyMCE and its French language pack would be the following :
; TinyMCE JS library
libraries[tinymce][download][type] = "file"
libraries[tinymce][download][url] = "http://github.com/downloads/tinymce/tinymce/tinymce_3.4.2.zip"
libraries[tinymce][directory_name] = "tinymce"
; TinyMCE French language pack (JS export)
libraries[tinymce_fr][download][type] = "file"
libraries[tinymce_fr][download][request_type] = "post"
libraries[tinymce_fr][download][url] = "http://tinymce.moxiecode.com/i18n/index.php?ctrl=export&act=zip"
libraries[tinymce_fr][download][data] = "la[]=fr&la_export=js&pr_id=7&submitted=Download"
; Force filename so Drush Make unzips it
libraries[tinymce_fr][download][filename] = "tinymce_fr.zip"
; The two following lines are telling drush make to put the archive files in libraries/tinymce/jscripts/tiny_mce
libraries[tinymce_fr][destination] = "libraries/tinymce/jscripts"
libraries[tinymce_fr][directory_name] = "tiny_mce"
; Allow drush make to install librairies[tinymce_fr] inside a non empty directory
libraries[tinymce_fr][overwrite] = 1
Provided patch includes documentation of the new option.
Any comment is welcome.
Regards,
David
Comment | File | Size | Author |
---|---|---|---|
#5 | drush_make_overwrite.patch | 1.54 KB | David Stosik |
drush_make_overwrite.patch | 1.34 KB | David Stosik |
Comments
Comment #1
David Stosik CreditAttribution: David Stosik commentedPatch also works on 2.2 version. :)
Comment #2
izmeez CreditAttribution: izmeez commentedsubscribing, also need this for swftools flowplayer3 libraries.
Comment #3
David Stosik CreditAttribution: David Stosik commentedTo help the issue going forward, please test the attached patch, and post your feedback here. :)
Comment #4
izmeez CreditAttribution: izmeez commentedDavid,
Yes, I was just bookmarking this so that I could return when time was available and this has not been until now.
The patch works, thank you. I like the introduction of the new option 'overwrite' which if not declared behaves as false preserving the default behavior and when declared true it permits adding to existing directories. This is useful for different modules and libraries such as fckeditor and flowplayer3.
Here are a few suggestions for the patch. I will include them in this post rather than as revised patch so you can decide.
php TRUE = -1 and substituting 1 for a conditional flag may cause problems down the road.
Suggest change in readme be:
Suggest change in drush_make.project.inc be:
Thanks for your efforts.
Izzy
Comment #5
David Stosik CreditAttribution: David Stosik commentedDidn't use TRUE cause I was not sure about $this->overwrite to be parsed as a boolean. I checked, and it is parsed as a boolean, so I see no problem in including your suggestions. :)
I attached a new patch. Thanks Izzy for your support.
David
Comment #6
izmeez CreditAttribution: izmeez commentedDavid,
Thanks for the patch. I have marked it as RTBC.
Izzy
Comment #7
David Stosik CreditAttribution: David Stosik commentedUp ?
Comment #8
j0nathan CreditAttribution: j0nathan commentedHi,
Thanks for the patch. I used it with drush_make 2.2 and drush 4.4. It works well with this:
Comment #9
David Stosik CreditAttribution: David Stosik commentedThanks for the test. :)
Is there any chance this get commited sooner or later ?
Regards,
David
Comment #11
helmo CreditAttribution: helmo commentedNice, I also needed a TinyMCE translation.
The patch works great.
For reference there is an old issue that raised a similar problem but got a won't-fix: #628198: Allow library downloads into a directory that already exists
Comment #12
Andrew_Mallis CreditAttribution: Andrew_Mallis commentedsubscribe
Comment #13
anarcat CreditAttribution: anarcat commentedCommitted as 913f245 in 3.x and as cb84d38 in 2.x.
Comment #15
David Stosik CreditAttribution: David Stosik commentedWould it be possible to port this to Drush 5?
Regards,
David
Comment #16
helmo CreditAttribution: helmo commentedYou are going to need an extra drush module: http://drupal.org/project/make_post
I created it specifically to download tinymce translations.
Please open a new issue if you encounter more problems.
Comment #17
David Stosik CreditAttribution: David Stosik commentedMy problem has nothing to do with POST data, but with the "overwrite" property, allowing to install many projects in the same directory (Drush 4 was throwing a warning and aborted without completing, I don't think it has changed in Drupal 5).
By the way, I don't need this only for POST downloads, but for any (Git, GET, etc.) DrushMakeProject I would like to unpack in a non empty directory.
Comment #18
David Stosik CreditAttribution: David Stosik commentedOK, I get it, the patch I initially wrote for Drush Make a year ago was actually included in Drush 5, so as you said, the problem shall really come from POST data. Why does it work on Drush Make, not in Drush 5, I don't know...
I guess that would be a good idea to include Drush Make Post to Drush, but that belongs to another issue...
Comment #19
izmeez CreditAttribution: izmeez commented@David
So , is this overwrite patch working in drush 5?
Comment #20
David Stosik CreditAttribution: David Stosik commentedYes. But POST type request, that worked in Drush Make for Drush 4 don't work anymore. That's a regression and you'll need make_post module.