ember-middleman 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +0 -4
- data/ember-middleman.gemspec +1 -1
- data/lib/ember/middleman/extension.rb +13 -13
- data/lib/ember/middleman/version.rb +1 -1
- metadata +5 -6
- data/lib/ember/middleman/handlebars/template.rb +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83d659e37f35a88aefd3948d2a5079e1b08f736b
|
4
|
+
data.tar.gz: d3d280962f34f7429725a7bd01c603dac83b2560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81add419dd0ad90b4d1127fb7dacd763c0dad28583c41df2b859de56dbbf1e46dd789651d5b072622563185647978a5a15147014367acb5336e8c8f0c8ff7903
|
7
|
+
data.tar.gz: 7f119bc19ce8d65c3ab11cf742d65f2689284ea7da18e7d4218ed8be4b9e0e1e5d0ccf1eac8e3127a29c6d61cfbfbf8d1bccc01a2f4b328aeb8b84152776ab2c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Ember::Middleman Changelog
|
2
2
|
|
3
|
+
## [v0.0.15](https://github.com/tricknotes/ember-middleman/tree/v0.0.15)
|
4
|
+
|
5
|
+
* Use [ember-handlebars-template][] instead of barber.
|
6
|
+
|
7
|
+
[ember-handlebars-template]: https://github.com/tricknotes/ember-middleman
|
8
|
+
|
3
9
|
## [v0.0.14](https://github.com/tricknotes/ember-middleman/tree/v0.0.14)
|
4
10
|
|
5
11
|
* Ember < 1.10.0 support is back (handlebars related features are optional)
|
data/README.md
CHANGED
@@ -106,10 +106,6 @@ When you use Ember.js < 1.10, `handlebars` is required in your `application.js`.
|
|
106
106
|
//= require handlebars
|
107
107
|
```
|
108
108
|
|
109
|
-
## Known issues
|
110
|
-
|
111
|
-
* Many code are duplicated with ember-rails
|
112
|
-
|
113
109
|
## Example Repository
|
114
110
|
|
115
111
|
* [sapporojs.org](https://github.com/sapporojs/sapporojs.org)
|
data/ember-middleman.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency '
|
21
|
+
spec.add_dependency 'ember-handlebars-template', '~> 0.1.2'
|
22
22
|
spec.add_dependency 'ember-source'
|
23
23
|
spec.add_dependency 'ember-data-source', '>= 1.0.0.beta.8'
|
24
24
|
spec.add_dependency 'sass'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'active_support/ordered_options'
|
2
2
|
|
3
|
-
require 'ember/
|
3
|
+
require 'ember/handlebars/template'
|
4
4
|
|
5
5
|
require 'ember/source'
|
6
6
|
require 'ember/data/source'
|
@@ -16,13 +16,13 @@ module Ember
|
|
16
16
|
module Extension
|
17
17
|
class << self
|
18
18
|
def registered(app)
|
19
|
-
|
19
|
+
Ember::Handlebars::Template.configure do |config|
|
20
|
+
config.precompile = true
|
21
|
+
config.templates_root = 'templates'
|
22
|
+
config.templates_path_separator = '/'
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
config.templates_path_separator ||= '/'
|
24
|
-
|
25
|
-
yield config if block_given?
|
24
|
+
yield config if block_given?
|
25
|
+
end
|
26
26
|
|
27
27
|
app.before_configuration do
|
28
28
|
template_extensions handlebars: :js,
|
@@ -35,14 +35,14 @@ module Ember
|
|
35
35
|
sprockets.append_path ::Ember::Data::Source.bundled_path_for(nil)
|
36
36
|
sprockets.append_path File.dirname(::Handlebars::Source.bundled_path) if defined?(::Handlebars)
|
37
37
|
|
38
|
-
sprockets.register_engine '.handlebars', Ember::
|
39
|
-
sprockets.register_engine '.hbs', Ember::
|
40
|
-
sprockets.register_engine '.hjs', Ember::
|
38
|
+
sprockets.register_engine '.handlebars', Ember::Handlebars::Template
|
39
|
+
sprockets.register_engine '.hbs', Ember::Handlebars::Template
|
40
|
+
sprockets.register_engine '.hjs', Ember::Handlebars::Template
|
41
41
|
end
|
42
42
|
|
43
|
-
::Tilt.register '.handlebars', Ember::
|
44
|
-
::Tilt.register '.hbs', Ember::
|
45
|
-
::Tilt.register '.hjs', Ember::
|
43
|
+
::Tilt.register '.handlebars', Ember::Handlebars::Template
|
44
|
+
::Tilt.register '.hbs', Ember::Handlebars::Template
|
45
|
+
::Tilt.register '.hjs', Ember::Handlebars::Template
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryunosuke SATO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: ember-handlebars-template
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ember-source
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,7 +177,6 @@ files:
|
|
177
177
|
- fixtures/path-to-libraries/source/javascripts/application.js
|
178
178
|
- lib/ember/middleman.rb
|
179
179
|
- lib/ember/middleman/extension.rb
|
180
|
-
- lib/ember/middleman/handlebars/template.rb
|
181
180
|
- lib/ember/middleman/templates.rb
|
182
181
|
- lib/ember/middleman/templates/config.tt
|
183
182
|
- lib/ember/middleman/templates/gitkeep
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
require 'sprockets'
|
4
|
-
require 'sprockets/engines'
|
5
|
-
require 'barber'
|
6
|
-
|
7
|
-
module Ember
|
8
|
-
module Middleman
|
9
|
-
module Handlebars
|
10
|
-
class Template < Tilt::Template
|
11
|
-
self.default_mime_type = 'application/javascript'
|
12
|
-
|
13
|
-
def self.configuration
|
14
|
-
@configuration ||= OpenStruct.new
|
15
|
-
end
|
16
|
-
|
17
|
-
def prepare; end
|
18
|
-
|
19
|
-
def evaluate(scope, locals, &block)
|
20
|
-
target = template_target(scope)
|
21
|
-
raw = handlebars?(scope)
|
22
|
-
|
23
|
-
if raw
|
24
|
-
template = data
|
25
|
-
else
|
26
|
-
template = mustache_to_handlebars(scope, data)
|
27
|
-
end
|
28
|
-
|
29
|
-
if configuration.precompile
|
30
|
-
if raw
|
31
|
-
template = precompile_handlebars(template)
|
32
|
-
else
|
33
|
-
template = precompile_ember_handlebars(template)
|
34
|
-
end
|
35
|
-
else
|
36
|
-
if raw
|
37
|
-
template = compile_handlebars(data)
|
38
|
-
else
|
39
|
-
template = compile_ember_handlebars(template)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
"#{target} = #{template}\n"
|
44
|
-
end
|
45
|
-
|
46
|
-
def configuration
|
47
|
-
self.class.configuration
|
48
|
-
end
|
49
|
-
|
50
|
-
def allows_script?
|
51
|
-
false
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def handlebars?(scope)
|
57
|
-
scope.pathname.to_s =~ /\.raw\.(handlebars|hjs|hbs)/
|
58
|
-
end
|
59
|
-
|
60
|
-
def template_target(scope)
|
61
|
-
"Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}]"
|
62
|
-
end
|
63
|
-
|
64
|
-
def compile_handlebars(string)
|
65
|
-
"Handlebars.compile(#{indent(string).inspect});"
|
66
|
-
end
|
67
|
-
|
68
|
-
def precompile_handlebars(string)
|
69
|
-
Barber::FilePrecompiler.call(string)
|
70
|
-
end
|
71
|
-
|
72
|
-
def compile_ember_handlebars(string)
|
73
|
-
"Ember.Handlebars.compile(#{indent(string).inspect});"
|
74
|
-
end
|
75
|
-
|
76
|
-
def precompile_ember_handlebars(string)
|
77
|
-
Barber::Ember::FilePrecompiler.call(string)
|
78
|
-
end
|
79
|
-
|
80
|
-
def mustache_to_handlebars(scope, template)
|
81
|
-
if scope.pathname.to_s =~ /\.mustache\.(handlebars|hjs|hbs)/
|
82
|
-
template.gsub(/\{\{(\w[^\}\}]+)\}\}/){ |x| "{{unbound #{$1}}}" }
|
83
|
-
else
|
84
|
-
template
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def template_path(path)
|
89
|
-
root = configuration.templates_root
|
90
|
-
|
91
|
-
if root.kind_of? Array
|
92
|
-
root.each do |root|
|
93
|
-
path.sub!(/#{Regexp.quote(root)}\//, '')
|
94
|
-
end
|
95
|
-
else
|
96
|
-
unless root.empty?
|
97
|
-
path.sub!(/#{Regexp.quote(root)}\/?/, '')
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
path = path.split('/')
|
102
|
-
|
103
|
-
path.join(configuration.templates_path_separator)
|
104
|
-
end
|
105
|
-
|
106
|
-
def indent(string)
|
107
|
-
string.gsub(/$(.)/m, "\\1 ").strip
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|