Commit 6339e082 by andrew morton

Setup some infrastructure for testing multiple rails versions

parents
# frozen_string_literal: true
# A sample Gemfile
source "https://rubygems.org"
# Allow the rails version to come from an ENV setting so Tavis can test multiple
# versions. Inspired by http://www.schneems.com/post/50991826838/testing-against-multiple-rails-versions/
rails_version = ENV['RAILS_VERSION'] || '3.2.22'
rails_major = rails_version.split('.').first
rails_gem = case rails_version
when "default" then
"~> 5.0.0"
else
"~> #{rails_version}"
end
gem 'rails', rails_gem
gem 'rspec-rails'
gem 'sqlite3'
# Need this for Rails 4 to get the JSON responses from the scaffold
gem 'jbuilder' if rails_major == '4'
#!/bin/bash
set -x
# export RAILS_VERSION=3.2.0
export RAILS_VERSION=4.0.0
# export RAILS_VERSION=5.0.0
major=$(echo $RAILS_VERSION | cut -d '.' -f1)
rm Gemfile.lock
bundle install
bundle exec rails new sandbox --skip-gemfile --api -d sqlite3 --skip-bundle --skip-action-mailer --skip-puma --skip-action-cable --skip-sprockets --skip-javascript --skip-spring --skip-listen
cd sandbox
bundle exec rails generate scaffold Post title:string body:text
if [ $major -eq 5 ]
then
bundle exec rails db:create
bundle exec rails db:migrate
else
bundle exec rake db:create
bundle exec rake db:migrate
fi
bundle exec rails server
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment