Skip to content

Commit

Permalink
Work with Sprockets 4
Browse files Browse the repository at this point in the history
  • Loading branch information
tricknotes committed Mar 24, 2017
1 parent 990753a commit 742af52
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ gemfile:
- gemfiles/rails50_ember_latest.gemfile
- gemfiles/rails51_ember_latest.gemfile
- gemfiles/sprockets_3.gemfile
- gemfiles/sprockets_4.gemfile
- gemfiles/sprockets_rails_3.gemfile
matrix:
exclude:
Expand All @@ -29,6 +30,8 @@ matrix:
gemfile: gemfiles/rails50_ember_latest.gemfile
- rvm: 2.1
gemfile: gemfiles/rails51_ember_latest.gemfile
- rvm: 2.1
gemfile: gemfiles/sprockets_4.gemfile
- rvm: jruby-9.1.0.0
gemfile: gemfiles/rails50_ember_113.gemfile
- rvm: jruby-9.1.0.0
Expand All @@ -37,5 +40,7 @@ matrix:
gemfile: gemfiles/rails50_ember_latest.gemfile
- rvm: jruby-9.1.0.0
gemfile: gemfiles/rails51_ember_latest.gemfile
- rvm: jruby-9.1.0.0
gemfile: gemfiles/sprockets_4.gemfile
env:
- JRUBY_OPTS="--server -J-Xms1500m -J-Xmx1500m -J-XX:+UseConcMarkSweepGC -J-XX:-UseGCOverheadLimit -J-XX:+CMSClassUnloadingEnabled" # see: https://github.com/jruby/jruby/issues/1320
7 changes: 7 additions & 0 deletions gemfiles/sprockets_4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

gem 'rails', '~> 5.0'
gem 'ember-source', '~> 2.0'
gem 'sprockets', '~> 4.0.0.beta4'

gemspec path: '../'
4 changes: 0 additions & 4 deletions lib/ember/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class Engine < ::Rails::Engine
config.handlebars.ember_template = Ember::VERSION =~ /\A1.[0-9]\./ ? 'Handlebars' : 'HTMLBars'
end

config.before_initialize do |app|
Sprockets::Engines #force autoloading
end

config.before_initialize do |app|
Ember::ES6Template.configure do |ember_config|
ember_config.module_prefix = config.ember.module_prefix
Expand Down
2 changes: 1 addition & 1 deletion lib/ember_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def configure_assets(app)

initializer "ember_rails.setup_ember_template_compiler", :after => "ember_rails.setup_vendor", :group => :all do |app|
configure_assets app do |env|
Ember::Handlebars::Template.setup_ember_template_compiler(env.resolve('ember-template-compiler.js'))
Ember::Handlebars::Template.setup_ember_template_compiler(env.find_asset('ember-template-compiler.js').filename)
end
end

Expand Down
13 changes: 8 additions & 5 deletions test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

config.eager_load = false

# Configure static asset server for tests with Cache-Control for performance
if Rails.version >= '4.2.0'
config.serve_static_files = true
if Rails::VERSION::MAJOR >= 5
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
else
config.serve_static_assets = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
end
config.static_cache_control = "public, max-age=3600"

# Log error messages when you accidentally call methods on nil
config.whiny_nils = true unless Rails.version >= '4.0.0'
Expand Down

0 comments on commit 742af52

Please sign in to comment.