Skip to content

Commit

Permalink
[WIP] Testing more basic snippet command
Browse files Browse the repository at this point in the history
  • Loading branch information
benoittgt committed Jan 14, 2021
1 parent 93753b5 commit 09dc769
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -34,7 +34,7 @@ MAJOR =

if MAJOR >= 6
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
gem 'sqlite3', '~> 1.4'
else
# Similarly, Rails 5.0 only supports '~> 1.3.6'. Rails 5.1-5.2 support '~> 1.3', '>= 1.3.6'
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]
Expand Down
11 changes: 2 additions & 9 deletions Rakefile
Expand Up @@ -228,15 +228,8 @@ desc "Run short, self-contained snippets"
task :snippets do
sh "echo Running snippets"
sh <<-SH
(cd snippets;
unset BUNDLE_GEMFILE
ruby use_active_record_false.rb
)
SH
# sh "echo Running #{snippet}"
# sh "ruby #{snippet}"
# end
# end
ruby snippets/use_active_record_false.rb
SH
end

task default: [:spec, :acceptance, :snippets]
Expand Down
26 changes: 22 additions & 4 deletions snippets/use_active_record_false.rb
@@ -1,16 +1,34 @@
require "bundler/inline"

MAJOR =
case ENV['RAILS_VERSION']
when /5-2-stable/
5
when /master/, /stable/, nil, false, ''
6
else
/(\d+)[\.|-]\d+/.match(ENV['RAILS_VERSION']).captures.first.to_i
end

gemfile(true) do
source "https://rubygems.org"

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

# Those Gemfiles carefully pick the right versions depending on
# settings in the ENV, `.rails-version` and `maintenance-branch`.
eval_gemfile '../Gemfile-rspec-dependencies'
eval_gemfile '../Gemfile-rails-dependencies'

gem "rspec-rails", path: "../"
eval_gemfile './Gemfile-rspec-dependencies'
eval_gemfile './Gemfile-rails-dependencies'

if MAJOR >= 6
# sqlite3 is an optional, unspecified, dependency and Rails 6.0 only supports `~> 1.4`
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
else
# Similarly, Rails 5.0 only supports '~> 1.3.6'. Rails 5.1-5.2 support '~> 1.3', '>= 1.3.6'
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]
end
gem "ammeter"
gem "rspec-rails", path: "./"
end

# Initialization
Expand Down

0 comments on commit 09dc769

Please sign in to comment.