ember-rails 0.20.1 → 0.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +75 -47
- data/lib/ember/rails/version.rb +1 -1
- data/lib/ember_rails.rb +1 -1
- data/lib/generators/templates/application.coffee +1 -1
- data/lib/generators/templates/application.em +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f884dda76b006c5e484702db711a89eb66383f8
|
4
|
+
data.tar.gz: 04f887b4a77881bbabd167968f379725447e043e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6de20b329d79707ce9f972647011a3385800c455c9199158a83ced2bb661cfa6f1df1984ff2239743e978d7923fbfe70331726fbf291c9126b239b5c347b99cc
|
7
|
+
data.tar.gz: af77ed9d289f6a8a39d17f1f8ef695d767a5ee8a94726df81b41531bd17cdb5e61638cfeeaecf012dbe2a175783af38d9701cbed2cadbd313bce09b29b677f66
|
data/README.md
CHANGED
@@ -14,14 +14,14 @@ You can see an example of how to use the gem [here](https://github.com/keithpitt
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
gem 'ember-rails'
|
17
|
-
gem 'ember-source'
|
17
|
+
# gem 'ember-source' # You can specify the Ember.js version you want to use.(such as '~> 1.13.0')
|
18
18
|
```
|
19
19
|
|
20
20
|
* Run `bundle install`
|
21
21
|
* Next, generate the application structure:
|
22
22
|
|
23
23
|
```shell
|
24
|
-
rails generate ember:bootstrap
|
24
|
+
$ rails generate ember:bootstrap
|
25
25
|
```
|
26
26
|
|
27
27
|
* Restart your server (if it's running)
|
@@ -32,8 +32,8 @@ Rails supports the ability to build projects from a template source ruby file.
|
|
32
32
|
|
33
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
|
35
|
+
```shell
|
36
|
+
$ rails new my-app -m http://emberjs.com/edge_template.rb
|
37
37
|
```
|
38
38
|
|
39
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).
|
@@ -45,13 +45,13 @@ examples in the [getting started guide](http://emberjs.com/guides/getting-starte
|
|
45
45
|
have been designed to use the released version of ember:
|
46
46
|
|
47
47
|
```shell
|
48
|
-
rails generate ember:install
|
48
|
+
$ rails generate ember:install
|
49
49
|
```
|
50
50
|
|
51
51
|
You'll probably need to clear out your cache after doing this with:
|
52
52
|
|
53
53
|
```shell
|
54
|
-
rake tmp:clear
|
54
|
+
$ rake tmp:clear
|
55
55
|
```
|
56
56
|
|
57
57
|
Also, ember-rails includes some flags for the bootstrap generator:
|
@@ -72,8 +72,8 @@ gem 'coffee-rails'
|
|
72
72
|
```
|
73
73
|
|
74
74
|
Run the bootstrap generator in step 4 with an extra flag instead:
|
75
|
-
```
|
76
|
-
rails g ember:bootstrap -g --javascript-engine coffee
|
75
|
+
```shell
|
76
|
+
$ rails g ember:bootstrap -g --javascript-engine coffee
|
77
77
|
```
|
78
78
|
|
79
79
|
## For EmberScript support
|
@@ -101,8 +101,8 @@ It is supported by [Babel](https://babeljs.io/) via [ember-es6_template](https:/
|
|
101
101
|
|
102
102
|
Run the bootstrap generator with an extra flag:
|
103
103
|
|
104
|
-
```
|
105
|
-
rails g ember:bootstrap --javascript-engine=es6
|
104
|
+
```shell
|
105
|
+
$ rails g ember:bootstrap --javascript-engine=es6
|
106
106
|
```
|
107
107
|
|
108
108
|
Note:
|
@@ -248,27 +248,29 @@ RailsAppName = Ember.Application.create();
|
|
248
248
|
|
249
249
|
*Example:*
|
250
250
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
251
|
+
```shell
|
252
|
+
$ rails g ember:bootstrap
|
253
|
+
insert app/assets/javascripts/application.js
|
254
|
+
create app/assets/javascripts/models
|
255
|
+
create app/assets/javascripts/models/.gitkeep
|
256
|
+
create app/assets/javascripts/controllers
|
257
|
+
create app/assets/javascripts/controllers/.gitkeep
|
258
|
+
create app/assets/javascripts/views
|
259
|
+
create app/assets/javascripts/views/.gitkeep
|
260
|
+
create app/assets/javascripts/helpers
|
261
|
+
create app/assets/javascripts/helpers/.gitkeep
|
262
|
+
create app/assets/javascripts/components
|
263
|
+
create app/assets/javascripts/components/.gitkeep
|
264
|
+
create app/assets/javascripts/templates
|
265
|
+
create app/assets/javascripts/templates/.gitkeep
|
266
|
+
create app/assets/javascripts/templates/components
|
267
|
+
create app/assets/javascripts/templates/components/.gitkeep
|
268
|
+
create app/assets/javascripts/mixins
|
269
|
+
create app/assets/javascripts/mixins/.gitkeep
|
270
|
+
create app/assets/javascripts/adapters
|
271
|
+
create app/assets/javascripts/adapters/.gitkeep
|
272
|
+
create app/assets/javascripts/app.js
|
273
|
+
```
|
272
274
|
|
273
275
|
If you want to avoid `.gitkeep` files, use the `skip git` option like
|
274
276
|
this: `rails g ember:bootstrap -g`.
|
@@ -278,11 +280,15 @@ by putting each template in a dedicated ".hbs", ".js.hjs" or ".handlebars" file
|
|
278
280
|
(e.g. `app/assets/javascripts/templates/admin_panel.hbs`)
|
279
281
|
and including the assets in your layout:
|
280
282
|
|
281
|
-
|
283
|
+
```erb
|
284
|
+
<%= javascript_include_tag "templates/admin_panel" %>
|
285
|
+
```
|
282
286
|
|
283
287
|
If you want to avoid the `templates` prefix, set the `templates_root` option in your application configuration block:
|
284
288
|
|
285
|
-
|
289
|
+
```ruby
|
290
|
+
config.handlebars.templates_root = 'ember_templates'
|
291
|
+
```
|
286
292
|
|
287
293
|
If you store templates in a file like `app/assets/javascripts/ember_templates/admin_panel.hbs` after setting the above config,
|
288
294
|
it will be made available to Ember as the `admin_panel` template.
|
@@ -292,18 +298,24 @@ _(Note: you must clear the local sprockets cache after modifying `templates_root
|
|
292
298
|
Default behavior for ember-rails is to precompile handlebars templates.
|
293
299
|
If you don't want this behavior you can turn it off in your application configuration (or per environment in: `config/environments/development.rb`) block:
|
294
300
|
|
295
|
-
|
301
|
+
```ruby
|
302
|
+
config.handlebars.precompile = false
|
303
|
+
```
|
296
304
|
|
297
305
|
_(Note: you must clear the local sprockets cache if you disable precompilation, stored by default in `tmp/cache/assets`)_
|
298
306
|
|
299
307
|
Bundle all templates together thanks to Sprockets,
|
300
308
|
e.g create `app/assets/javascripts/templates/all.js` with:
|
301
309
|
|
302
|
-
|
310
|
+
```js
|
311
|
+
//= require_tree .
|
312
|
+
```
|
303
313
|
|
304
314
|
Now a single line in the layout loads everything:
|
305
315
|
|
306
|
-
|
316
|
+
```erb
|
317
|
+
<%= javascript_include_tag "templates/all" %>
|
318
|
+
```
|
307
319
|
|
308
320
|
### Note about ember components
|
309
321
|
|
@@ -331,17 +343,23 @@ Given the following folder structure:
|
|
331
343
|
|
332
344
|
and a `my-component.hbs` file with the following contents:
|
333
345
|
|
334
|
-
|
346
|
+
```hbs
|
347
|
+
<h1>My Component</h1>
|
348
|
+
```
|
335
349
|
|
336
350
|
It will produce the following handlebars output:
|
337
351
|
|
338
|
-
|
339
|
-
|
340
|
-
|
352
|
+
```html
|
353
|
+
<script type="text/x-handlebars" id="components/my-component">
|
354
|
+
<h1>My Component</h1>
|
355
|
+
</script>
|
356
|
+
```
|
341
357
|
|
342
358
|
You can reference your component inside your other handlebars template files by the handlebars file name:
|
343
359
|
|
344
|
-
|
360
|
+
```hbs
|
361
|
+
{{ my-component }}
|
362
|
+
```
|
345
363
|
|
346
364
|
## Specifying Different Versions of Ember/Handlebars/Ember-Data
|
347
365
|
|
@@ -354,7 +372,9 @@ To specify a different version that'll be used for both template
|
|
354
372
|
precompilation and serving to the browser, you can specify the desired
|
355
373
|
version of one of the above-linked gems in the Gemfile, e.g.:
|
356
374
|
|
357
|
-
|
375
|
+
```ruby
|
376
|
+
gem 'ember-source', '~> 1.13.0'
|
377
|
+
```
|
358
378
|
|
359
379
|
You can also specify versions of 'handlebars-source' and
|
360
380
|
'ember-data-source', but note that an appropriate 'handlebars-source'
|
@@ -367,14 +387,18 @@ placing these files in `vendor/assets/ember/development` and
|
|
367
387
|
`vendor/assets/ember/production`, depending on the `config.ember.variant`
|
368
388
|
you've specified in your app's configuration, e.g.:
|
369
389
|
|
370
|
-
|
371
|
-
|
390
|
+
```ruby
|
391
|
+
config.ember.variant = :production
|
392
|
+
# config.ember.variant = :development
|
393
|
+
```
|
372
394
|
|
373
395
|
## Updating Ember
|
374
396
|
|
375
397
|
If at any point you need to update Ember.js from any of the release channels, you can do that with
|
376
398
|
|
377
|
-
|
399
|
+
```shell
|
400
|
+
$ rails generate ember:install --channel=<channel>
|
401
|
+
```
|
378
402
|
|
379
403
|
This will fetch both Ember.js and Ember Data from [http://builds.emberjs.com/](http://builds.emberjs.com/) and copy to the right directory. You can choose between the following channels:
|
380
404
|
* canary - This references the 'master' branch and is not recommended for production use.
|
@@ -385,11 +409,15 @@ When you don't specify a channel, the release channel is used.
|
|
385
409
|
|
386
410
|
It is also possible to download a specific tagged release. To do this, use the following syntax:
|
387
411
|
|
388
|
-
|
412
|
+
```shell
|
413
|
+
$ rails generate ember:install --tag=v1.13.0 --ember
|
414
|
+
```
|
389
415
|
|
390
416
|
or for ember-data
|
391
417
|
|
392
|
-
|
418
|
+
```shell
|
419
|
+
$ rails generate ember:install --tag=v1.13.0 --ember-data
|
420
|
+
```
|
393
421
|
|
394
422
|
## CSRF Token
|
395
423
|
|
data/lib/ember/rails/version.rb
CHANGED
data/lib/ember_rails.rb
CHANGED
@@ -18,7 +18,7 @@ module Ember
|
|
18
18
|
config.ember = ActiveSupport::OrderedOptions.new
|
19
19
|
config.ember.module_prefix = 'ember-app'
|
20
20
|
config.ember.prefix_files = %w(store router)
|
21
|
-
config.ember.prefix_dirs = %w(models controllers views routes components helpers mixins serializers adapters)
|
21
|
+
config.ember.prefix_dirs = %w(models controllers views routes components helpers mixins serializers adapters transforms)
|
22
22
|
|
23
23
|
generators do |app|
|
24
24
|
app.config.generators.assets = false
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#= require ember-data
|
7
7
|
#= require active-model-adapter
|
8
8
|
#= require_self
|
9
|
-
#= require
|
9
|
+
#= require ./<%= application_name.underscore.dasherize %>
|
10
10
|
|
11
11
|
# for more details see: http://emberjs.com/guides/application/
|
12
12
|
window.<%= application_name.camelize %> = Ember.Application.create()
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#= require ember-data
|
7
7
|
#= require active-model-adapter
|
8
8
|
#= require_self
|
9
|
-
#= require
|
9
|
+
#= require ./<%= application_name.underscore.dasherize %>
|
10
10
|
|
11
11
|
# for more details see: http://emberjs.com/guides/application/
|
12
12
|
window.<%= application_name.camelize %> = Ember.Application.create()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Pitt
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-03-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|