-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [close #1202] Add support for Rails 7 & jsbundling Rails 7 introduced the gem: ``` gem "jsbundling-rails", "~> 0.1.0" ``` Which no longer relies on `webpacker`. Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation. With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected. * [close #1202] Add support for Rails 7 & jsbundling Rails 7 introduced the gem: ``` gem "jsbundling-rails", "~> 0.1.0" ``` Which no longer relies on `webpacker`. Issue #1202 was opened since developers using jsbundling would expect `yarn` to be available but won't have the `webpacker` gem which we use to gate detection for yarn installation. With this change we now install nodejs when a `package.json` is detected and yarn when `yarn.lock` is detected.
- Loading branch information
Showing
14 changed files
with
83 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require dead_end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ group :development, :test do | |
gem 'json' | ||
gem 'ci-queue' | ||
gem 'redis' | ||
gem 'dead_end' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Nodejs will now be installed for Ruby applications that have a `package.json` file | ||
|
||
Ruby applications using the `heroku/ruby` buildpack now receive a default version of `node` installed if they have a `package.json` file in the root directory of their application. | ||
|
||
Prior to this change, only applications using the `webpacker` or `execjs` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. | ||
|
||
>Note | ||
>Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior | ||
For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Yarn will now be installed for Ruby applications that have a `yarn.lock` file | ||
|
||
Ruby applications using the `heroku/ruby` buildpack now receive a default version of `yarn` installed if they have a `yarn.lock` file in the root directory of their application. | ||
|
||
Prior to this change, only applications using the `webpacker` gem would trigger node installation logic. This change is intended to facilitate Rails 7 applications using `jsbundling-rails` without `webpacker`. | ||
|
||
>Note | ||
>Applications using the `heroku/nodejs` buildpack before the `heroku/ruby` buildpack will not see a change in behavior | ||
For more information, see [Heroku Ruby support documentation](https://devcenter.heroku.com/articles/ruby-support#installed-binaries). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'securerandom' | ||
require "language_pack" | ||
require "language_pack/rails6" | ||
|
||
class LanguagePack::Rails7 < LanguagePack::Rails6 | ||
# @return [Boolean] true if it's a Rails 7.x app | ||
def self.use? | ||
instrument "rails6.use" do | ||
rails_version = bundler.gem_version('railties') | ||
return false unless rails_version | ||
is_rails = rails_version >= Gem::Version.new('7.a') && | ||
rails_version < Gem::Version.new('8.0.0') | ||
return is_rails | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require_relative '../spec_helper' | ||
|
||
describe "Rails 6" do | ||
it "should detect successfully" do | ||
Hatchet::App.new('rails-jsbundling').in_directory_fork do | ||
expect(LanguagePack::Rails6.use?).to eq(false) | ||
expect(LanguagePack::Rails7.use?).to eq(true) | ||
end | ||
end | ||
|
||
it "works with jsbundling" do | ||
Hatchet::Runner.new("rails-jsbundling").tap do |app| | ||
app.deploy do | ||
expect(app.output).to include("yarn install") | ||
expect(app.output).to include("Asset precompilation completed") | ||
end | ||
end | ||
end | ||
end |