Skip to content

Commit e54664d

Browse files
committed
Don't use sqlite3 1.4 in versions that don't support it
1 parent b289f2f commit e54664d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/spring/test/acceptance_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def exec_name
497497
test "changing the Gemfile works" do
498498
assert_success %(bin/rails runner 'require "sqlite3"')
499499

500-
File.write(app.gemfile, app.gemfile.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
500+
File.write(app.gemfile, app.gemfile.read.gsub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
501501
app.await_reload
502502

503503
assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"

lib/spring/test/application_generator.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,17 @@ def generate_files
6262
rewrite_file(application.gemfile) do |c|
6363
c.sub!("https://rubygems.org", "http://rubygems.org")
6464
c.gsub!(/(gem '(byebug|web-console|sdoc|jbuilder)')/, "# \\1")
65+
66+
if @version.to_s < '5.2'
67+
c.gsub!(/(gem 'sqlite3')/, "# \\1")
68+
end
69+
6570
c
6671
end
6772

73+
if @version.to_s < '5.2'
74+
append_to_file(application.gemfile, "gem 'sqlite3', '< 1.4'")
75+
end
6876

6977
if application.path("bin").exist?
7078
FileUtils.cp_r(application.path("bin"), application.path("bin_original"))

0 commit comments

Comments
 (0)