|
21 | 21 | gsub_file 'Gemfile', /^.*\bgem 'rails.*$/, ''
|
22 | 22 | gsub_file "Gemfile", /.*web-console.*/, ''
|
23 | 23 | gsub_file "Gemfile", /.*debugger.*/, ''
|
24 |
| - gsub_file "Gemfile", /.*byebug.*/, "gem 'byebug', '~> 9.0.6'" |
25 |
| - gsub_file "Gemfile", /.*puma.*/, "" |
26 |
| - gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.3.6'" |
27 |
| - gsub_file "Gemfile", /.*bootsnap.*/, "" |
| 24 | + gsub_file "Gemfile", /.*puma.*/, '' |
| 25 | + gsub_file "Gemfile", /.*bootsnap.*/, '' |
28 | 26 |
|
29 |
| - if Rails::VERSION::STRING >= '5.0.0' |
30 |
| - append_to_file('Gemfile', "gem 'rails-controller-testing'\n") |
| 27 | + # We soft-support Rails 4.2. `rails-controller-testing` only supports Rails 5+. |
| 28 | + # This conditional is to facilitate local testing against Rails 4.2. |
| 29 | + if Rails::VERSION::STRING >= '5' |
| 30 | + append_to_file 'Gemfile', "gem 'rails-controller-testing'\n" |
31 | 31 | end
|
32 | 32 |
|
33 | 33 | if Rails::VERSION::STRING >= '6'
|
34 |
| - gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'" |
35 | 34 | gsub_file "Gemfile", /.*rails-controller-testing.*/, "gem 'rails-controller-testing', git: 'https://github.com/rails/rails-controller-testing'"
|
36 | 35 | end
|
37 | 36 |
|
38 |
| - if RUBY_VERSION < "2.3.0" |
39 |
| - gsub_file "Gemfile", /.*childprocess.*/, "gem 'childprocess', '< 2.0.0'" |
40 |
| - gsub_file "Gemfile", /.*i18n.*/, "gem 'i18n', '< 1.5.2'" |
41 |
| - gsub_file "Gemfile", /.*nio4r.*/, "gem 'nio4r', '< 2.4.0'" |
42 |
| - gsub_file "Gemfile", /.*public_suffix.*/, "gem 'public_suffix', '< 4.0.0'" |
43 |
| - gsub_file "Gemfile", /.*rack.*/, "gem 'rack', '< 2.2.0', '!= 2.1.0'" |
44 |
| - gsub_file "Gemfile", /.*xpath.*/, "gem 'xpath', '< 3.2.0'" |
| 37 | + if Rails::VERSION::STRING >= '6' |
| 38 | + # sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4` |
| 39 | + gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.4'" |
| 40 | + else |
| 41 | + # Similarly, Rails 5.0 only supports '~> 1.3.6'. Rails 5.1-5.2 support '~> 1.3', '>= 1.3.6' |
| 42 | + gsub_file "Gemfile", /.*gem..sqlite3.*/, "gem 'sqlite3', '~> 1.3.6'" |
45 | 43 | end
|
46 | 44 |
|
47 | 45 | if Rails::VERSION::STRING >= "5.1.0"
|
48 |
| - if RUBY_VERSION < "2.3" |
49 |
| - gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.1.0'" |
50 |
| - elsif RUBY_VERSION < "2.4" |
51 |
| - gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.15.0'" |
52 |
| - elsif RUBY_VERSION < "2.5" |
53 |
| - gsub_file "Gemfile", /.*capybara.*/, "gem 'capybara', '~> 3.32.0'" |
54 |
| - end |
55 |
| - if Rails::VERSION::STRING >= "5.2.0" |
56 |
| - gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers', '< 4.0.0'" |
57 |
| - else |
58 |
| - gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers'" |
59 |
| - end |
| 46 | + # webdrivers 4 up until 4.3.0 don't specify `required_ruby_version`, but contain |
| 47 | + # Ruby 2.2-incompatible syntax (safe navigation). |
| 48 | + # That basically means we use pre-4.0 for Ruby 2.2, and 4.3+ for newer Rubies. |
| 49 | + gsub_file "Gemfile", /.*chromedriver-helper.*/, "gem 'webdrivers', '!= 4.0.0', '!= 4.0.1', '!= 4.1.0', '!= 4.1.1', '!= 4.1.2', '!= 4.1.3', '!= 4.2.0'" |
60 | 50 | end
|
61 | 51 |
|
62 | 52 | if Rails::VERSION::STRING >= '5.2.0' && Rails::VERSION::STRING < '6'
|
63 | 53 | copy_file sqlite_initializer, 'config/initializers/sqlite3_fix.rb'
|
64 | 54 | end
|
65 | 55 |
|
66 |
| - # Nokogiri version is pinned in rspec-rails' Gemfile since it tend to cause installation problems |
67 |
| - # on Travis CI, so we pin nokogiri in this example app also. |
68 |
| - if RUBY_ENGINE != "jruby" |
69 |
| - append_to_file 'Gemfile', "gem 'nokogiri', '#{Nokogiri::VERSION}'\n" |
70 |
| - else |
71 |
| - gsub_file "Gemfile", /.*jdbc.*/, "" |
| 56 | + if RUBY_ENGINE == "jruby" |
| 57 | + gsub_file "Gemfile", /.*jdbc.*/, '' |
72 | 58 | end
|
73 | 59 |
|
74 | 60 | # Use our version of RSpec and Rails
|
|
0 commit comments