bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.13k stars 114 forks source link

bug: remote URLs for apply command broken in Ruby 3 #156

Closed andrewmcodes closed 3 years ago

andrewmcodes commented 3 years ago

Bridgetown Version:

v0.17

To Reproduce

Current behavior

➜ bundle exec bridgetown apply https://github.com/bridgetownrb/bridgetown-cloudinary | pbcopy
bundler: failed to load command: bridgetown (/Users/andrew.mason/.rbenv/versions/3.0.0-preview1/bin/bridgetown)
Errno::ENOENT: No such file or directory @ rb_sysopen - https://raw.githubusercontent.com/bridgetownrb/bridgetown-cloudinary/master/bridgetown.automation.rb
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/actions.rb:222:in `initialize'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/actions.rb:222:in `open'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/actions.rb:222:in `apply'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bridgetown-core-0.17.0/lib/bridgetown-core/commands/concerns/actions.rb:80:in `apply_from_url'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bridgetown-core-0.17.0/lib/bridgetown-core/commands/apply.rb:66:in `block in apply_in_pwd'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler.rb:370:in `block in with_original_env'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler.rb:688:in `with_env'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler.rb:370:in `with_original_env'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bridgetown-core-0.17.0/lib/bridgetown-core/commands/apply.rb:65:in `apply_in_pwd'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bridgetown-core-0.17.0/lib/bridgetown-core/commands/apply.rb:33:in `apply_automation'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `block in invoke_all'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `each'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `map'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `invoke_all'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/group.rb:232:in `dispatch'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:116:in `invoke'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor.rb:40:in `block in register'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bridgetown-core-0.17.0/bin/bridgetown:22:in `<top (required)>'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/bin/bridgetown:23:in `load'
  /Users/andrew.mason/.rbenv/versions/3.0.0-preview1/bin/bridgetown:23:in `<top (required)>'

Recreated via automated action test here: https://github.com/andrewmcodes/btown-issue-156/runs/1191481792?check_suite_focus=true

Let me know if you want access.

Expected behavior

The action would be pulled down and installed correctly.

Note: This is not an issue on Ruby 2.7.1 so definitely not urgent, but I wanted to ahead and raise the issue.

Screenshots

Reproduction: https://github.com/andrewmcodes/btown-issue-156

Computing environment (please complete the following information):

Additional context

jaredcwhite commented 3 years ago

I started trying out Ruby 3 to build a couple of sites and ran into a snag here and there…I don't remember now what it was exactly. We should probably create a dedicated label for Ruby 3 and track a number of issues as they come up.

jaredcwhite commented 3 years ago

Just confirmed this is an issue in the latest rc1 release of Ruby 3. Investigating now.

jaredcwhite commented 3 years ago

Unfortunately this will require a patch in Thor itself to resolve. Created a PR here: https://github.com/erikhuda/thor/pull/741

kadru commented 3 years ago

I just installed bridgetwon with ruby 3, saddly also I have this problem. I will use ruby 2.7 in the mean while.

jaredcwhite commented 3 years ago

@kadru I have a patch you could try out if you want, just add this to your Gemfile:

gem "thor", github: "jaredcwhite/thor", branch: "apply-patch-for-ruby-3"
jaredcwhite commented 3 years ago

Thor 1.1.0 has been released, fixing this issue with Ruby 3. 💯