Skip to content

Commit 09dc769

Browse files
committed
[WIP] Testing more basic snippet command
1 parent 93753b5 commit 09dc769

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ MAJOR =
3434

3535
if MAJOR >= 6
3636
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
37-
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
37+
gem 'sqlite3', '~> 1.4'
3838
else
3939
# Similarly, Rails 5.0 only supports '~> 1.3.6'. Rails 5.1-5.2 support '~> 1.3', '>= 1.3.6'
4040
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]

Rakefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,8 @@ desc "Run short, self-contained snippets"
228228
task :snippets do
229229
sh "echo Running snippets"
230230
sh <<-SH
231-
(cd snippets;
232-
unset BUNDLE_GEMFILE
233-
ruby use_active_record_false.rb
234-
)
235-
SH
236-
# sh "echo Running #{snippet}"
237-
# sh "ruby #{snippet}"
238-
# end
239-
# end
231+
ruby snippets/use_active_record_false.rb
232+
SH
240233
end
241234

242235
task default: [:spec, :acceptance, :snippets]

snippets/use_active_record_false.rb

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
require "bundler/inline"
22

3+
MAJOR =
4+
case ENV['RAILS_VERSION']
5+
when /5-2-stable/
6+
5
7+
when /master/, /stable/, nil, false, ''
8+
6
9+
else
10+
/(\d+)[\.|-]\d+/.match(ENV['RAILS_VERSION']).captures.first.to_i
11+
end
12+
313
gemfile(true) do
414
source "https://rubygems.org"
515

616
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
717

818
# Those Gemfiles carefully pick the right versions depending on
919
# settings in the ENV, `.rails-version` and `maintenance-branch`.
10-
eval_gemfile '../Gemfile-rspec-dependencies'
11-
eval_gemfile '../Gemfile-rails-dependencies'
12-
13-
gem "rspec-rails", path: "../"
20+
eval_gemfile './Gemfile-rspec-dependencies'
21+
eval_gemfile './Gemfile-rails-dependencies'
22+
23+
if MAJOR >= 6
24+
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
25+
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
26+
else
27+
# Similarly, Rails 5.0 only supports '~> 1.3.6'. Rails 5.1-5.2 support '~> 1.3', '>= 1.3.6'
28+
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]
29+
end
30+
gem "ammeter"
31+
gem "rspec-rails", path: "./"
1432
end
1533

1634
# Initialization

0 commit comments

Comments
 (0)