Skip to content

Commit 24d9e93

Browse files
authored
Merge pull request #617 from deivid-rodriguez/remove_old_rails
Remove support for old Rails versions
2 parents d7b21ff + 728f357 commit 24d9e93

File tree

5 files changed

+27
-46
lines changed

5 files changed

+27
-46
lines changed

.travis.yml

-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
language: ruby
22
cache: bundler
33
rvm:
4-
- 2.4.6
54
- 2.5.5
65
- 2.6.3
76
- ruby-head
87
env:
9-
- RAILS_VERSION="~> 4.2.0"
10-
- RAILS_VERSION="~> 5.0.0"
11-
- RAILS_VERSION="~> 5.1.0"
128
- RAILS_VERSION="~> 5.2.0"
139
- RAILS_VERSION="~> 6.0.0.rc1"
1410
matrix:
15-
exclude:
16-
- rvm: 2.4.6
17-
env: RAILS_VERSION="~> 6.0.0.rc1"
18-
- rvm: 2.6.3
19-
env: RAILS_VERSION="~> 4.2.0"
2011
allow_failures:
2112
- rvm: ruby-head
2213
fast_finish: true

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ boot it every time you run a test, rake task or migration.
1616

1717
## Compatibility
1818

19-
* Ruby versions: MRI 2.4, MRI 2.5, MRI 2.6
20-
* Rails versions: 4.2, 5.0, 5.1, 5.2, 6.0 (Spring is installed by default when you do
19+
* Ruby versions: MRI 2.5, MRI 2.6
20+
* Rails versions: 5.2, 6.0 (Spring is installed by default when you do
2121
`rails new` to generate your application)
2222

2323
Spring makes extensive use of `Process.fork`, so won't be able to

lib/spring/application.rb

+3-9
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def preload
9191

9292
require Spring.application_root_path.join("config", "application")
9393

94-
unless Rails.respond_to?(:gem_version) && Rails.gem_version >= Gem::Version.new('4.2.0')
95-
raise "Spring only supports Rails >= 4.2.0"
94+
unless Rails.respond_to?(:gem_version) && Rails.gem_version >= Gem::Version.new('5.2.0')
95+
raise "Spring only supports Rails >= 5.2.0"
9696
end
9797

9898
# config/environments/test.rb will have config.cache_classes = true. However
@@ -163,13 +163,7 @@ def serve(client)
163163
setup command
164164

165165
if Rails.application.reloaders.any?(&:updated?)
166-
# Rails 5.1 forward-compat. AD::R is deprecated to AS::R in Rails 5.
167-
if defined? ActiveSupport::Reloader
168-
Rails.application.reloader.reload!
169-
else
170-
ActionDispatch::Reloader.cleanup!
171-
ActionDispatch::Reloader.prepare!
172-
end
166+
Rails.application.reloader.reload!
173167
end
174168

175169
pid = fork {

spring.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
1313
gem.files = Dir["LICENSE.txt", "README.md", "lib/**/*", "bin/*"]
1414
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
1515

16-
gem.required_ruby_version = ">= 2.4.0"
16+
gem.required_ruby_version = ">= 2.5.0"
1717

1818
gem.add_development_dependency 'rake'
1919
gem.add_development_dependency 'bump'

test/support/acceptance_test.rb

+21-25
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AcceptanceTest < ActiveSupport::TestCase
1212
DEFAULT_SPEEDUP = 0.8
1313

1414
def rails_version
15-
ENV['RAILS_VERSION'] || '~> 5.0.0'
15+
ENV['RAILS_VERSION'] || '~> 6.0.0'
1616
end
1717

1818
# Extension point for spring-watchers-listen
@@ -503,18 +503,16 @@ def exec_name
503503
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
504504
end
505505

506-
if RUBY_VERSION >= "2.0.0"
507-
test "changing the gems.rb works" do
508-
FileUtils.mv(app.gemfile, app.gems_rb)
509-
FileUtils.mv(app.gemfile_lock, app.gems_locked)
506+
test "changing the gems.rb works" do
507+
FileUtils.mv(app.gemfile, app.gems_rb)
508+
FileUtils.mv(app.gemfile_lock, app.gems_locked)
510509

511-
assert_success %(bin/rails runner 'require "sqlite3"')
510+
assert_success %(bin/rails runner 'require "sqlite3"')
512511

513-
File.write(app.gems_rb, app.gems_rb.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
514-
app.await_reload
512+
File.write(app.gems_rb, app.gems_rb.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
513+
app.await_reload
515514

516-
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
517-
end
515+
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
518516
end
519517

520518
test "changing the Gemfile works when Spring calls into itself" do
@@ -531,23 +529,21 @@ def exec_name
531529
assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
532530
end
533531

534-
if RUBY_VERSION >= "2.0.0"
535-
test "changing the gems.rb works when spring calls into itself" do
536-
FileUtils.mv(app.gemfile, app.gems_rb)
537-
FileUtils.mv(app.gemfile_lock, app.gems_locked)
532+
test "changing the gems.rb works when spring calls into itself" do
533+
FileUtils.mv(app.gemfile, app.gems_rb)
534+
FileUtils.mv(app.gemfile_lock, app.gems_locked)
538535

539-
File.write(app.path("script.rb"), <<-RUBY.strip_heredoc)
540-
gemfile = Rails.root.join("gems.rb")
541-
File.write(gemfile, "\#{gemfile.read}gem 'text'\\n")
542-
Bundler.with_clean_env do
543-
system(#{app.env.inspect}, "bundle install")
544-
end
545-
output = `\#{Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
546-
exit output.include? "done\n"
547-
RUBY
536+
File.write(app.path("script.rb"), <<-RUBY.strip_heredoc)
537+
gemfile = Rails.root.join("gems.rb")
538+
File.write(gemfile, "\#{gemfile.read}gem 'text'\\n")
539+
Bundler.with_clean_env do
540+
system(#{app.env.inspect}, "bundle install")
541+
end
542+
output = `\#{Rails.root.join('bin/rails')} runner 'require "text"; puts "done";'`
543+
exit output.include? "done\n"
544+
RUBY
548545

549-
assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
550-
end
546+
assert_success [%(bin/rails runner 'load Rails.root.join("script.rb")'), timeout: 60]
551547
end
552548

553549
test "changing the environment between runs" do

0 commit comments

Comments
 (0)