Skip to content

Commit

Permalink
Test Multiple Rails versions with Appraisal
Browse files Browse the repository at this point in the history
Closes [tricknotes#302].

Configures project according to [Appraisal installation
instructions][appraisal].

[tricknotes#302]: tricknotes#302
[appraisal]: https://github.com/thoughtbot/appraisal
  • Loading branch information
seanpdoyle committed Nov 24, 2015
1 parent 8eec101 commit 753c4a6
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*.so
*.o
*.a
*.gemfile.lock
mkmf.log
/log/
spec/dummy/my-app/
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ before_install:
- echo '--colour' > ~/.rspec
- 'echo ''gem: --no-document'' > ~/.gemrc'
before_script: bin/setup
script: bin/rspec
script: bin/rake
env:
global:
secure: RbWKxwfpzyQ5uv/jYH68/0J3Y9xe7rQbGULsWZT98FxZcVWLoOFlPPITmnmEK32CjQUww8iMz50FRLxFNmXg8prt1KzpzikVdIZLmYg1NFShI8+JOFhJzwCuk/LLybNUmydejR58FJvV9gS8NYqMh5leFkDM3OwLxhWdcE8hDDQ=
gemfile:
- gemfiles/3.2.gemfile
- gemfiles/4.1.gemfile
- gemfiles/4.2.gemfile
11 changes: 11 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
appraise "3.2" do
gem "rails", git: "https://github.com/rails/rails.git", branch: "3-2-stable"
end

appraise "4.1" do
gem "rails", "~> 4.1.1"
end

appraise "4.2" do
gem "rails", "~> 4.2.1"
end
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source "https://rubygems.org"

gemspec

gem "appraisal"
gem "rails", "4.2.4"
gem "pry"

Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
require "rubygems"
require "bundler/setup"
require "bundler/gem_tasks"
require "appraisal"
require "rspec/core/rake_task"

task(:default).clear
task default: :spec

if defined? RSpec
task(:spec).clear
RSpec::Core::RakeTask.new(:spec) do |t|
t.verbose = false
end
end

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
task default: :appraisal
end
16 changes: 16 additions & 0 deletions bin/appraisal
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'appraisal' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('appraisal', 'appraisal')
16 changes: 16 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')
5 changes: 5 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ cd ${root}/spec/dummy/my-app &&
bower install

cd ${root}/spec/dummy && bundle exec rake ember:install

# Only if this isn't CI
if [ -z "$CI" ]; then
bin/appraisal install
fi
20 changes: 20 additions & 0 deletions gemfiles/3.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "test-unit", "~> 3.0"
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "3-2-stable"
gem "pry"

group :development, :test do
gem "high_voltage", "~> 2.4.0"
gem "rspec-rails", "~> 3.3.0"
end

group :test do
gem "poltergeist", "~> 1.8.0"
gem "codeclimate-test-reporter", :require => nil
end

gemspec :path => "../"
19 changes: 19 additions & 0 deletions gemfiles/4.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rails", "~> 4.1.1"
gem "pry"

group :development, :test do
gem "high_voltage", "~> 2.4.0"
gem "rspec-rails", "~> 3.3.0"
end

group :test do
gem "poltergeist", "~> 1.8.0"
gem "codeclimate-test-reporter", :require => nil
end

gemspec :path => "../"
19 changes: 19 additions & 0 deletions gemfiles/4.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rails", "~> 4.2.1"
gem "pry"

group :development, :test do
gem "high_voltage", "~> 2.4.0"
gem "rspec-rails", "~> 3.3.0"
end

group :test do
gem "poltergeist", "~> 1.8.0"
gem "codeclimate-test-reporter", :require => nil
end

gemspec :path => "../"
8 changes: 7 additions & 1 deletion lib/ember_cli/controller_extension.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
module EmberCli
module ControllerExtension
def self.included(base)
base.before_action do
build_ember_app = lambda do
app = params[:ember_app]

if app.present?
EmberCli[app].build
end
end

if base.respond_to?(:before_action)
base.before_action(&build_ember_app)
else
base.before_filter(&build_ember_app)
end
end
end
end

0 comments on commit 753c4a6

Please sign in to comment.