railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.88k stars 2.25k forks source link

[beta version] Rails admin installer adds cssbundling-rails gem in Gemfile without checking existence. #3535

Closed estebanz01 closed 6 days ago

estebanz01 commented 2 years ago

Describe the bug Hello! I'm testing rails admin 3.1.0 beta and when I run the installer, the Gemfile ended up with two entries for cssbundling-rails, the one that I had already and the one rails admin installer adds.

Reproduction steps with a configured jsbundling-rails with webpack and cssbundling-rails with sass gems: bundle add jsbundling-rails bundle add cssbundling-rails bundle exec rails javascript:install:webpack bundle exec rails css:install:sass bundle exec rails generate rails_admin:install

Expected behavior It should install without errors and bundle install should work properly.

Additional context

[!] There was an error parsing `Gemfile`: You cannot specify the same gem twice with different version requirements.
You specified: cssbundling-rails (~> 1.1) and cssbundling-rails (>= 0). Bundler cannot continue.

 #  from /home/ubuntu/avlos/ark/railsadmin/Gemfile:37
 #  -------------------------------------------
 #  gem "cssbundling-rails", "~> 1.1"
 >  gem "cssbundling-rails"
 #  -------------------------------------------
      create  app/assets/stylesheets/rails_admin.scss
      append  config/initializers/assets.rb
           -  Add scripts to package.json
You need to merge "scripts": {
  "build": "webpack --config webpack.config.js",
  "build:css": "sass ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules"
} into the existing scripts in your package.json .
Taking 'build:css' as an example, if you're already have application.sass.css for the sass build, the resulting script would look like:
  sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css ./app/assets/stylesheets/rails_admin.scss:./app/assets/builds/rails_admin.css --no-source-map --load-path=node_modules
codealchemy commented 2 years ago

This looks to be more of an issue with Rails generator actions (which this library uses) and not unique to the beta release, specifically #gem - which doesn't account for dupes in the Gemfile before adding

📝 this does the same thing when running rails_admin:install with Sprockets (the installer adds sassc-rails even if it's already in the Gemfile).

dsomel21 commented 1 year ago

Is there any update on this?

njonge9 commented 1 year ago

is there a solution to the above problem?

mshibuya commented 6 days ago

Just remove the line if redundant.