Skip to content
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

require open-uri when loading http template #576

Merged
merged 1 commit into from
Sep 5, 2017
Merged

require open-uri when loading http template #576

merged 1 commit into from
Sep 5, 2017

Conversation

sshaw
Copy link
Contributor

@sshaw sshaw commented Sep 2, 2017

🌈

v0.20.0 no longer requires OpenURI from actions/file_manipulation.rb. This file is required by actions.rb. Since OpenURL is no longer loaded a no implicit conversion of Hash into String error occurs when Thor::Actions#apply tries to load a file via HTTP(S) because open has not been modified to accept HTTP headers:

/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>'

My commit loads it when needed, which seems to be the preferred style. But, due to how things are stubbed, this error was not detected by the test. I considered and_call_original but since OpenURI is lazy loaded, the original implementation is called not the HTTP one.

sshaw added a commit to sshaw/padrino-framework that referenced this pull request Sep 2, 2017
This version of prevents http templates from being
loaded. See rails/thor#576
sshaw added a commit to sshaw/padrino-framework that referenced this pull request Sep 2, 2017
This version of prevents http templates from being
loaded. See rails/thor#576
sshaw added a commit to sshaw/padrino-framework that referenced this pull request Sep 2, 2017
This version of prevents http templates from being
loaded. See rails/thor#576
@rafaelfranca rafaelfranca merged commit e41ff11 into rails:master Sep 5, 2017
@rafaelfranca
Copy link
Member

Thanks and sorry for breaking it.

@segiddins
Copy link
Contributor

That's on me for breaking it, thanks for sending in the patch @sshaw 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants