Skip to content

Commit 876720b

Browse files
committed
Add Rails 5 support
Closes [#376]. Required changes ---------------- Run test suite against the latest `5.0.0.betaX` and `master` branches of [`rails/rails`][rails]. Since `EmberController` extends `ApplicationController`, which can now extend from either `ActionController::Base` (which implements `helper_method`) and `ActionController::API` (which doesn't implement `helper_method`), we can't depend on that API existing. Remove call to `helper_method` from `EmberController`, as it is no longer supported. **Allow JRuby failures in CI** **Improve `setup_ember` script** * Don't overwrite `gemfiles/` changes with `appraisal install` * Localize Ember setup to `bin/setup_ember` * Always invoke, let `bin/setup_ember` decide whether or not to no-op **Fix `EmberCli::EmberController` inheritance** The `EmberCli::EmberController` used to inherit from `ApplicationController` in order to reap the benefits of application-wide configurations and behavior (such as authentication-based `before_action` calls and other macros). Unfortunately, with the introduction of Rails 5's `rails new --api`, applications' `ApplicationController` can now inherit from [`ActionController::API`][api], which doesn't serve HTML by default. To support Rails 5's default `--api` behavior, `EmberCli::EmberController` must inherit from `ActionController::Base`, forcing the controller to forfeit all the benefits of sharing behavior with `ApplicationController`. [api]: http://edgeapi.rubyonrails.org/classes/ActionController/API.html **Depend on `test-unit`** ``` Ruby 2.2+ has removed test/unit from the core library. Rails requires this as a dependency. Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'` (cannot load such file -- test/unit)" ``` Support changes --------------- Rails 5 depends on `[email protected]`, which **requires** Ruby `2.2.2` or greater. In order to support Rails 5, we will no longer support versions of Ruby prior to `2.2.2`. [#376]: #376 [rails]: https://github.com/rails/rails
1 parent 8746bf3 commit 876720b

File tree

18 files changed

+102
-60
lines changed

18 files changed

+102
-60
lines changed

.travis.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ cache: bundler
44
notifications:
55
email: false
66
rvm:
7-
- 2.3.0
8-
- 2.2
9-
- 2.1
10-
- jruby-9.0.3.0
7+
- 2.3.0
8+
- 2.2.2
9+
- jruby-9.0.3.0
1110
before_install:
12-
- echo '--colour' > ~/.rspec
13-
- 'echo ''gem: --no-document'' > ~/.gemrc'
11+
- echo '--colour' > ~/.rspec
12+
- 'echo ''gem: --no-document'' > ~/.gemrc'
1413
before_script: bin/setup
1514
script: bin/rake
1615
env:
@@ -19,3 +18,8 @@ env:
1918
gemfile:
2019
- gemfiles/4.1.gemfile
2120
- gemfiles/4.2.gemfile
21+
- gemfiles/5.0.0.gemfile
22+
- gemfiles/master.gemfile
23+
matrix:
24+
allow_failures:
25+
- rvm: jruby-9.0.3.0

Appraisals

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
appraise "3.2" do
2-
gem "rails", git: "https://github.com/rails/rails.git", branch: "3-2-stable"
3-
end
4-
51
appraise "4.1" do
62
gem "rails", "~> 4.1.1"
73
end
84

95
appraise "4.2" do
106
gem "rails", "~> 4.2.1"
117
end
8+
9+
appraise "5.0.0" do
10+
gem "rails", "5.0.0"
11+
end
12+
13+
appraise "master" do
14+
gem "rails", git: "https://github.com/rails/rails.git", branch: "master"
15+
end

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
master
22
------
33

4+
* `EmberCli::EmberController` now inherits from `ActionController::Base` instead
5+
of `ApplicationController`. [#400]
6+
* Remove support for Ruby 2.1.x. [#400]
47
* Don't route requests to `/rails/info` through the mounted Ember application.
58

69
0.7.4
@@ -33,6 +36,7 @@ master
3336
* `EmberCli::Deploy::File` serves assets with Rails' `static_cache_control`
3437
value. [#403]
3538

39+
[#400]: https://github.com/thoughtbot/ember-cli-rails/pull/400
3640
[#396]: https://github.com/thoughtbot/ember-cli-rails/pull/396
3741
[#403]: https://github.com/thoughtbot/ember-cli-rails/pull/403
3842

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ gem "rails", "4.2.4"
77
gem "pry"
88

99
group :development, :test do
10-
gem "high_voltage", "~> 2.4.0"
11-
gem "rspec-rails", "~> 3.3.0"
10+
gem "high_voltage", "~> 3.0.0"
11+
gem "rspec-rails", "~> 3.5.0"
1212
end
1313

1414
group :test do

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ This project supports:
630630

631631
This project supports:
632632

633-
* Ruby versions `>= 2.1.0`
633+
* Ruby versions `>= 2.2.0`
634634
* Rails versions `>=4.1.x`.
635635

636636
To learn more about supported versions and upgrades, read the [upgrading guide].

UPGRADING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Additionally, this codebase makes use of [(required) keyword arguments][kwargs].
88
From `[email protected]` and on, we will no longer support versions of Ruby
99
prior to `2.1.0`.
1010

11+
`[email protected]` adds support for Rails 5, which depends on `[email protected]`,
12+
which **requires** Ruby `2.2.2` or greater.
13+
14+
From `[email protected]` and on, we will no longer support versions of Ruby
15+
prior to `2.2.2`.
16+
1117
To use `ember-cli-rails` with older versions of Ruby, try the `0.3.x` series.
1218

1319
[kwargs]: https://robots.thoughtbot.com/ruby-2-keyword-arguments

app/controller/ember_cli/ember_controller.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,5 @@ class EmberController < ::ApplicationController
33
def index
44
render layout: false
55
end
6-
7-
def ember_app
8-
params[:ember_app]
9-
end
10-
helper_method :ember_app
116
end
127
end

app/helpers/ember_rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ def render_ember_app(name, &block)
88

99
head, body = markup_capturer.capture
1010

11-
render html: EmberCli[name].index_html(head: head, body: body).html_safe
11+
render text: EmberCli[name].index_html(head: head, body: body).html_safe
1212
end
1313
end

app/views/ember_cli/ember/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<%= render_ember_app ember_app do |head| %>
1+
<%= render_ember_app params[:ember_app] do |head| %>
22
<% head.append do %>
33
<%= csrf_meta_tags %>
44
<% end %>

bin/clean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
rm -rf spec/dummy/my-app
5+
rm -rf spec/dummy/{my-app,tmp}

0 commit comments

Comments
 (0)