Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bundle install step from generator #3219

Draft
wants to merge 1 commit into
base: migrate-asset-pipeline
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
ruby: ["3.2", "3.3"]
bootstrap_version: ["~> 4.0"]
blacklight_version: ["~> 7.34"]
additional_engine_cart_rails_options: [""]
additional_engine_cart_rails_options: ["-a propshaft -j esbuild"]
additional_name: [""]
include:
- rails_version: "~> 7.2"
Expand All @@ -37,7 +37,7 @@ jobs:
RAILS_VERSION: ${{ matrix.rails_version }}
BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
BOOTSTRAP_VERSION: ${{ matrix.bootstrap_version }}
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test -a propshaft ${{ matrix.additional_engine_cart_rails_options }}"
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
steps:
- uses: actions/checkout@v4
# Remove these Chrome steps after https://issues.chromium.org/issues/351858989 is fixed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN bundle install --jobs "$(nproc)"
RUN mkdir -p /spotlight/app
WORKDIR /spotlight/app

RUN SKIP_TRANSLATION=yes rails _${RAILS_VERSION}_ new . -a propshaft --force --template=../engine/template.rb
RUN SKIP_TRANSLATION=yes rails _${RAILS_VERSION}_ new . -a propshaft -j esbuild --force --template=../engine/template.rb
RUN bundle add pg
RUN yarn add file:${SPOTLIGHT_GEM}
RUN yarn add @babel/plugin-proposal-private-methods --dev
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
if ENV['RAILS_VERSION']
if ENV['RAILS_VERSION'] == 'edge'
gem 'rails', github: 'rails/rails'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks -a propshaft'
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
else
gem 'rails', ENV['RAILS_VERSION']
end
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Read more about what Spotlight is, our motivations for creating it, and how to i
To bootstrap a new Rails application:

```
$ SKIP_TRANSLATION=1 rails new app-name -m https://raw.githubusercontent.com/projectblacklight/spotlight/main/template.rb -a propshaft
$ SKIP_TRANSLATION=1 rails new app-name -m https://raw.githubusercontent.com/projectblacklight/spotlight/main/template.rb -a propshaft -j esbuild
```

or from an existing Rails application:
Expand Down
7 changes: 5 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ require 'engine_cart/rake_task'

require 'spotlight/version'

# Ensure the app generates with Propshaft; sprockets is no longer supported
ENV['ENGINE_CART_RAILS_OPTIONS'] = "#{ENV.fetch('ENGINE_CART_RAILS_OPTIONS', nil)} -a propshaft"
# Build with our opinionated defaults if none are provided.
rails_options = ENV.fetch('ENGINE_CART_RAILS_OPTIONS', '')
rails_options = "#{rails_options} -a propshaft" unless rails_options.match?(/-a\s|--asset-pipeline/)
rails_options = "#{rails_options} -j esbuild" unless rails_options.match?(/-j\s|--javascript/)
ENV['ENGINE_CART_RAILS_OPTIONS'] = rails_options

task ci: ['engine_cart:generate'] do
ENV['environment'] = 'test'
Expand Down
13 changes: 0 additions & 13 deletions lib/generators/spotlight/assets/propshaft_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ def add_bootstrap
end
end

def install_gems
gem 'jsbundling-rails'
gem 'cssbundling-rails'
end

def bundle_install
inside destination_root do
Bundler.with_unbundled_env do
run 'bundle install'
end
end
end

def install_javascript_bundler
rails_command 'javascript:install:esbuild'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def use_capybara3
def add_gems
gem 'blacklight', ENV['BLACKLIGHT_VERSION'] || '~> 7.38' unless Bundler.locked_gems.dependencies.key? 'blacklight'
gem 'blacklight-gallery', '~> 4.5' unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
gem 'cssbundling-rails' unless defined?(Sprockets)

unless Bundler.locked_gems.dependencies.key? 'bootstrap_form'
bootstrap_version = ENV.fetch('BOOTSTRAP_VERSION', '~> 5.3')
Expand Down
1 change: 1 addition & 0 deletions template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
gem 'blacklight-spotlight', ENV['SPOTLIGHT_GEM'] ? { path: ENV['SPOTLIGHT_GEM'] } : { github: 'projectblacklight/spotlight' }
gem 'sidekiq'
gem 'bootstrap_form', /(\d)(?:\.\d){0,2}/.match(bootstrap_version)[1].to_i == 5 ? '~> 5.4' : '~> 4.5'
gem 'cssbundling-rails' unless options[:asset_pipeline] == 'sprockets'

after_bundle do
# run the blacklight install generator
Expand Down