KonnorRogers / bridgetown-automation-tailwindcss

An automation for adding TailwindCss to a project
MIT License
9 stars 2 forks source link

cannot load active support error #2

Closed andrewmcodes closed 4 years ago

andrewmcodes commented 4 years ago

Bug

What I did

I generated a new bridgetown site, committed it, then ran:

bridgetown apply "https://github.com/ParamagicDev/bridgetown-automation-tailwindcss"

Expectation

I would expect this command to run, without error, and add the files needed for using Tailwind in a Bridgetown site.

What actually happened

➜ bridgetown apply "https://github.com/ParamagicDev/bridgetown-automation-tailwindcss"
Traceback (most recent call last):
        10: from /Users/andrew.mason/.rbenv/versions/2.7.1/bin/bridgetown:23:in `<main>'
         9: from /Users/andrew.mason/.rbenv/versions/2.7.1/bin/bridgetown:23:in `load'
         8: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/bin/bridgetown:21:in `<top (required)>'
         7: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/bin/bridgetown:21:in `require'
         6: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core/commands/base.rb:3:in `<top (required)>'
         5: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core.rb:12:in `require_all'
         4: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core.rb:12:in `each'
         3: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core.rb:13:in `block in require_all'
         2: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core.rb:13:in `require'
         1: from /Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core/commands/concerns/actions.rb:4:in `<top (required)>'
/Users/andrew.mason/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bridgetown-core-0.16.0/lib/bridgetown-core/commands/concerns/actions.rb:4:in `require': cannot load such file -- active_support/core_ext/array/extract_options (LoadError)

Workaround

I don't really think its an issue with this repo, though I could be wrong. I was able to get it to run by prepending the command with bundle exec. I made sure my gem was updated and even uninstalled the gem completely but got the same error after reinstalling it.

Proposed solution

Maybe it's worth a quick look but I believe this is an issue with Bridgetown, however, I haven't gotten the error before and I am using the bridgetown CLI. I think a good solution for now is modifying the readme to recommend prepending the command with bundle exec.

What do you think? Thanks!

KonnorRogers commented 4 years ago

This is a known issue with Bridgetown / ActiveSupport. ActiveSupport is loaded by the Bridgetown CLI...I may do some more digging to see if there's a way to fix the require calls to ActiveSupport.

ActiveSupport also breaks a lot of naming conventions and requires Bundler to make it work properly.

IE: the gem itself is gem install activesupport but when you require it becomes require "active_support"

andrewmcodes commented 4 years ago

I think this can be closed then.

If it's that big of an issue, it may be worth assessing how many methods from AS have leaked into the code and then assess the cost of removal. If it's everywhere then it's probably too much work. But, I typically find when AS is added to a codebase, it starts with one specific class or method. Usually dates.

AS is just ruby, if it's only a few select methods just patch them into the Bridgetown. If it's bigger but centered on something like just dates, there's plenty of other date gems for ruby and this is true regardless of what it is.

This comment is also for me if I get a chance to look.

KonnorRogers commented 4 years ago

@andrewmcodes if I remember front last time I looked, it's barely even used.

https://github.com/bridgetownrb/bridgetown/blob/main/bridgetown-core/lib/bridgetown-core/commands/concerns/actions.rb