ember-rails 0.14.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +141 -102
  3. data/lib/ember/rails/engine.rb +8 -5
  4. data/lib/ember/rails/version.rb +1 -1
  5. data/lib/ember_rails.rb +36 -16
  6. data/lib/generators/ember/adapter_generator.rb +21 -0
  7. data/lib/generators/ember/bootstrap_generator.rb +6 -3
  8. data/lib/generators/ember/component_generator.rb +2 -2
  9. data/lib/generators/ember/generator_helpers.rb +7 -5
  10. data/lib/generators/ember/install_generator.rb +64 -32
  11. data/lib/generators/ember/resource_override.rb +8 -2
  12. data/lib/generators/ember/template_generator.rb +2 -2
  13. data/lib/generators/templates/adapter.js +5 -0
  14. data/lib/generators/templates/adapter.js.coffee +5 -0
  15. data/lib/generators/templates/adapter.js.em +3 -0
  16. data/lib/generators/templates/app.js +2 -2
  17. data/lib/generators/templates/app.js.coffee +2 -1
  18. data/lib/generators/templates/app.js.em +3 -1
  19. data/lib/generators/templates/{application.handlebars → application.hbs} +0 -0
  20. data/lib/generators/templates/application.js +3 -2
  21. data/lib/generators/templates/application.js.coffee +3 -1
  22. data/lib/generators/templates/application.js.em +3 -1
  23. data/lib/generators/templates/application_adapter.js +5 -0
  24. data/lib/generators/templates/application_adapter.js.coffee +5 -0
  25. data/lib/generators/templates/application_adapter.js.em +3 -0
  26. data/lib/generators/templates/array_controller.js +1 -1
  27. data/lib/generators/templates/{component.template.handlebars → component.template.hbs} +0 -0
  28. data/lib/generators/templates/model.js +1 -1
  29. data/lib/generators/templates/model.js.coffee +1 -1
  30. data/lib/generators/templates/model.js.em +1 -1
  31. data/lib/generators/templates/{template.handlebars → template.hbs} +0 -0
  32. metadata +77 -103
  33. data/lib/ember/handlebars/template.rb +0 -113
  34. data/lib/generators/templates/store.js +0 -7
  35. data/lib/generators/templates/store.js.coffee +0 -6
  36. data/lib/generators/templates/store.js.em +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 916d617e38b6defe34e9a4fda6e864399d699a44
4
- data.tar.gz: f4cf0a357c14a700944c601a5ef20b433a471b46
3
+ metadata.gz: 857d69b6457718515597605b4b7a6fee74eea6b0
4
+ data.tar.gz: 054906e52dc2d3d04d9ae241c4cfde1871cff4df
5
5
  SHA512:
6
- metadata.gz: 3f1dd4bc588c9fe62bd10e04d19424cab5a28ed601e890d965f2be2b5a18b010113601e1f2058d688e71c49e20cd56b21ec302c6965040fb2ce01687b73fa9b6
7
- data.tar.gz: d9614b02448d13537139e0f2bcbaec40dc7f7857252a6181ddcdd2cc40993a1e38a215f1fd66458c3a8c33e352a0466842501fb705fd92ca45cfb83dc58d95de
6
+ metadata.gz: e8fd238eacab85e0de0658485283faf51469fda6227f5257d41aab71f31871d8ab601066a6f9d8c3f29724c62c91a2a80f75910912b271d4daf70ce8228172a7
7
+ data.tar.gz: 5e8ad49780dec29b586c2b9b37bda647477010f8f9434828f867abe545d4e30b7c7404bdba249243a7117134847c4c72dc9ff58cf4bd4075d8f314c7bd971160
data/README.md CHANGED
@@ -1,23 +1,20 @@
1
- # ember-rails [![Build Status](https://secure.travis-ci.org/emberjs/ember-rails.png?branch=master)](http://travis-ci.org/emberjs/ember-rails) [![Dependency Status](https://gemnasium.com/emberjs/ember-rails.png)](https://gemnasium.com/emberjs/ember-rails)
1
+ # ember-rails [![Build Status](https://secure.travis-ci.org/emberjs/ember-rails.svg?branch=master)](http://travis-ci.org/emberjs/ember-rails) [![Dependency Status](https://gemnasium.com/emberjs/ember-rails.png)](https://gemnasium.com/emberjs/ember-rails)
2
2
 
3
3
  ember-rails makes developing an [Ember.JS](http://emberjs.com/) application much easier in Rails 3.1+.
4
4
 
5
5
  The following functionalities are included in this gem:
6
6
  - Pre-compiling of your handlebars templates when building your asset pipeline.
7
- - Includes development and production copies of Ember, [Ember Data](https://github.com/emberjs/data) and [Handlebars](https://github.com/wycats/handlebars.js).
8
- - Includes [ActiveModel::Serializer](https://github.com/rails-api/active_model_serializers) for integration with Ember Data.
7
+ - Inclusion of development and production copies of Ember, [Ember Data](https://github.com/emberjs/data) and [Handlebars](https://github.com/wycats/handlebars.js).
8
+ - Inclusion of [ActiveModel::Serializer](https://github.com/rails-api/active_model_serializers) for integration with Ember Data.
9
9
 
10
- You can see an example of how to use the gem [here](https://github.com/keithpitt/ember-rails-example). There is also a great tutorial by [Dan Gebhardt](https://twitter.com/#!/dgeb) called "[Beginning Ember.js on Rails](http://www.cerebris.com/blog/2012/01/24/beginning-ember-js-on-rails-part-1/)" which is a great read if you're just starting out with Rails and Ember.js
10
+ You can see an example of how to use the gem [here](https://github.com/keithpitt/ember-rails-example). There is also a great tutorial by [Dan Gebhardt](https://twitter.com/#!/dgeb) called "[Beginning Ember.js on Rails](http://www.cerebris.com/blog/2012/01/24/beginning-ember-js-on-rails-part-1/)" which is a great read if you're just starting out with Rails and Ember.js.
11
11
 
12
12
  ## Getting started
13
13
  * Add the gem to your application Gemfile:
14
14
 
15
15
  ```ruby
16
16
  gem 'ember-rails'
17
- gem 'ember-source', '1.1.2' # or the version you need
18
-
19
- # optional since Handlebars 1.0.0 was released
20
- #gem 'handlebars-source', '~> 1.0.12' # or the version you need
17
+ gem 'ember-source', '~> 1.9.0' # or the version you need
21
18
  ```
22
19
 
23
20
  * Run `bundle install`
@@ -29,9 +26,19 @@ rails generate ember:bootstrap
29
26
 
30
27
  * Restart your server (if it's running)
31
28
 
29
+ ## Building a new project from scratch
32
30
 
33
- Notes:
31
+ Rails supports the ability to build projects from a template source ruby file.
32
+
33
+ To build an Ember centric Rails project you can simply type the following into your command line:
34
34
 
35
+ ```
36
+ rails new my_app -m http://emberjs.com/edge_template.rb
37
+ ```
38
+
39
+ Read more about [Rails application templates](http://edgeguides.rubyonrails.org/rails_application_templates.html) and take a look at the edge_template.rb [source code](https://github.com/emberjs/website/blob/master/source/edge_template.rb).
40
+
41
+ Notes:
35
42
 
36
43
  To install the latest builds of ember and ember-data. It should be noted that the
37
44
  examples in the [getting started guide](http://emberjs.com/guides/getting-started/)
@@ -41,35 +48,34 @@ have been designed to use the released version of ember:
41
48
  rails generate ember:install
42
49
  ```
43
50
 
44
- You'll probably need to clear out your cache after doing this with
51
+ You'll probably need to clear out your cache after doing this with:
45
52
 
46
53
  ```shell
47
54
  rake tmp:clear
48
55
  ```
49
56
 
57
+ Also, ember-rails includes some flags for the bootstrap generator:
58
+
59
+ ```
60
+ --ember-path or -d # custom ember path
61
+ --skip-git or -g # skip git keeps
62
+ --javascript-engine # engine for javascript (js, coffee or em)
63
+ --app-name or -n # custom ember app name
64
+ ```
65
+
66
+
50
67
  ## For CoffeeScript support
51
68
 
52
- 1. Add coffee-rails to the Gemfile
69
+ Add coffee-rails to the Gemfile
53
70
  ```ruby
54
71
  gem 'coffee-rails'
55
72
  ```
56
73
 
57
- 2. Run the bootstrap generator in step 4 with an extra flag instead:
74
+ Run the bootstrap generator in step 4 with an extra flag instead:
58
75
  ```sh
59
76
  rails g ember:bootstrap -g --javascript-engine coffee
60
77
  ```
61
78
 
62
- Note:
63
-
64
- Ember-rails include some flags options for bootstrap generator:
65
-
66
- ```
67
- --ember-path or -d # custom ember path
68
- --skip-git or -g # skip git keeps
69
- --javascript-engine # engine for javascript (js or coffee)
70
- --app-name or -n # custom ember app name
71
- ```
72
-
73
79
  ## For EmberScript support
74
80
 
75
81
  [EmberScript](http://www.emberscript.com) is a dialect of CoffeeScript
@@ -88,45 +94,90 @@ You can now use the flag `--javascript-engine=em` to specify EmberScript
88
94
  assets in your generators, but all of the generators will default to
89
95
  using an EmberScript variant first.
90
96
 
97
+ Note:
98
+
99
+ Ember-rails include some flags options for bootstrap generator:
100
+
101
+ ```
102
+ --ember-path or -d # custom ember path
103
+ --skip-git or -g # skip git keeps
104
+ --javascript-engine # engine for javascript (js, coffee or em)
105
+ --app-name or -n # custom ember app name
106
+ ```
107
+
91
108
  ## Configuration Options
92
109
 
93
- The following options are availabe for configuration in your application or environment level
110
+ The following options are available for configuration in your application or environment-level
94
111
  config files (`config/application.rb`, `config/environments/development.rb`, etc.):
95
112
 
96
- * `config.ember.variant` - Used to determine which Ember variant to use. Valid options: `:development`, `:production`.
97
- * `config.ember.app_name` - Used to specify a default application name for all generators.
98
- * `config.ember.ember_path` - Used to specify a default custom root path for all generators.
99
- * `config.handlebars.precompile` - Used to enable or disable precompilation. Default value: `true`.
100
- * `config.handlebars.templates_root` - Set the root path (under `app/assets/javascripts`) for templates
101
- to be looked up in. Default value: `"templates"`.
102
- * `config.handlebars.templates_path_separator` - The path separator to use for templates. Default value: `'/'`.
103
- * `config.handlebars.output_type` - Configures the style of output (options are `:amd` and `:global`).
104
- Default value: `:global`.
113
+ | Configuration Option | Description |
114
+ |----------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
115
+ | `config.ember.variant` | Determines which Ember variant to use. Valid options: `:development`, `:production`. Defaults to `:production` in production, and `:development` everywhere else. |
116
+ | `config.ember.app_name` | Specificies a default application name for all generators. |
117
+ | `config.ember.ember_path` | Specifies a default custom root path for all generators. |
118
+ | `config.handlebars.precompile` | Enables or disables precompilation. Default value: `true`. |
119
+ | `config.handlebars.templates_root` | Sets the root path (under `app/assets/javascripts`) for templates to be looked up in. Default value: `"templates"`. |
120
+ | `config.handlebars.templates_path_separator` | The path separator to use for templates. Default value: `'/'`. |
121
+ | `config.handlebars.output_type` | Configures the style of output (options are `:amd` and `:global`). Default value: `:global`. |
122
+ | `config.handlebars.amd_namespace` | Configures the module prefix for AMD formatted output. Default value: `nil`. |
123
+ | `config.handlebars.ember_template` | Default which Ember template type to compile. Valid options: `'Handlebars', `HTMLBars`. Defaults to 'Handlebars`' when `Ember::VERSION` is under 1.10.0, `HTMLBars` when `Ember::VERSION` is over 1.10.0. |
124
+
125
+ Note:
126
+
127
+ In a mountable engine, ember-rails will not recognize any configurations.
128
+ Instead, use command line options.
129
+
130
+ ## Enabling Features with Feature Flags
131
+ See [the guide](http://emberjs.com/guides/configuring-ember/feature-flags/#toc_flagging-details) and check [features.json](https://github.com/emberjs/ember.js/blob/master/features.json) for the version of Ember you're using.
132
+
133
+ If a feature is set to false, you will need to compile ember from source yourself to include it.
134
+
135
+ ### Important note for projects that render JSON responses
136
+
137
+ ember-rails includes [active_model_serializers](https://github.com/rails-api/active_model_serializers) which affects how ActiveModel and ActiveRecord objects get serialized to JSON, such as when using `render json:` or `respond_with`. By default active_model_serializers adds root elements to these responses (such as adding `{"posts": [...]}` for `render json: @posts`) which will affect the structure of your JSON responses.
138
+
139
+ To disable this effect on your JSON responses, put this in an initializer:
140
+ ```Ruby
141
+ # Stop active_model_serializers from adding root elements to JSON responses.
142
+ ActiveModel::Serializer.root = false
143
+ ActiveModel::ArraySerializer.root = false
144
+ ```
145
+
146
+ See the [active_model_serializers](https://github.com/rails-api/active_model_serializers) documentation for a more complete understanding of other effects this dependency might have on your app.
105
147
 
106
148
  ## Architecture
107
149
 
108
150
  Ember does not require an organized file structure. However, ember-rails allows you
109
151
  to use `rails g ember:bootstrap` to create the following directory structure under `app/assets/javascripts`:
110
152
 
111
- controllers/
112
- helpers/
113
- components/
114
- models/
115
- routes/
116
- templates/
117
- templates/components
118
- views/
153
+ ```
154
+ ├── adapters
155
+ ├── components
156
+ ├── controllers
157
+ ├── helpers
158
+ ├── mixins
159
+ ├── models
160
+ ├── practicality.js.coffee
161
+ ├── router.js.coffee
162
+ ├── routes
163
+ ├── store.js.coffee
164
+ ├── templates
165
+ │ └── components
166
+ └── views
167
+ ```
119
168
 
120
169
  Additionally, it will add the following lines to `app/assets/javascripts/application.js`.
121
170
  By default, it uses the Rails Application's name and creates an `rails_app_name.js`
122
- file to setup application namespace and initial requires:
123
-
124
- //= require handlebars
125
- //= require ember
126
- //= require ember-data
127
- //= require_self
128
- //= require rails_app_name
129
- RailsAppName = Ember.Application.create();
171
+ file to set up application namespace and initial requires:
172
+
173
+ ```javascript
174
+ //= require handlebars
175
+ //= require ember
176
+ //= require ember-data
177
+ //= require_self
178
+ //= require rails_app_name
179
+ RailsAppName = Ember.Application.create();
180
+ ```
130
181
 
131
182
  *Example:*
132
183
 
@@ -146,6 +197,10 @@ file to setup application namespace and initial requires:
146
197
  create app/assets/javascripts/templates/.gitkeep
147
198
  create app/assets/javascripts/templates/components
148
199
  create app/assets/javascripts/templates/components/.gitkeep
200
+ create app/assets/javascripts/mixins
201
+ create app/assets/javascripts/mixins/.gitkeep
202
+ create app/assets/javascripts/adapters
203
+ create app/assets/javascripts/adapters/.gitkeep
149
204
  create app/assets/javascripts/app.js
150
205
 
151
206
  If you want to avoid `.gitkeep` files, use the `skip git` option like
@@ -158,8 +213,7 @@ and including the assets in your layout:
158
213
 
159
214
  <%= javascript_include_tag "templates/admin_panel" %>
160
215
 
161
- If you want to strip template root from template names, add `templates_root` option to your application configuration block.
162
- By default, `templates_root` is `'templates'`.
216
+ If you want to avoid the `templates` prefix, set the `templates_root` option in your application configuration block:
163
217
 
164
218
  config.handlebars.templates_root = 'ember_templates'
165
219
 
@@ -184,40 +238,36 @@ Now a single line in the layout loads everything:
184
238
 
185
239
  <%= javascript_include_tag "templates/all" %>
186
240
 
187
- If you use Slim or Haml templates, you can use handlebars filter :
188
-
189
- handlebars:
190
- <button {{action anActionName}}>OK</button>
191
-
192
- It will be translated as :
193
-
194
- <script type="text/x-handlebars">
195
- <button {{action anActionName}}>OK</button>
196
- </script>
197
-
198
241
  ### Note about ember components
199
242
 
200
243
  When necessary, ember-rails adheres to a conventional folder structure. To create an ember component you must define the handlebars file *inside* the *components* folder under the templates folder of your project to properly register your handlebars component file.
201
244
 
202
245
  *Example*
203
246
 
204
- With the following folder structure:
247
+ Given the following folder structure:
205
248
 
206
- components/
207
- controllers/
208
- helpers/
209
- models/
210
- routes/
211
- templates/
212
- components/
213
- my-component.handlebars
214
- views/
249
+ ```
250
+ ├── adapters
251
+ ├── components
252
+ ├── controllers
253
+ ├── helpers
254
+ ├── mixins
255
+ ├── models
256
+ ├── practicality.js.coffee
257
+ ├── router.js.coffee
258
+ ├── routes
259
+ ├── store.js.coffee
260
+ ├── templates
261
+ │ └── components
262
+ │ └── my-component.handlebars
263
+ └── views
264
+ ```
215
265
 
216
- and a *my-component.handlebars* file with the following contents
266
+ and a `my-component.handlebars` file with the following contents:
217
267
 
218
268
  <h1>My Component</h1>
219
269
 
220
- will produce the following handlebars output
270
+ It will produce the following handlebars output:
221
271
 
222
272
  <script type="text/x-handlebars" id="components/my-component">
223
273
  <h1>My Component</h1>
@@ -227,33 +277,6 @@ You can reference your component inside your other handlebars template files by
227
277
 
228
278
  {{ my-component }}
229
279
 
230
- ### A note about upgrading ember-rails and components
231
- The ember-rails project now includes generators for components. If you have an exisitng project and need
232
- to compile component files you will need to include the components folder as part of the asset pipeline.
233
- A typical project expects two folders for *components* related code:
234
-
235
- * `assets/javascripts/components/` to hold the component javascript source
236
- * `assets/javascripts/templates/components/` to hold the handlebars templates for your components
237
-
238
- Your asset pipeline require statements should include reference to both e.g.
239
-
240
- RailsAppName.js
241
- ```
242
- //= require_tree ./templates
243
- //= require_tree ./components
244
- ```
245
-
246
- or
247
-
248
- RailsAppName.js.coffee
249
- ```
250
- #= require_tree ./templates
251
- #= require_tree ./components
252
- ```
253
-
254
- These are automatically generated for you in new projects you when you run the `ember:bootstrap` generator.
255
-
256
-
257
280
  ## Specifying Different Versions of Ember/Handlebars/Ember-Data
258
281
 
259
282
  By default, ember-rails ships with the latest version of
@@ -265,7 +288,7 @@ To specify a different version that'll be used for both template
265
288
  precompilation and serving to the browser, you can specify the desired
266
289
  version of one of the above-linked gems in the Gemfile, e.g.:
267
290
 
268
- gem 'ember-source', '1.0.0'
291
+ gem 'ember-source', '1.7.0'
269
292
 
270
293
  You can also specify versions of 'handlebars-source' and
271
294
  'ember-data-source', but note that an appropriate 'handlebars-source'
@@ -303,6 +326,22 @@ or for ember-data
303
326
 
304
327
  rails generate ember:install --tag=v1.0.0-beta.2 --ember-data
305
328
 
329
+ ## CSRF Token
330
+
331
+ Rails [`protect_from_forgery`](http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html#method-i-protect_from_forgery) requires CSRF token for every XHR except GET.
332
+ The CSRF token is normally found in `app/views/layouts/application.html.*` inserted with the rails helper: [`csrf_meta_tags`](http://api.rubyonrails.org/classes/ActionView/Helpers/CsrfHelper.html#method-i-csrf_meta_tags).
333
+
334
+ When you use [jquery-ujs](https://github.com/rails/jquery-ujs),
335
+ the CSRF token will be sent to the rails application on every XHR automatically.
336
+ If not so, the following JavaScript is required in your code.
337
+
338
+ ``` javascript
339
+ $.ajaxPrefilter(function(options, originalOptions, xhr) {
340
+ var token = $('meta[name="csrf-token"]').attr('content');
341
+ xhr.setRequestHeader('X-CSRF-Token', token);
342
+ });
343
+ ```
344
+
306
345
  ## Note on Patches/Pull Requests
307
346
 
308
347
  1. Fork the project.
@@ -5,12 +5,15 @@ require 'sprockets/railtie'
5
5
  module Ember
6
6
  module Rails
7
7
  class Engine < ::Rails::Engine
8
- config.handlebars = ActiveSupport::OrderedOptions.new
8
+ Ember::Handlebars::Template.configure do |handlebars_config|
9
+ config.handlebars = handlebars_config
9
10
 
10
- config.handlebars.precompile = true
11
- config.handlebars.templates_root = "templates"
12
- config.handlebars.templates_path_separator = '/'
13
- config.handlebars.output_type = :global
11
+ config.handlebars.precompile = true
12
+ config.handlebars.templates_root = 'templates'
13
+ config.handlebars.templates_path_separator = '/'
14
+ config.handlebars.output_type = :global
15
+ config.handlebars.ember_template = Ember::VERSION =~ /\A1.[0-9]\./ ? 'Handlebars' : 'HTMLBars'
16
+ end
14
17
 
15
18
  config.before_initialize do |app|
16
19
  Sprockets::Engines #force autoloading
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module Rails
3
- VERSION = '0.14.0'
3
+ VERSION = '0.18.0'
4
4
  end
5
5
  end
@@ -1,9 +1,15 @@
1
1
  require 'rails'
2
- require 'ember/rails/version'
3
- require 'ember/rails/engine'
4
2
  require 'ember/source'
5
3
  require 'ember/data/source'
6
- require 'handlebars/source'
4
+ require 'ember/rails/version'
5
+ require 'ember/rails/engine'
6
+
7
+ # Use handlebars if it possible. Because it is an optional feature.
8
+ begin
9
+ require 'handlebars/source'
10
+ rescue LoadError => e
11
+ raise e unless e.message == 'cannot load such file -- handlebars/source'
12
+ end
7
13
 
8
14
  module Ember
9
15
  module Rails
@@ -20,25 +26,39 @@ module Ember
20
26
  require "generators/ember/resource_override"
21
27
  end
22
28
 
23
- initializer "ember_rails.setup_vendor", :after => "ember_rails.setup", :group => :all do |app|
29
+ initializer "ember_rails.setup_vendor_on_locale", :after => "ember_rails.setup", :group => :all do |app|
24
30
  variant = app.config.ember.variant || (::Rails.env.production? ? :production : :development)
25
31
 
26
- # Copy over the desired ember, ember-data, and handlebars bundled in
27
- # ember-source, ember-data-source, and handlebars-source to a tmp folder.
32
+ # Allow a local variant override
33
+ ember_path = app.root.join("vendor/assets/ember/#{variant}")
34
+ app.assets.prepend_path(ember_path.to_s) if ember_path.exist?
35
+ end
36
+
37
+ initializer "ember_rails.copy_vendor_to_local", :after => "ember_rails.setup", :group => :all do |app|
38
+ variant = app.config.ember.variant || (::Rails.env.production? ? :production : :development)
39
+
40
+ # Copy over the desired ember and ember-data bundled in
41
+ # ember-source and ember-data-source to a tmp folder.
28
42
  tmp_path = app.root.join("tmp/ember-rails")
29
- ext = variant == :production ? ".prod.js" : ".js"
30
43
  FileUtils.mkdir_p(tmp_path)
31
- FileUtils.cp(::Ember::Source.bundled_path_for("ember#{ext}"), tmp_path.join("ember.js"))
32
- FileUtils.cp(::Ember::Data::Source.bundled_path_for("ember-data#{ext}"), tmp_path.join("ember-data.js"))
33
- app.assets.append_path(tmp_path)
34
44
 
35
- # Make the handlebars.js and handlebars.runtime.js bundled
36
- # in handlebars-source available.
37
- app.assets.append_path(File.expand_path('../', ::Handlebars::Source.bundled_path))
45
+ if variant == :production
46
+ ember_ext = ".prod.js"
47
+ else
48
+ ember_ext = ".debug.js"
49
+ ember_ext = ".js" unless File.exist?(::Ember::Source.bundled_path_for("ember#{ember_ext}")) # Ember.js 1.9.0 or earlier has no "ember.debug.js"
50
+ end
51
+ FileUtils.cp(::Ember::Source.bundled_path_for("ember#{ember_ext}"), tmp_path.join("ember.js"))
52
+ ember_data_ext = variant == :production ? ".prod.js" : ".js"
53
+ FileUtils.cp(::Ember::Data::Source.bundled_path_for("ember-data#{ember_data_ext}"), tmp_path.join("ember-data.js"))
38
54
 
39
- # Allow a local variant override
40
- ember_path = app.root.join("vendor/assets/ember/#{variant}")
41
- app.assets.prepend_path(ember_path.to_s) if ember_path.exist?
55
+ app.assets.append_path(tmp_path)
56
+ end
57
+
58
+ initializer "ember_rails.setup_vendor", :after => "ember_rails.copy_vendor_to_local", :group => :all do |app|
59
+ app.assets.append_path(::Ember::Source.bundled_path_for(nil))
60
+ app.assets.append_path(::Ember::Data::Source.bundled_path_for(nil))
61
+ app.assets.append_path(File.expand_path('../', ::Handlebars::Source.bundled_path)) if defined?(::Handlebars::Source)
42
62
  end
43
63
 
44
64
  initializer "ember_rails.es5_default", :group => :all do |app|