New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Padrino cannot download plugins #2152

Closed
hron84 opened this Issue Aug 28, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@hron84

hron84 commented Aug 28, 2017

What is the current behavior?

padrino gen plugin coffee cannot download the plugin from GitHub

$ padrino gen plugin coffee
       apply  https://raw.github.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb
  The template at https://raw.github.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb could not be found!

What is the expected behavior?

???

Which versions of Ruby, Padrino, Sinatra, Rack, OS are you using? Did this work in previous versions?

Gems included by the bundle:
  * activemodel (5.1.3)
  * activerecord (5.1.3)
  * activesupport (5.1.3)
  * arel (8.0.0)
  * bundler (1.15.4)
  * coffee-script (2.4.1)
  * coffee-script-source (1.12.2)
  * concurrent-ruby (1.0.5)
  * diff-lcs (1.3)
  * enumerable-lazy (0.0.2)
  * execjs (2.7.0)
  * ffi (1.9.18)
  * haml (5.0.2)
  * i18n (0.8.6)
  * mail (2.6.6)
  * mime-types (2.99.3)
  * minitest (5.10.3)
  * moneta (0.8.1)
  * mustermann (1.0.1)
  * mustermann19 (0.4.4)
  * mysql2 (0.4.9)
  * padrino (0.14.1.1)
  * padrino-admin (0.14.1.1)
  * padrino-cache (0.14.1.1)
  * padrino-core (0.14.1.1)
  * padrino-gen (0.14.1.1)
  * padrino-helpers (0.14.1.1)
  * padrino-mailer (0.14.1.1)
  * padrino-support (0.14.1.1)
  * rack (2.0.3)
  * rack-coffee (1.0.3)
  * rack-protection (2.0.0)
  * rack-test (0.7.0)
  * rake (12.0.0)
  * rb-fsevent (0.10.2)
  * rb-inotify (0.9.10)
  * rspec (3.6.0)
  * rspec-core (3.6.0)
  * rspec-expectations (3.6.0)
  * rspec-mocks (3.6.0)
  * rspec-support (3.6.0)
  * sass (3.5.1)
  * sass-listen (4.0.0)
  * sinatra (2.0.0)
  * temple (0.8.0)
  * thor (0.20.0)
  * thread_safe (0.3.6)
  * tilt (2.0.8)
  * tzinfo (1.2.3)

and

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.11
  - RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/hron/.rvm/gems/ruby-2.4.1@dhtv
  - USER INSTALLATION DIRECTORY: /home/hron/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /home/hron/.rvm/rubies/ruby-2.4.1/bin/ruby
  - EXECUTABLE DIRECTORY: /home/hron/.rvm/gems/ruby-2.4.1@dhtv/bin
  - SPEC CACHE DIRECTORY: /home/hron/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/hron/.rvm/gems/ruby-2.4.1@dhtv
     - /home/hron/.rvm/gems/ruby-2.4.1@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-rdoc --no-ri"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/hron/.rvm/gems/ruby-2.4.1@dhtv/bin
     - /home/hron/.rvm/gems/ruby-2.4.1@global/bin
     - /home/hron/.rvm/rubies/ruby-2.4.1/bin
     - /home/hron/.rvm/bin
# ... snip ....
@adam12

This comment has been minimized.

Contributor

adam12 commented Aug 28, 2017

Can you fetch the URL manually using curl?

$ curl -i https://raw.githubusercontent.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb

Are you on a proxy / shared connection / working from a coffee shop / etc? We might need a better error message here, but I think maybe Github had throttled your connection to that URL.

Works as expected here.

$ padrino gen plugin coffee
       apply  https://raw.github.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb
      insert    Gemfile
      insert    Gemfile
      insert    app/app.rb
      create    config/initializers/coffee.rb
$
@hron84

This comment has been minimized.

hron84 commented Aug 28, 2017

Curl worked fine, at least I successfully fetched the plugin URL with curl that Padrino printed (but I didn't try the githubusercontent link, since this is not what Padrino tries to download, even if it resolves to that). I am behind a transparent proxy, which means I don't have to use proxy parameters in applications.

Did you try with same version as me? If not, could you show me your version? Maybe I downloaded wrong version of Padrino - I am a newbie in this framework.

I did not experience GitHub throttle before or after. However, it would be good if you can make padrino-recipes as a Gem and Padrino could look after them locally too. Or, at least, provide us a way to place these plugins locally and not force-download them. This is so obtrusive and makes developers with poor internet connection (or even metered one) annoyed.

@sshaw

This comment has been minimized.

Contributor

sshaw commented Aug 29, 2017

I can reproduce this with Padrino 0.13.3.3. One problem is Padrino swallows the exception (fix at #2153). When you include the exception (and the backtrace), you see that this is an issue using Thor:

/tmp/test-app-pad >padrino gen plugin coffee
       apply  https://raw.github.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb
  The template at https://raw.github.com/padrino/padrino-recipes/master/plugins/coffee_plugin.rb could not be found: no implicit conversion of Hash into String  
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/actions.rb:220:in `initialize'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/actions.rb:220:in `open'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/actions.rb:220:in `apply'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/padrino-gen-0.13.3.3/lib/padrino-gen/generators/runner.rb:135:in `execute_runner'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/padrino-gen-0.13.3.3/lib/padrino-gen/generators/plugin.rb:42:in `setup_plugin'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/padrino-gen-0.13.3.3/lib/padrino-gen/generators/cli.rb:50:in `setup'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
/Users/sshaw/.rvm/gems/ruby-2.3.0/gems/padrino-gen-0.13.3.3/bin/padrino-gen:16:in `<main>'
@sshaw

This comment has been minimized.

Contributor

sshaw commented Sep 2, 2017

Further research shows that this is a problem with Thor. See erikhuda/thor#576.
I've updated by PR to account for this.

@ujifgc ujifgc closed this in 12c2988 Sep 2, 2017

ujifgc added a commit that referenced this issue Feb 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment