ember-rails 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d4a9590ae4039949ea614394ca0caeb2abad7ca
4
- data.tar.gz: 9d95fc4cd477131afa246207da35e9798015e9ef
3
+ metadata.gz: 857d69b6457718515597605b4b7a6fee74eea6b0
4
+ data.tar.gz: 054906e52dc2d3d04d9ae241c4cfde1871cff4df
5
5
  SHA512:
6
- metadata.gz: 25c951f6949cbac70a518294866198458f61226d0024f230999bb6ab3ffe4826630ef7620c9e517c6566be707119f25892dd88f66d97c9cf59584cb62544ee96
7
- data.tar.gz: 114946b802515c50194646f4f3c474ae8279c06fd7b38ec2c6f0d49d682848fe27691e18013016813a241df4aaa1d703d575428784e9c78cf7007c377c7dab08
6
+ metadata.gz: e8fd238eacab85e0de0658485283faf51469fda6227f5257d41aab71f31871d8ab601066a6f9d8c3f29724c62c91a2a80f75910912b271d4daf70ce8228172a7
7
+ data.tar.gz: 5e8ad49780dec29b586c2b9b37bda647477010f8f9434828f867abe545d4e30b7c7404bdba249243a7117134847c4c72dc9ff58cf4bd4075d8f314c7bd971160
data/README.md CHANGED
@@ -54,7 +54,7 @@ You'll probably need to clear out your cache after doing this with:
54
54
  rake tmp:clear
55
55
  ```
56
56
 
57
- Also, ember-rails include some flags for the bootstrap generator:
57
+ Also, ember-rails includes some flags for the bootstrap generator:
58
58
 
59
59
  ```
60
60
  --ember-path or -d # custom ember path
@@ -119,6 +119,7 @@ config files (`config/application.rb`, `config/environments/development.rb`, etc
119
119
  | `config.handlebars.templates_root` | Sets the root path (under `app/assets/javascripts`) for templates to be looked up in. Default value: `"templates"`. |
120
120
  | `config.handlebars.templates_path_separator` | The path separator to use for templates. Default value: `'/'`. |
121
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`. |
122
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. |
123
124
 
124
125
  Note:
@@ -5,13 +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
14
- config.handlebars.ember_template = Ember::VERSION =~ /\A1.[0-9]\./ ? 'Handlebars' : 'HTMLBars'
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
15
17
 
16
18
  config.before_initialize do |app|
17
19
  Sprockets::Engines #force autoloading
@@ -1,5 +1,5 @@
1
1
  module Ember
2
2
  module Rails
3
- VERSION = '0.17.0'
3
+ VERSION = '0.18.0'
4
4
  end
5
5
  end
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.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Pitt
@@ -11,22 +11,8 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-03-13 00:00:00.000000000 Z
14
+ date: 2015-03-29 00:00:00.000000000 Z
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: execjs
18
- requirement: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: '1.2'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.2'
30
16
  - !ruby/object:Gem::Dependency
31
17
  name: railties
32
18
  requirement: !ruby/object:Gem::Requirement
@@ -56,61 +42,67 @@ dependencies:
56
42
  - !ruby/object:Gem::Version
57
43
  version: '0'
58
44
  - !ruby/object:Gem::Dependency
59
- name: barber
45
+ name: jquery-rails
60
46
  requirement: !ruby/object:Gem::Requirement
61
47
  requirements:
62
48
  - - ">="
63
49
  - !ruby/object:Gem::Version
64
- version: 0.7.0
50
+ version: 1.0.17
65
51
  type: :runtime
66
52
  prerelease: false
67
53
  version_requirements: !ruby/object:Gem::Requirement
68
54
  requirements:
69
55
  - - ">="
70
56
  - !ruby/object:Gem::Version
71
- version: 0.7.0
57
+ version: 1.0.17
72
58
  - !ruby/object:Gem::Dependency
73
- name: jquery-rails
59
+ name: ember-source
74
60
  requirement: !ruby/object:Gem::Requirement
75
61
  requirements:
76
62
  - - ">="
77
63
  - !ruby/object:Gem::Version
78
- version: 1.0.17
64
+ version: 1.1.0
79
65
  type: :runtime
80
66
  prerelease: false
81
67
  version_requirements: !ruby/object:Gem::Requirement
82
68
  requirements:
83
69
  - - ">="
84
70
  - !ruby/object:Gem::Version
85
- version: 1.0.17
71
+ version: 1.1.0
86
72
  - !ruby/object:Gem::Dependency
87
- name: ember-source
73
+ name: ember-data-source
88
74
  requirement: !ruby/object:Gem::Requirement
89
75
  requirements:
90
76
  - - ">="
91
77
  - !ruby/object:Gem::Version
92
- version: 1.1.0
78
+ version: 1.0.0.beta.5
93
79
  type: :runtime
94
80
  prerelease: false
95
81
  version_requirements: !ruby/object:Gem::Requirement
96
82
  requirements:
97
83
  - - ">="
98
84
  - !ruby/object:Gem::Version
99
- version: 1.1.0
85
+ version: 1.0.0.beta.5
100
86
  - !ruby/object:Gem::Dependency
101
- name: ember-data-source
87
+ name: ember-handlebars-template
102
88
  requirement: !ruby/object:Gem::Requirement
103
89
  requirements:
104
90
  - - ">="
105
91
  - !ruby/object:Gem::Version
106
- version: 1.0.0.beta.5
92
+ version: 0.1.0
93
+ - - "<"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.0'
107
96
  type: :runtime
108
97
  prerelease: false
109
98
  version_requirements: !ruby/object:Gem::Requirement
110
99
  requirements:
111
100
  - - ">="
112
101
  - !ruby/object:Gem::Version
113
- version: 1.0.0.beta.5
102
+ version: 0.1.0
103
+ - - "<"
104
+ - !ruby/object:Gem::Version
105
+ version: '1.0'
114
106
  - !ruby/object:Gem::Dependency
115
107
  name: bundler
116
108
  requirement: !ruby/object:Gem::Requirement
@@ -226,7 +218,6 @@ files:
226
218
  - LICENSE
227
219
  - README.md
228
220
  - lib/ember-rails.rb
229
- - lib/ember/handlebars/template.rb
230
221
  - lib/ember/rails/engine.rb
231
222
  - lib/ember/rails/version.rb
232
223
  - lib/ember_rails.rb
@@ -1,113 +0,0 @@
1
- require 'sprockets'
2
- require 'sprockets/engines'
3
- require 'barber'
4
-
5
- module Ember
6
- module Handlebars
7
- class Template < Tilt::Template
8
- def self.default_mime_type
9
- 'application/javascript'
10
- end
11
-
12
- def prepare; end
13
-
14
- def evaluate(scope, locals, &block)
15
- raw = handlebars?(scope)
16
-
17
- if raw
18
- template = data
19
- else
20
- template = mustache_to_handlebars(scope, data)
21
- end
22
-
23
- if configuration.precompile
24
- if raw
25
- template = precompile_handlebars(template)
26
- else
27
- template = precompile_ember_handlebars(template, configuration.ember_template)
28
- end
29
- else
30
- if raw
31
- template = compile_handlebars(data)
32
- else
33
- template = compile_ember_handlebars(template, configuration.ember_template)
34
- end
35
- end
36
-
37
- if configuration.output_type == :amd
38
- target = amd_template_target(scope)
39
-
40
- "define('#{target}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"
41
- else
42
- target = global_template_target(scope)
43
-
44
- "#{target} = #{template}\n"
45
- end
46
- end
47
-
48
- private
49
-
50
- def handlebars?(scope)
51
- scope.pathname.to_s =~ /\.raw\.(handlebars|hjs|hbs)/
52
- end
53
-
54
- def amd_template_target(scope)
55
- [configuration.amd_namespace, scope.logical_path.split(".").first].compact.join('/')
56
- end
57
-
58
- def global_template_target(scope)
59
- "Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}]"
60
- end
61
-
62
- def compile_handlebars(string)
63
- "Handlebars.compile(#{indent(string).inspect});"
64
- end
65
-
66
- def precompile_handlebars(string)
67
- "Handlebars.template(#{Barber::Precompiler.compile(string)});"
68
- end
69
-
70
- def compile_ember_handlebars(string, ember_template = 'Handlebars')
71
- "Ember.#{ember_template}.compile(#{indent(string).inspect});"
72
- end
73
-
74
- def precompile_ember_handlebars(string, ember_template = 'Handlebars')
75
- "Ember.#{ember_template}.template(#{Barber::Ember::Precompiler.compile(string)});"
76
- end
77
-
78
- def mustache_to_handlebars(scope, template)
79
- if scope.pathname.to_s =~ /\.mustache\.(handlebars|hjs|hbs)/
80
- template.gsub(/\{\{(\w[^\}\}]+)\}\}/){ |x| "{{unbound #{$1}}}" }
81
- else
82
- template
83
- end
84
- end
85
-
86
- def template_path(path)
87
- root = configuration.templates_root
88
-
89
- if root.kind_of? Array
90
- root.each do |root|
91
- path.sub!(/#{Regexp.quote(root)}\//, '')
92
- end
93
- else
94
- unless root.empty?
95
- path.sub!(/#{Regexp.quote(root)}\/?/, '')
96
- end
97
- end
98
-
99
- path = path.split('/')
100
-
101
- path.join(configuration.templates_path_separator)
102
- end
103
-
104
- def configuration
105
- ::Rails.configuration.handlebars
106
- end
107
-
108
- def indent(string)
109
- string.gsub(/$(.)/m, "\\1 ").strip
110
- end
111
- end
112
- end
113
- end