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

Issue with Apply command and loading ActiveSupport #73

Closed KonnorRogers closed 3 years ago

KonnorRogers commented 4 years ago

When running the

./compose.sh up --build

In the following repo:

https://github.com/ParamagicDev/bridgetown-plugin-tailwindcss

It returns an error for the test suite.

Bridgetown Version:

0.15.0-beta3

To Reproduce

Clone the repo.

Run :

./compose.sh up --build

Current behavior

Currently it returns a LoadError for active_support/core_ext/array/extract_options

Returns same error message as #70

Expected behavior

Expected to run without error.

Computing environment (please complete the following information):

Additional context

The command:

bridgetown new newsite --apply="url" works without error.

bridgetown apply "url" returns an error

KonnorRogers commented 4 years ago

Forgot to add a bundle exec bridgetown apply "url" in the test. Closing this as not a Bridgetown issue sorry!

jaredcwhite commented 4 years ago

@ParamagicDev yeah, those'll get ya. 🤪 I'm still sort of a sucker for RVM mainly so I can forget to bundle exec and it's fine. 😁

KonnorRogers commented 4 years ago

Its actually weird, so I have it now working in Docker, but it doesnt work locally. Im even more confused now.

KonnorRogers commented 4 years ago

Okay, everything works as expected now. I have no clue how or why. I think it had to do with me making Bundler.with_original_env / Bundler.with_unbundled_env calls that clashed with Bridgetown's Bundler.with_clean_env. I honestly dont know. Im confused, but everything works so :shrug:

excid3 commented 4 years ago

Just ran into this one today. Dang bundle exec

andrewmcodes commented 3 years ago

@jaredcwhite @ParamagicDev I believe this needs to be reopened as I still run into it when using commands without bundle exec.

I believe we just need to add the following to https://github.com/bridgetownrb/bridgetown/blob/2a7e6a367d723f8101e32a1028b6e4e360188653/bridgetown-core/lib/bridgetown-core/commands/concerns/actions.rb#L3

require "active_support"

Why?

Active Support Docs

It would seem you need to load active_support before the extensions, which would add some sense as to why the commands work with bundle exec and not without.

So actions.rb would become

+ require "active_support"
  require "active_support/core_ext/array/extract_options"
  require "active_support/core_ext/string/strip"
  require "active_support/core_ext/string/indent"

The only issue is I am not sure how best to test that this does indeed fix the issue. Any ideas?

jaredcwhite commented 3 years ago

Ah, I missed the part where it says requiring active_support by itself doesn't actually load any specific extensions. That's good to know…I think we can add it in then at the bridgetown-core.rb level (wouldn't recommend it in actions.rb per se).

jaredcwhite commented 3 years ago

Darn, my fix didn't work. Leaving open for now.

jaredcwhite commented 3 years ago

This should be fixed now in 0.19.1. I had to move the ActiveSupport require statements into the bin script itself before any plugins Bundler stuff is set up.