padrino / padrino-recipes

A collection of padrino templates and plugins
http://www.padrinorb.com
292 stars 50 forks source link

`open_http': 406 Not Acceptable (OpenURI::HTTPError) #17

Closed xavierRiley closed 13 years ago

xavierRiley commented 13 years ago

When trying to install a plugin from the official recipes repo I get the following:

$ padrino g plugin carrierwave_plugin apply https://github.com/padrino/padrino-recipes/raw/master/plugins/carrierwave_plugin_plugin.rb /Users/xavierriley/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/open-uri.rb:346:in open_http': 406 Not Acceptable (OpenURI::HTTPError) from /Users/xavierriley/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/open-uri.rb:769:inbuffer_open' from /Users/xavierriley/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/open-uri.rb:203:in block in open_loop' from /Users/xavierriley/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/open-uri.rb:201:incatch' (etc.....)

I've tracked it down to an issue with Thor's apply method (docs here -- http://rdoc.info/github/wycats/thor/master/Thor/Actions#apply-instance_method) It wants to see a header of "Accept" => "application/x-thor-template" but github doesn't seem to apply this.

Any ideas for how to get around this? (admin - Should this issue go in the main Padrino repo instead?)

Thanks,

nesquena commented 13 years ago

Did you try it as padrino g plugin carrierwave_plugin or padrino g plugin carrierwave because the first way doesn't seem to work. Notice the "apply https://github.com/padrino/padrino-recipes/raw/master/plugins/carrierwave_plugin_plugin.rb", that path doesn't exist. Just wanted to be clear if you do padrino g plugin carrierwave do you see the same issue?

xavierRiley commented 13 years ago

You're right - i did call padrino g plugin carrierwave_plugin which is broken

When I do padrino g plugin carrierwave it works as expected.

I came across it because I was trying to install a recipie from my fork (https://github.com/xavierRiley/padrino-recipes/raw/master/plugins/carrierwave_plugin.rb) but the fact that it's https seems to bork Thor. I know I could change Padrino to default to my repo for recipies but I'm just thinking of the wider issues of not being able to use https:// for them.

xavierRiley commented 13 years ago

Ok I've sorted my problem out.

I was trying the following command:

padrino g plugin https://raw.github.com/xavierRiley/padrino-recipes/master/plugins/carrierwave_plugin.rb

and it gave the error

Could not find "/Users/***/Sites/padrino/sample_blog_five/https:/raw.github.com/xavierRiley/padrino-recipes/master/plugins/carrierwave_plugin.rb" in any of your source paths. Your current source paths are: (etc...)

* Suggested fix *

Padrino-gen currently uses the following regex to test for remote files; %r{^http://} (in padrino-gen/lib/padrino-gen/generators/runner.rb line 76) I suggest this instead; %r{^(http|https)://}

This is my first go at contributing via github - do i just submit a pull request for that file?

nesquena commented 13 years ago

Actually I was going to say submit a pull request, but the fix is so small that I just committed it here to save you the trouble: https://github.com/padrino/padrino-framework/commit/e5fc1a60a9b60f46f5916d1ce88bbf6a98918aee Thanks!

nesquena commented 13 years ago

Can you try using edge and see if this fixes the issue?