bridgetownrb / bridgetown

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

Unable to install a new bridgetown site in a subshell #70

Closed KonnorRogers closed 4 years ago

KonnorRogers commented 4 years ago

Bridgetown Version: 0.15.0-beta2

To Reproduce I have the following test:

require "test_helper"
require "fileutils"
require 'bundler'

CURRENT_BRIDGETOWN_VERSION = '0.15.0.beta2'
# CURRENT_BRIDGETOWN_VERSION = '0.14.0'

class IntegrationTest < Minitest::Test
  def test_it_works
      Rake.rm_rf(TEST_APP)
      Rake.mkdir_p(TEST_APP)
      Rake.cd(TEST_APP)

      File.open(TEST_APP_GEMFILE, 'a') do |file|
        file << "gem 'bridgetown', '~> #{CURRENT_BRIDGETOWN_VERSION}'"
      end

    Bundler.with_unbundled_env do
      Rake.sh("bundle install")
      Rake.sh("bundle exec bridgetown new . --force")
    end
  end
end

Current behavior

I receive the following error:

➜  bridgetown-plugin-tailwindcss git:(automation) ✗ rake test
Run options: --seed 3142

# Running:

rm -rf /home/krog/projects/ruby/bridgetown-plugin-tailwindcss/test_app
mkdir -p /home/krog/projects/ruby/bridgetown-plugin-tailwindcss/test_app
cd /home/krog/projects/ruby/bridgetown-plugin-tailwindcss/test_app
bundle install
Using concurrent-ruby 1.1.6
Using i18n 1.8.2
Using minitest 5.14.1
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using zeitwerk 2.3.0
Using activesupport 6.0.3.1
Using public_suffix 4.0.5
Using addressable 2.7.0
Using colorator 1.1.0
Using multipart-post 2.1.1
Using faraday 1.0.1
Using faraday_middleware 1.0.0
Using rexml 3.2.4
Using kramdown 2.2.1
Using kramdown-parser-gfm 1.1.0
Using liquid 4.0.3
Using safe_yaml 1.0.5
Using liquid-component 0.1.0
Using liquid-render-tag 0.2.0
Using rb-fsevent 0.10.4
Using ffi 1.12.2
Using rb-inotify 0.10.1
Using listen 3.2.1
Using forwardable-extended 2.6.0
Using pathutil 0.16.2
Using rouge 3.19.0
Using unicode-display_width 1.7.0
Using terminal-table 1.8.0
Using thor 1.0.1
Using bridgetown-core 0.15.0.beta2
Using bridgetown-builder 0.15.0.beta2
Using bridgetown-paginate 0.15.0.beta2
Using bridgetown 0.15.0.beta2
Using bundler 2.1.4
Bundle complete! 1 Gemfile dependency, 35 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

bundle exec bridgetown new . --force

bundler: failed to load command: bridgetown (/home/krog/.gem/ruby/2.6.3/bin/bridgetown)
LoadError: cannot load such file -- active_support/core_ext/array/extract_options
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core/commands/concerns/actions.rb:4:in `require'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core/commands/concerns/actions.rb:4:in `<top (required)>'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core.rb:13:in `require'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core.rb:13:in `block in require_all'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core.rb:12:in `each'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core.rb:12:in `require_all'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/lib/bridgetown-core/commands/base.rb:3:in `<top (required)>'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/bin/bridgetown:21:in `require'
  /home/krog/.gem/ruby/2.6.3/gems/bridgetown-core-0.15.0.beta2/bin/bridgetown:21:in `<top (required)>'
  /home/krog/.gem/ruby/2.6.3/bin/bridgetown:23:in `load'
  /home/krog/.gem/ruby/2.6.3/bin/bridgetown:23:in `<top (required)>'
E

Expected behavior

It should run without errors.

When I change the value of CURRENT_BRIDGETOWN_VERSION to 0.14.0 I do not encounter this error.

Computing environment (please complete the following information):

Additional context

Link to latest commit with Error

Also of note, if i cd into the test app and manually run bundle exec bridgetown new . --force it works.

KonnorRogers commented 4 years ago

This appears to be an issue with Bundler not with bridgetown itself. I solved this by moving:

gem 'bridgetown', '~> 0.15.0.beta2' into the top level Gemfile instead of creating a Gemfile in the test_app directory.

There is another issue on StackOverflow about this:

Issue on Stackoverflow about Activesupport

You can find the working test commit below:

Working test commit

julianrubisch commented 4 years ago

FWIW, I also ran into this when adding your tailwindcss plugin @ParamagicDev, and had to prepend bundle exec bridgetown apply...