ember-rails 0.14.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +141 -102
- data/lib/ember/rails/engine.rb +8 -5
- data/lib/ember/rails/version.rb +1 -1
- data/lib/ember_rails.rb +36 -16
- data/lib/generators/ember/adapter_generator.rb +21 -0
- data/lib/generators/ember/bootstrap_generator.rb +6 -3
- data/lib/generators/ember/component_generator.rb +2 -2
- data/lib/generators/ember/generator_helpers.rb +7 -5
- data/lib/generators/ember/install_generator.rb +64 -32
- data/lib/generators/ember/resource_override.rb +8 -2
- data/lib/generators/ember/template_generator.rb +2 -2
- data/lib/generators/templates/adapter.js +5 -0
- data/lib/generators/templates/adapter.js.coffee +5 -0
- data/lib/generators/templates/adapter.js.em +3 -0
- data/lib/generators/templates/app.js +2 -2
- data/lib/generators/templates/app.js.coffee +2 -1
- data/lib/generators/templates/app.js.em +3 -1
- data/lib/generators/templates/{application.handlebars → application.hbs} +0 -0
- data/lib/generators/templates/application.js +3 -2
- data/lib/generators/templates/application.js.coffee +3 -1
- data/lib/generators/templates/application.js.em +3 -1
- data/lib/generators/templates/application_adapter.js +5 -0
- data/lib/generators/templates/application_adapter.js.coffee +5 -0
- data/lib/generators/templates/application_adapter.js.em +3 -0
- data/lib/generators/templates/array_controller.js +1 -1
- data/lib/generators/templates/{component.template.handlebars → component.template.hbs} +0 -0
- data/lib/generators/templates/model.js +1 -1
- data/lib/generators/templates/model.js.coffee +1 -1
- data/lib/generators/templates/model.js.em +1 -1
- data/lib/generators/templates/{template.handlebars → template.hbs} +0 -0
- metadata +77 -103
- data/lib/ember/handlebars/template.rb +0 -113
- data/lib/generators/templates/store.js +0 -7
- data/lib/generators/templates/store.js.coffee +0 -6
- data/lib/generators/templates/store.js.em +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 857d69b6457718515597605b4b7a6fee74eea6b0
|
4
|
+
data.tar.gz: 054906e52dc2d3d04d9ae241c4cfde1871cff4df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8fd238eacab85e0de0658485283faf51469fda6227f5257d41aab71f31871d8ab601066a6f9d8c3f29724c62c91a2a80f75910912b271d4daf70ce8228172a7
|
7
|
+
data.tar.gz: 5e8ad49780dec29b586c2b9b37bda647477010f8f9434828f867abe545d4e30b7c7404bdba249243a7117134847c4c72dc9ff58cf4bd4075d8f314c7bd971160
|
data/README.md
CHANGED
@@ -1,23 +1,20 @@
|
|
1
|
-
# ember-rails [](http://travis-ci.org/emberjs/ember-rails) [](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
|
-
-
|
8
|
-
-
|
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.
|
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
|
-
|
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
|
-
|
69
|
+
Add coffee-rails to the Gemfile
|
53
70
|
```ruby
|
54
71
|
gem 'coffee-rails'
|
55
72
|
```
|
56
73
|
|
57
|
-
|
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
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
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
|
-
|
247
|
+
Given the following folder structure:
|
205
248
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
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
|
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.
|
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.
|
data/lib/ember/rails/engine.rb
CHANGED
@@ -5,12 +5,15 @@ require 'sprockets/railtie'
|
|
5
5
|
module Ember
|
6
6
|
module Rails
|
7
7
|
class Engine < ::Rails::Engine
|
8
|
-
|
8
|
+
Ember::Handlebars::Template.configure do |handlebars_config|
|
9
|
+
config.handlebars = handlebars_config
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
data/lib/ember/rails/version.rb
CHANGED
data/lib/ember_rails.rb
CHANGED
@@ -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 '
|
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.
|
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
|
-
#
|
27
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
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|
|