ember-rails 0.19.3 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -14
- data/app/assets/javascripts/ember-rails/application.module.es6 +20 -0
- data/app/assets/javascripts/ember-rails/module_prefix.module.es6.erb +1 -0
- data/app/assets/javascripts/ember-rails/shims.js +11 -0
- data/lib/ember/rails/engine.rb +10 -1
- data/lib/ember/rails/version.rb +1 -1
- data/lib/ember_rails.rb +21 -2
- data/lib/generators/ember/adapter_generator.rb +1 -1
- data/lib/generators/ember/bootstrap_generator.rb +11 -4
- data/lib/generators/ember/component_generator.rb +2 -2
- data/lib/generators/ember/controller_generator.rb +1 -1
- data/lib/generators/ember/generator_helpers.rb +18 -1
- data/lib/generators/ember/model_generator.rb +1 -1
- data/lib/generators/ember/resource_generator.rb +1 -2
- data/lib/generators/ember/route_generator.rb +1 -1
- data/lib/generators/ember/template_generator.rb +1 -3
- data/lib/generators/ember/view_generator.rb +1 -1
- data/lib/generators/templates/{adapter.js.coffee → adapter.coffee} +0 -0
- data/lib/generators/templates/{adapter.js.em → adapter.em} +0 -0
- data/lib/generators/templates/{app.js.coffee → app.coffee} +0 -0
- data/lib/generators/templates/{app.js.em → app.em} +0 -0
- data/lib/generators/templates/app.module.es6 +17 -0
- data/lib/generators/templates/{application.js.coffee → application.coffee} +1 -0
- data/lib/generators/templates/{application.js.em → application.em} +1 -0
- data/lib/generators/templates/application.es6 +15 -0
- data/lib/generators/templates/application.js +12 -2
- data/lib/generators/templates/{application_adapter.js.coffee → application_adapter.coffee} +0 -1
- data/lib/generators/templates/{application_adapter.js.em → application_adapter.em} +0 -0
- data/lib/generators/templates/application_adapter.js +0 -1
- data/lib/generators/templates/application_adapter.module.es6 +4 -0
- data/lib/generators/templates/{array_controller.js.coffee → array_controller.coffee} +0 -0
- data/lib/generators/templates/{array_controller.js.em → array_controller.em} +0 -0
- data/lib/generators/templates/array_controller.module.es6 +7 -0
- data/lib/generators/templates/{component.js.coffee → component.coffee} +0 -0
- data/lib/generators/templates/{component.js.em → component.em} +0 -0
- data/lib/generators/templates/component.module.es6 +7 -0
- data/lib/generators/templates/{controller.js.coffee → controller.coffee} +0 -0
- data/lib/generators/templates/{controller.js.em → controller.em} +0 -0
- data/lib/generators/templates/controller.module.es6 +7 -0
- data/lib/generators/templates/environment.coffee +7 -0
- data/lib/generators/templates/environment.em +7 -0
- data/lib/generators/templates/environment.js +7 -0
- data/lib/generators/templates/environment.module.es6 +9 -0
- data/lib/generators/templates/{model.js.coffee → model.coffee} +0 -0
- data/lib/generators/templates/{model.js.em → model.em} +0 -0
- data/lib/generators/templates/model.module.es6 +15 -0
- data/lib/generators/templates/{object_controller.js.coffee → object_controller.coffee} +0 -0
- data/lib/generators/templates/{object_controller.js.em → object_controller.em} +0 -0
- data/lib/generators/templates/object_controller.module.es6 +7 -0
- data/lib/generators/templates/{route.js.coffee → route.coffee} +0 -0
- data/lib/generators/templates/{route.js.em → route.em} +0 -0
- data/lib/generators/templates/route.module.es6 +7 -0
- data/lib/generators/templates/{router.js.coffee → router.coffee} +0 -0
- data/lib/generators/templates/{router.js.em → router.em} +0 -0
- data/lib/generators/templates/router.module.es6 +13 -0
- data/lib/generators/templates/{view.js.coffee → view.coffee} +0 -0
- data/lib/generators/templates/{view.js.em → view.em} +0 -0
- data/lib/generators/templates/view.module.es6 +7 -0
- metadata +68 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d05c20bcd4934bca81626f572018511151505d17
|
4
|
+
data.tar.gz: ed8ade5165062be1d4f8ec0c37c2413163894752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d50b22c47d0ae55ad1a73d25ea7fff9cf083975cd047e28ac79ed2680ea01fb74d20ff23c68982a73aa8f37ab85e1363083a7d73e1c5b7afddaa9c920a1ec19f
|
7
|
+
data.tar.gz: bcc836b552105700948d7806bf83a8945eab9b8c3002bd79541341ef61b7b558bfb3b96d0037d1fb595fca6be4894024a63a3d30c73a5cfec4e221bc57999679
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Rails supports the ability to build projects from a template source ruby file.
|
|
33
33
|
To build an Ember centric Rails project you can simply type the following into your command line:
|
34
34
|
|
35
35
|
```
|
36
|
-
rails new
|
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).
|
@@ -59,7 +59,7 @@ Also, ember-rails includes some flags for the bootstrap generator:
|
|
59
59
|
```
|
60
60
|
--ember-path or -d # custom ember path
|
61
61
|
--skip-git or -g # skip git keeps
|
62
|
-
--javascript-engine # engine for javascript (js, coffee or
|
62
|
+
--javascript-engine # engine for javascript (js, coffee, em or es6)
|
63
63
|
--app-name or -n # custom ember app name
|
64
64
|
```
|
65
65
|
|
@@ -94,6 +94,84 @@ You can now use the flag `--javascript-engine=em` to specify EmberScript
|
|
94
94
|
assets in your generators, but all of the generators will default to
|
95
95
|
using an EmberScript variant first.
|
96
96
|
|
97
|
+
## For ES6 support
|
98
|
+
|
99
|
+
Ember.js recommends using ES6 syntax.
|
100
|
+
It is supported by [Babel](https://babeljs.io/) via [ember-es6_template](https://github.com/tricknotes/ember-es6_template).
|
101
|
+
|
102
|
+
Run the bootstrap generator with an extra flag:
|
103
|
+
|
104
|
+
``` sh
|
105
|
+
rails g ember:bootstrap --javascript-engine=es6
|
106
|
+
```
|
107
|
+
|
108
|
+
Note:
|
109
|
+
|
110
|
+
To use ES6 module in your application, the following configuration is required:
|
111
|
+
|
112
|
+
### Single Ember Application
|
113
|
+
|
114
|
+
This is the case for single Ember application in `app/assets/javascripts` (not under the sub directiry).
|
115
|
+
|
116
|
+
`my-app.es6`
|
117
|
+
``` javascript
|
118
|
+
import Application from 'ember-rails/application';
|
119
|
+
|
120
|
+
const App = Application.extend({
|
121
|
+
// Configure your application.
|
122
|
+
});
|
123
|
+
|
124
|
+
App.create();
|
125
|
+
```
|
126
|
+
|
127
|
+
`import Application from 'ember-rails/application';` and `Application.extend()` is important.
|
128
|
+
It provides customized Ember application to resolve dependencies from ES6 modules instead of `Ember.Application.extend()`.
|
129
|
+
|
130
|
+
`application.js`
|
131
|
+
``` javascript
|
132
|
+
//= require jquery
|
133
|
+
//= require ember
|
134
|
+
//= require ember-data
|
135
|
+
//= require ember-rails/application
|
136
|
+
//= require ./my-app
|
137
|
+
//= require_self
|
138
|
+
|
139
|
+
require('my-app'); // Run your Ember.js application
|
140
|
+
```
|
141
|
+
|
142
|
+
### Multiple Ember Application
|
143
|
+
|
144
|
+
This is the case for multiple Ember application in your Rails application.
|
145
|
+
(Or your Ember application is placed in sub directories of `app/assets/javascripts`.)
|
146
|
+
|
147
|
+
First, you should configure `config.ember.module_prefix` to `nil`.
|
148
|
+
To disable prepending the module prefix to you modules.
|
149
|
+
|
150
|
+
`config/application.rb`
|
151
|
+
``` ruby
|
152
|
+
config.ember.module_prefix = nil
|
153
|
+
```
|
154
|
+
|
155
|
+
Second, please specify `modulePrefix` to your Ember application.
|
156
|
+
|
157
|
+
`my-app/application.module.es6`
|
158
|
+
``` javascript
|
159
|
+
import Application from 'ember-rails/application';
|
160
|
+
import loadInitializers from 'ember/load-initializers';
|
161
|
+
|
162
|
+
const App = Application.extend({
|
163
|
+
modulePrefix: 'my-app' // This value should be the same as directory name.
|
164
|
+
});
|
165
|
+
|
166
|
+
loadInitializers(App, 'my-app');
|
167
|
+
|
168
|
+
App.create();
|
169
|
+
```
|
170
|
+
|
171
|
+
Last, add your endpoint to where you want to run your Ember application.
|
172
|
+
``` javascript
|
173
|
+
require('my-app'); // Run your Ember.js application
|
174
|
+
```
|
97
175
|
|
98
176
|
## Configuration Options
|
99
177
|
|
@@ -105,6 +183,7 @@ config files (`config/application.rb`, `config/environments/development.rb`, etc
|
|
105
183
|
| `config.ember.variant` | Determines which Ember variant to use. Valid options: `:development`, `:production`. Defaults to `:production` in production, and `:development` everywhere else. |
|
106
184
|
| `config.ember.app_name` | Specificies a default application name for all generators. |
|
107
185
|
| `config.ember.ember_path` | Specifies a default custom root path for all generators. |
|
186
|
+
| `config.ember.module_prefix` | Sets module prefix for es6 module. This option is used for only `es6` scripts. Default value: `ember-app`. |
|
108
187
|
| `config.handlebars.precompile` | Enables or disables precompilation. Default value: `true`. |
|
109
188
|
| `config.handlebars.templates_root` | Sets the root path (under `app/assets/javascripts`) for templates to be looked up in. Default value: `"templates"`. |
|
110
189
|
| `config.handlebars.templates_path_separator` | The path separator to use for templates. Default value: `'/'`. |
|
@@ -147,10 +226,9 @@ to use `rails g ember:bootstrap` to create the following directory structure und
|
|
147
226
|
├── helpers
|
148
227
|
├── mixins
|
149
228
|
├── models
|
150
|
-
├── practicality.
|
151
|
-
├── router.
|
229
|
+
├── practicality.coffee
|
230
|
+
├── router.coffee
|
152
231
|
├── routes
|
153
|
-
├── store.js.coffee
|
154
232
|
├── templates
|
155
233
|
│ └── components
|
156
234
|
└── views
|
@@ -161,7 +239,6 @@ By default, it uses the Rails Application's name and creates an `rails_app_name.
|
|
161
239
|
file to set up application namespace and initial requires:
|
162
240
|
|
163
241
|
```javascript
|
164
|
-
//= require handlebars
|
165
242
|
//= require ember
|
166
243
|
//= require ember-data
|
167
244
|
//= require_self
|
@@ -197,8 +274,8 @@ If you want to avoid `.gitkeep` files, use the `skip git` option like
|
|
197
274
|
this: `rails g ember:bootstrap -g`.
|
198
275
|
|
199
276
|
Ask Rails to serve HandlebarsJS and pre-compile templates to Ember
|
200
|
-
by putting each template in a dedicated ".
|
201
|
-
(e.g. `app/assets/javascripts/templates/admin_panel.
|
277
|
+
by putting each template in a dedicated ".hbs", ".js.hjs" or ".handlebars" file
|
278
|
+
(e.g. `app/assets/javascripts/templates/admin_panel.hbs`)
|
202
279
|
and including the assets in your layout:
|
203
280
|
|
204
281
|
<%= javascript_include_tag "templates/admin_panel" %>
|
@@ -207,7 +284,7 @@ If you want to avoid the `templates` prefix, set the `templates_root` option in
|
|
207
284
|
|
208
285
|
config.handlebars.templates_root = 'ember_templates'
|
209
286
|
|
210
|
-
If you store templates in a file like `app/assets/javascripts/ember_templates/admin_panel.
|
287
|
+
If you store templates in a file like `app/assets/javascripts/ember_templates/admin_panel.hbs` after setting the above config,
|
211
288
|
it will be made available to Ember as the `admin_panel` template.
|
212
289
|
|
213
290
|
_(Note: you must clear the local sprockets cache after modifying `templates_root`, stored by default in `tmp/cache/assets`)_
|
@@ -243,17 +320,16 @@ Given the following folder structure:
|
|
243
320
|
├── helpers
|
244
321
|
├── mixins
|
245
322
|
├── models
|
246
|
-
├── practicality.
|
247
|
-
├── router.
|
323
|
+
├── practicality.coffee
|
324
|
+
├── router.coffee
|
248
325
|
├── routes
|
249
|
-
├── store.js.coffee
|
250
326
|
├── templates
|
251
327
|
│ └── components
|
252
|
-
│ └── my-component.
|
328
|
+
│ └── my-component.hbs
|
253
329
|
└── views
|
254
330
|
```
|
255
331
|
|
256
|
-
and a `my-component.
|
332
|
+
and a `my-component.hbs` file with the following contents:
|
257
333
|
|
258
334
|
<h1>My Component</h1>
|
259
335
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
//= require ember/loader
|
2
|
+
//= require ember-rails/shims
|
3
|
+
//= require ember/resolver
|
4
|
+
//= require ember/load-initializers
|
5
|
+
//
|
6
|
+
//= require ember-rails/module_prefix
|
7
|
+
|
8
|
+
import Ember from 'ember';
|
9
|
+
import Resolver from 'ember/resolver';
|
10
|
+
import loadInitializers from 'ember/load-initializers';
|
11
|
+
import modulePrefix from 'ember-rails/module_prefix';
|
12
|
+
|
13
|
+
let App = Ember.Application.extend({
|
14
|
+
modulePrefix: modulePrefix,
|
15
|
+
Resolver: Resolver
|
16
|
+
});
|
17
|
+
|
18
|
+
loadInitializers(App, modulePrefix);
|
19
|
+
|
20
|
+
export default App;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default <%= Rails.application.config.ember.module_prefix.to_json %>;
|
data/lib/ember/rails/engine.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'ember/handlebars/template'
|
2
2
|
require 'active_model_serializers'
|
3
|
+
require 'ember/es6_template'
|
4
|
+
require 'ember/cli/assets'
|
5
|
+
|
3
6
|
require 'sprockets/railtie'
|
4
7
|
|
5
8
|
module Ember
|
@@ -17,8 +20,14 @@ module Ember
|
|
17
20
|
|
18
21
|
config.before_initialize do |app|
|
19
22
|
Sprockets::Engines #force autoloading
|
23
|
+
end
|
20
24
|
|
21
|
-
|
25
|
+
config.before_initialize do |app|
|
26
|
+
Ember::ES6Template.configure do |ember_config|
|
27
|
+
ember_config.module_prefix = config.ember.module_prefix
|
28
|
+
ember_config.prefix_files = config.ember.prefix_files
|
29
|
+
ember_config.prefix_dirs = config.ember.prefix_dirs
|
30
|
+
end
|
22
31
|
end
|
23
32
|
end
|
24
33
|
end
|
data/lib/ember/rails/version.rb
CHANGED
data/lib/ember_rails.rb
CHANGED
@@ -16,10 +16,11 @@ module Ember
|
|
16
16
|
module Rails
|
17
17
|
class Railtie < ::Rails::Railtie
|
18
18
|
config.ember = ActiveSupport::OrderedOptions.new
|
19
|
+
config.ember.module_prefix = 'ember-app'
|
20
|
+
config.ember.prefix_files = %w(store router)
|
21
|
+
config.ember.prefix_dirs = %w(models controllers views routes components helpers mixins serializers adapters)
|
19
22
|
|
20
23
|
generators do |app|
|
21
|
-
app ||= ::Rails.application # Rails 3.0.x does not yield `app`
|
22
|
-
|
23
24
|
app.config.generators.assets = false
|
24
25
|
|
25
26
|
::Rails::Generators.configure!(app.config.generators)
|
@@ -89,6 +90,24 @@ module Ember
|
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
93
|
+
initializer "ember_rails.setup_ember_cli_assets", :after => "ember_rails.setup_vendor", :group => :all do |app|
|
94
|
+
configure_assets app do |env|
|
95
|
+
env.append_path Ember::CLI::Assets.root
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
initializer "ember_rails.setup_ember_handlebars_template", :after => "ember_rails.setup_vendor", :group => :all do |app|
|
100
|
+
configure_assets app do |env|
|
101
|
+
Ember::Handlebars::Template.setup env
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
initializer "ember_rails.setup_ember_es6_template", :after => "ember_rails.setup_vendor", :group => :all do |app|
|
106
|
+
configure_assets app do |env|
|
107
|
+
Ember::ES6Template.setup env
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
92
111
|
initializer "ember_rails.es5_default", :group => :all do |app|
|
93
112
|
if defined?(Closure::Compiler) && app.config.assets.js_compressor == :closure
|
94
113
|
Closure::Compiler::DEFAULT_OPTIONS[:language_in] = 'ECMASCRIPT5'
|
@@ -13,7 +13,7 @@ module Ember
|
|
13
13
|
class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
|
14
14
|
|
15
15
|
def create_adapter_files
|
16
|
-
file_path = File.join(ember_path, 'adapters', class_path, "#{file_name}
|
16
|
+
file_path = File.join(ember_path, 'adapters', class_path, "#{file_name}.#{engine_extension}")
|
17
17
|
template "adapter.#{engine_extension}", file_path
|
18
18
|
end
|
19
19
|
end
|
@@ -16,13 +16,16 @@ module Ember
|
|
16
16
|
|
17
17
|
def inject_ember
|
18
18
|
begin
|
19
|
-
|
19
|
+
if javascript_engine == 'es6'
|
20
|
+
inject_into_application_file('es6') # Don't use `.module.es6`.
|
21
|
+
else
|
22
|
+
inject_into_application_file(engine_extension)
|
23
|
+
end
|
20
24
|
rescue Exception => e
|
21
25
|
inject_into_application_file('js')
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
|
-
|
26
29
|
def create_dir_layout
|
27
30
|
%W{models controllers views routes helpers components templates templates/components mixins adapters}.each do |dir|
|
28
31
|
empty_directory "#{ember_path}/#{dir}"
|
@@ -31,7 +34,7 @@ module Ember
|
|
31
34
|
end
|
32
35
|
|
33
36
|
def create_app_file
|
34
|
-
template "app.#{engine_extension}", "#{ember_path}/#{application_name.underscore}.#{engine_extension}"
|
37
|
+
template "app.#{engine_extension}", "#{ember_path}/#{application_name.underscore.dasherize}.#{engine_extension}"
|
35
38
|
end
|
36
39
|
|
37
40
|
def create_router_file
|
@@ -39,7 +42,11 @@ module Ember
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def create_adapter_file
|
42
|
-
template "application_adapter.#{engine_extension}", "#{ember_path}/adapters/
|
45
|
+
template "application_adapter.#{engine_extension}", "#{ember_path}/adapters/application.#{engine_extension}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_env_file
|
49
|
+
template "environment.#{engine_extension}", "#{ember_path}/environment.#{engine_extension}"
|
43
50
|
end
|
44
51
|
|
45
52
|
private
|
@@ -14,8 +14,8 @@ module Ember
|
|
14
14
|
class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
|
15
15
|
|
16
16
|
def create_component_files
|
17
|
-
dashed_file_name = file_name.
|
18
|
-
comp_path = File.join(ember_path, 'components', class_path, "#{dashed_file_name}
|
17
|
+
dashed_file_name = file_name.dasherize
|
18
|
+
comp_path = File.join(ember_path, 'components', class_path, "#{dashed_file_name}.#{engine_extension}")
|
19
19
|
template "component.#{engine_extension}", comp_path
|
20
20
|
|
21
21
|
templ_path = File.join(ember_path, 'templates/components', class_path, "#{dashed_file_name}.hbs")
|
@@ -17,7 +17,7 @@ module Ember
|
|
17
17
|
|
18
18
|
|
19
19
|
def create_controller_files
|
20
|
-
file_path = File.join(ember_path, 'controllers', class_path, "#{file_name}
|
20
|
+
file_path = File.join(ember_path, 'controllers', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
21
21
|
|
22
22
|
if options.array?
|
23
23
|
template "array_controller.#{engine_extension}", file_path
|
@@ -45,7 +45,24 @@ module Ember
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def engine_extension
|
48
|
-
@engine_extension ||=
|
48
|
+
@engine_extension ||= begin
|
49
|
+
extension_table = {
|
50
|
+
'js' => 'js',
|
51
|
+
'coffee' => 'coffee',
|
52
|
+
'em' => 'em',
|
53
|
+
'es6' => 'module.es6'
|
54
|
+
}
|
55
|
+
|
56
|
+
extension = extension_table[javascript_engine]
|
57
|
+
|
58
|
+
raise "Unsupported javascript engine: `#{javascript_engine}` (Supported engines are: [#{extension_table.keys.join(', ')}])" if extension.nil?
|
59
|
+
|
60
|
+
extension
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def javascript_engine
|
65
|
+
options[:javascript_engine].to_s
|
49
66
|
end
|
50
67
|
|
51
68
|
def configuration
|
@@ -13,7 +13,7 @@ module Ember
|
|
13
13
|
class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
|
14
14
|
|
15
15
|
def create_model_files
|
16
|
-
file_path = File.join(ember_path, 'models', class_path, "#{file_name}.#{engine_extension}")
|
16
|
+
file_path = File.join(ember_path, 'models', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
17
17
|
template "model.#{engine_extension}", file_path
|
18
18
|
end
|
19
19
|
|
@@ -17,11 +17,10 @@ module Ember
|
|
17
17
|
|
18
18
|
|
19
19
|
def create_resource_files
|
20
|
-
|
21
20
|
invoke('ember:route', [ name ], options) unless options[:skip_route]
|
22
21
|
invoke('ember:controller', [ name ], options)
|
23
22
|
invoke('ember:view', [ name ], options)
|
24
|
-
invoke('ember:template', [ name ], options)
|
23
|
+
invoke('ember:template', [ name ], options)
|
25
24
|
end
|
26
25
|
|
27
26
|
end
|
@@ -13,7 +13,7 @@ module Ember
|
|
13
13
|
class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
|
14
14
|
|
15
15
|
def create_route_files
|
16
|
-
file_path = File.join(ember_path, 'routes', class_path, "#{file_name}
|
16
|
+
file_path = File.join(ember_path, 'routes', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
17
17
|
template "route.#{engine_extension}", file_path
|
18
18
|
end
|
19
19
|
end
|
@@ -11,10 +11,8 @@ module Ember
|
|
11
11
|
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
12
12
|
class_option :ember_path, :type => :string, :aliases => "-d", :default => false, :desc => "Custom ember app path"
|
13
13
|
|
14
|
-
|
15
|
-
|
16
14
|
def create_template_files
|
17
|
-
file_path = File.join(ember_path, 'templates', class_path, "#{file_name}.hbs")
|
15
|
+
file_path = File.join(ember_path, 'templates', class_path, "#{file_name.dasherize}.hbs")
|
18
16
|
template 'template.hbs', file_path
|
19
17
|
end
|
20
18
|
|
@@ -14,7 +14,7 @@ module Ember
|
|
14
14
|
class_option :app_name, :type => :string, :aliases => "-n", :default => false, :desc => "Custom ember app name"
|
15
15
|
|
16
16
|
def create_view_files
|
17
|
-
file_path = File.join(ember_path, 'views', class_path, "#{file_name}
|
17
|
+
file_path = File.join(ember_path, 'views', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
18
18
|
template "view.#{engine_extension}", file_path
|
19
19
|
invoke('ember:template', [ name ], options) if options[:with_template]
|
20
20
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//= require_tree ./adapters
|
2
|
+
//= require_tree ./mixins
|
3
|
+
//= require_tree ./models
|
4
|
+
//= require_tree ./controllers
|
5
|
+
//= require_tree ./views
|
6
|
+
//= require_tree ./helpers
|
7
|
+
//= require_tree ./components
|
8
|
+
//= require_tree ./templates
|
9
|
+
//= require_tree ./routes
|
10
|
+
//= require ./router
|
11
|
+
//
|
12
|
+
//= require_self
|
13
|
+
|
14
|
+
import Application from 'ember-rails/application';
|
15
|
+
|
16
|
+
// for more details see: http://emberjs.com/guides/application/
|
17
|
+
export default Application;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
<%= "//= require handlebars\n" if ::Rails.configuration.handlebars.ember_template == 'Handlebars' -%>
|
4
|
+
//= require ./environment
|
5
|
+
//= require ember
|
6
|
+
//= require ember-data
|
7
|
+
//= require ember-rails/application
|
8
|
+
//
|
9
|
+
//= require ./<%= application_name.underscore.dasherize %>
|
10
|
+
//= require_self
|
11
|
+
|
12
|
+
import <%= application_name.camelize %> from '<%= application_name.underscore.dasherize %>';
|
13
|
+
// import config from 'environment'; // You can use `config` for application specific variables such as API key, etc.
|
14
|
+
|
15
|
+
<%= application_name.camelize %>.create();
|
@@ -1,12 +1,22 @@
|
|
1
1
|
//= require jquery
|
2
2
|
//= require jquery_ujs
|
3
3
|
<%= "//= require handlebars\n" if ::Rails.configuration.handlebars.ember_template == 'Handlebars' -%>
|
4
|
+
//= require ./environment
|
4
5
|
//= require ember
|
5
6
|
//= require ember-data
|
6
7
|
//= require active-model-adapter
|
8
|
+
<%- if engine_extension == 'module.es6' -%>
|
9
|
+
//= require ember-rails/application
|
10
|
+
//
|
11
|
+
//= require ./<%= application_name.underscore.dasherize %>
|
7
12
|
//= require_self
|
8
|
-
|
13
|
+
|
14
|
+
require('<%= application_name.underscore.dasherize %>');
|
15
|
+
<%- else -%>
|
16
|
+
|
17
|
+
//= require_self
|
18
|
+
//= require ./<%= application_name.underscore.dasherize %>
|
19
|
+
<%- end -%>
|
9
20
|
|
10
21
|
// for more details see: http://emberjs.com/guides/application/
|
11
22
|
<%= application_name.camelize %> = Ember.Application.create();
|
12
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// for more details see: http://emberjs.com/guides/models/defining-models/
|
2
|
+
|
3
|
+
import DS from 'ember-data';
|
4
|
+
|
5
|
+
export default DS.Model.extend({
|
6
|
+
<% attributes.each_with_index do |attribute, idx| -%>
|
7
|
+
<%= attribute[:name].camelize(:lower) %>: <%=
|
8
|
+
if %w(references belongs_to).member?(attribute[:type])
|
9
|
+
"DS.belongsTo('%s')" % attribute[:name].camelize(:lower)
|
10
|
+
else
|
11
|
+
"DS.attr('%s')" % attribute[:type]
|
12
|
+
end
|
13
|
+
%><% if (idx < attributes.length-1) %>,<% end %>
|
14
|
+
<% end -%>
|
15
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// For more information see: http://emberjs.com/guides/routing/
|
2
|
+
|
3
|
+
import Ember from 'ember';
|
4
|
+
|
5
|
+
var Router = Ember.Router.extend({
|
6
|
+
// location: 'history'
|
7
|
+
});
|
8
|
+
|
9
|
+
Router.map(function() {
|
10
|
+
// this.resource('posts');
|
11
|
+
});
|
12
|
+
|
13
|
+
export default Router;
|
File without changes
|
File without changes
|
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.
|
4
|
+
version: 0.20.0
|
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:
|
14
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -118,33 +118,47 @@ dependencies:
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '1.0'
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
|
-
name:
|
121
|
+
name: ember-es6_template
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- - "
|
124
|
+
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
127
|
-
type: :
|
126
|
+
version: 0.4.0
|
127
|
+
type: :runtime
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - "
|
131
|
+
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: 0.4.0
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
|
-
name:
|
135
|
+
name: ember-cli-assets
|
136
|
+
requirement: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - "~>"
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 0.0.1
|
141
|
+
type: :runtime
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 0.0.1
|
148
|
+
- !ruby/object:Gem::Dependency
|
149
|
+
name: bundler
|
136
150
|
requirement: !ruby/object:Gem::Requirement
|
137
151
|
requirements:
|
138
152
|
- - ">="
|
139
153
|
- !ruby/object:Gem::Version
|
140
|
-
version: 1.
|
154
|
+
version: 1.2.2
|
141
155
|
type: :development
|
142
156
|
prerelease: false
|
143
157
|
version_requirements: !ruby/object:Gem::Requirement
|
144
158
|
requirements:
|
145
159
|
- - ">="
|
146
160
|
- !ruby/object:Gem::Version
|
147
|
-
version: 1.
|
161
|
+
version: 1.2.2
|
148
162
|
- !ruby/object:Gem::Dependency
|
149
163
|
name: tzinfo
|
150
164
|
requirement: !ruby/object:Gem::Requirement
|
@@ -259,6 +273,9 @@ extra_rdoc_files: []
|
|
259
273
|
files:
|
260
274
|
- LICENSE
|
261
275
|
- README.md
|
276
|
+
- app/assets/javascripts/ember-rails/application.module.es6
|
277
|
+
- app/assets/javascripts/ember-rails/module_prefix.module.es6.erb
|
278
|
+
- app/assets/javascripts/ember-rails/shims.js
|
262
279
|
- lib/ember-rails.rb
|
263
280
|
- lib/ember/rails/engine.rb
|
264
281
|
- lib/ember/rails/version.rb
|
@@ -275,45 +292,60 @@ files:
|
|
275
292
|
- lib/generators/ember/route_generator.rb
|
276
293
|
- lib/generators/ember/template_generator.rb
|
277
294
|
- lib/generators/ember/view_generator.rb
|
295
|
+
- lib/generators/templates/adapter.coffee
|
296
|
+
- lib/generators/templates/adapter.em
|
278
297
|
- lib/generators/templates/adapter.js
|
279
|
-
- lib/generators/templates/
|
280
|
-
- lib/generators/templates/
|
298
|
+
- lib/generators/templates/app.coffee
|
299
|
+
- lib/generators/templates/app.em
|
281
300
|
- lib/generators/templates/app.js
|
282
|
-
- lib/generators/templates/app.
|
283
|
-
- lib/generators/templates/
|
301
|
+
- lib/generators/templates/app.module.es6
|
302
|
+
- lib/generators/templates/application.coffee
|
303
|
+
- lib/generators/templates/application.em
|
304
|
+
- lib/generators/templates/application.es6
|
284
305
|
- lib/generators/templates/application.hbs
|
285
306
|
- lib/generators/templates/application.js
|
286
|
-
- lib/generators/templates/
|
287
|
-
- lib/generators/templates/
|
307
|
+
- lib/generators/templates/application_adapter.coffee
|
308
|
+
- lib/generators/templates/application_adapter.em
|
288
309
|
- lib/generators/templates/application_adapter.js
|
289
|
-
- lib/generators/templates/application_adapter.
|
290
|
-
- lib/generators/templates/
|
310
|
+
- lib/generators/templates/application_adapter.module.es6
|
311
|
+
- lib/generators/templates/array_controller.coffee
|
312
|
+
- lib/generators/templates/array_controller.em
|
291
313
|
- lib/generators/templates/array_controller.js
|
292
|
-
- lib/generators/templates/array_controller.
|
293
|
-
- lib/generators/templates/
|
314
|
+
- lib/generators/templates/array_controller.module.es6
|
315
|
+
- lib/generators/templates/component.coffee
|
316
|
+
- lib/generators/templates/component.em
|
294
317
|
- lib/generators/templates/component.js
|
295
|
-
- lib/generators/templates/component.
|
296
|
-
- lib/generators/templates/component.js.em
|
318
|
+
- lib/generators/templates/component.module.es6
|
297
319
|
- lib/generators/templates/component.template.hbs
|
320
|
+
- lib/generators/templates/controller.coffee
|
321
|
+
- lib/generators/templates/controller.em
|
298
322
|
- lib/generators/templates/controller.js
|
299
|
-
- lib/generators/templates/controller.
|
300
|
-
- lib/generators/templates/
|
323
|
+
- lib/generators/templates/controller.module.es6
|
324
|
+
- lib/generators/templates/environment.coffee
|
325
|
+
- lib/generators/templates/environment.em
|
326
|
+
- lib/generators/templates/environment.js
|
327
|
+
- lib/generators/templates/environment.module.es6
|
328
|
+
- lib/generators/templates/model.coffee
|
329
|
+
- lib/generators/templates/model.em
|
301
330
|
- lib/generators/templates/model.js
|
302
|
-
- lib/generators/templates/model.
|
303
|
-
- lib/generators/templates/
|
331
|
+
- lib/generators/templates/model.module.es6
|
332
|
+
- lib/generators/templates/object_controller.coffee
|
333
|
+
- lib/generators/templates/object_controller.em
|
304
334
|
- lib/generators/templates/object_controller.js
|
305
|
-
- lib/generators/templates/object_controller.
|
306
|
-
- lib/generators/templates/
|
335
|
+
- lib/generators/templates/object_controller.module.es6
|
336
|
+
- lib/generators/templates/route.coffee
|
337
|
+
- lib/generators/templates/route.em
|
307
338
|
- lib/generators/templates/route.js
|
308
|
-
- lib/generators/templates/route.
|
309
|
-
- lib/generators/templates/
|
339
|
+
- lib/generators/templates/route.module.es6
|
340
|
+
- lib/generators/templates/router.coffee
|
341
|
+
- lib/generators/templates/router.em
|
310
342
|
- lib/generators/templates/router.js
|
311
|
-
- lib/generators/templates/router.
|
312
|
-
- lib/generators/templates/router.js.em
|
343
|
+
- lib/generators/templates/router.module.es6
|
313
344
|
- lib/generators/templates/template.hbs
|
345
|
+
- lib/generators/templates/view.coffee
|
346
|
+
- lib/generators/templates/view.em
|
314
347
|
- lib/generators/templates/view.js
|
315
|
-
- lib/generators/templates/view.
|
316
|
-
- lib/generators/templates/view.js.em
|
348
|
+
- lib/generators/templates/view.module.es6
|
317
349
|
homepage: https://github.com/emberjs/ember-rails
|
318
350
|
licenses:
|
319
351
|
- MIT
|
@@ -334,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
366
|
version: '0'
|
335
367
|
requirements: []
|
336
368
|
rubyforge_project:
|
337
|
-
rubygems_version: 2.
|
369
|
+
rubygems_version: 2.5.1
|
338
370
|
signing_key:
|
339
371
|
specification_version: 4
|
340
372
|
summary: Ember for Rails 3.1+
|