Skip to content

Commit d0d4a91

Browse files
committed
Use symlinks for multiple Gemfiles
1 parent 157768c commit d0d4a91

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

example/Gemfile

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
source "https://rubygems.org"
22

3-
gem "rails"
4-
eval_gemfile "Gemfile.common"
3+
def rails_version
4+
current_gemfile = File.basename(__FILE__)
5+
6+
{
7+
"Gemfile" => nil,
8+
"Gemfile_rails71" => "~> 7.1.3"
9+
}.fetch(current_gemfile)
10+
end
11+
12+
gem "rails", rails_version
13+
gem "sqlite3"
14+
gem "puma"
15+
gem "webpacker"
16+
gem "bootsnap", require: false
17+
18+
group :development, :test do
19+
gem "cypress-rails", path: ".."
20+
end

example/Gemfile.rails71

-4
This file was deleted.

example/Gemfile_rails71

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gemfile

example/Gemfile.rails71.lock example/Gemfile_rails71.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ DEPENDENCIES
205205
bootsnap
206206
cypress-rails!
207207
puma
208-
rails (~> 7.1, < 7.2)
208+
rails (~> 7.1.3)
209209
sqlite3
210210
webpacker
211211

example/README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# README
22

3-
The example app has multiple Gemfiles to be able to test against different
4-
dependency versions (so far just Rails).
3+
The example app has multiple, symlinked Gemfiles to be able to test against
4+
different dependency versions (so far just Rails).
55

66
For the latest version of Rails, you can just use all the default `bundle`
77
commands:
@@ -11,13 +11,9 @@ bundle exec rake cypress:run
1111
```
1212

1313
For previous version(s) of Rails, you need to specify the Gemfile to use. So
14-
for `Gemfile.rails71` (which uses Rails 7.1), you'll need to include an env var
14+
for `Gemfile_rails71` (which uses Rails 7.1), you'll need to include an env var
1515
when you use `bundle` commands:
1616
```
17-
BUNDLE_GEMFILE=Gemfile.rails71 bundle
18-
BUNDLE_GEMFILE=Gemfile.rails71 bundle exec rake cypress:run
17+
BUNDLE_GEMFILE=Gemfile_rails71 bundle
18+
BUNDLE_GEMFILE=Gemfile_rails71 bundle exec rake cypress:run
1919
```
20-
21-
If you're adding/changing a dependency that won't differ between the multiple
22-
Gemfiles, then you can make that change in `Gemfile.common` so that it gets
23-
picked up in all the Gemfiles.

0 commit comments

Comments
 (0)