handlebars-rails 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/handlebars-rails.gemspec +2 -2
- data/lib/handlebars-rails.rb +3 -3
- data/lib/handlebars-rails/template_handler.rb +1 -2
- data/lib/handlebars-rails/tilt.rb +5 -2
- data/lib/handlebars-rails/version.rb +3 -1
- data/spec/app/assets/javascripts/templates.js +1 -1
- data/spec/precompile_spec.rb +2 -2
- metadata +5 -5
data/handlebars-rails.gemspec
CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
|
|
4
4
|
require 'handlebars-rails/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.version = Handlebars::VERSION
|
7
|
+
gem.version = Handlebars::Rails::VERSION
|
8
8
|
gem.name = 'handlebars-rails'
|
9
9
|
gem.files = `git ls-files`.split("\n")
|
10
10
|
gem.summary = "Rails Template Handler for Handlebars"
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
19
19
|
gem.specification_version = 2
|
20
20
|
gem.add_runtime_dependency 'rails', '~> 3.0'
|
21
|
-
gem.add_runtime_dependency 'handlebars', '~> 0.
|
21
|
+
gem.add_runtime_dependency 'handlebars', '~> 0.4.0'
|
22
22
|
|
23
23
|
gem.add_development_dependency 'rake'
|
24
24
|
gem.add_development_dependency 'redgreen', '~> 1.2'
|
data/lib/handlebars-rails.rb
CHANGED
@@ -3,8 +3,8 @@ require 'handlebars-rails/tilt'
|
|
3
3
|
require 'handlebars-rails/template_handler'
|
4
4
|
require 'handlebars'
|
5
5
|
|
6
|
-
module Handlebars
|
7
|
-
class
|
6
|
+
module Handlebars::Rails
|
7
|
+
class Engine < ::Rails::Engine
|
8
8
|
|
9
9
|
unless config.respond_to?(:handlebars)
|
10
10
|
config.handlebars = ActiveSupport::OrderedOptions.new
|
@@ -25,4 +25,4 @@ module Handlebars
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -27,7 +27,6 @@ module Handlebars
|
|
27
27
|
Handlebars::Context.new.tap do |context|
|
28
28
|
context['rails'] = {}
|
29
29
|
context.partial_missing do |name|
|
30
|
-
name = name.gsub('.', '/')
|
31
30
|
lookup_context = data['view'].lookup_context
|
32
31
|
prefixes = lookup_context.prefixes.dup
|
33
32
|
prefixes.push ''
|
@@ -47,4 +46,4 @@ module Handlebars
|
|
47
46
|
@context['rails']
|
48
47
|
end
|
49
48
|
end
|
50
|
-
end
|
49
|
+
end
|
@@ -15,13 +15,16 @@ module Handlebars
|
|
15
15
|
hbsc = Handlebars::TemplateHandler.handlebars.precompile data
|
16
16
|
if scope.partial?
|
17
17
|
<<-JS
|
18
|
+
// generated by handlebars-rails #{Handlebars::Rails::VERSION}
|
18
19
|
;(function() {
|
19
20
|
var template = Handlebars.template
|
21
|
+
var fucknet = true
|
20
22
|
Handlebars.registerPartial('#{scope.partial_name}', template(#{hbsc}));
|
21
23
|
})()
|
22
24
|
JS
|
23
25
|
else
|
24
26
|
<<-JS
|
27
|
+
//generated by handlebars-rails #{Handlebars::Rails::VERSION}
|
25
28
|
;(function() {
|
26
29
|
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
27
30
|
#{scope.template_path}
|
@@ -37,7 +40,7 @@ module Handlebars
|
|
37
40
|
end
|
38
41
|
|
39
42
|
def partial_name
|
40
|
-
"#{File.dirname(logical_path)
|
43
|
+
"#{File.dirname(logical_path)}/#{File.basename(logical_path, '.hbs').gsub(/^_/,'')}".gsub(/^\.+/,'')
|
41
44
|
end
|
42
45
|
|
43
46
|
def template_path
|
@@ -57,4 +60,4 @@ module Handlebars
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
60
|
-
end
|
63
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
//= require foobars/whole
|
2
|
-
//= require foobars/_partial
|
2
|
+
//= require foobars/_partial
|
data/spec/precompile_spec.rb
CHANGED
@@ -23,10 +23,10 @@ describe "sprockets integration" do
|
|
23
23
|
end
|
24
24
|
it 'precompiles partials' do
|
25
25
|
@context.compile('{{>foobars/partial}}').call(:thing => 'enchilada').should match 'partial enchilada'
|
26
|
-
@context.handlebars.partials['foobars
|
26
|
+
@context.handlebars.partials['foobars/partial'].call(:thing => 'enchilada').should match 'partial enchilada'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def h(*args)
|
31
31
|
ERB::Util.h args.join(', ')
|
32
|
-
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebars-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.4.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.4.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rake
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.25
|
143
143
|
signing_key:
|
144
144
|
specification_version: 2
|
145
145
|
summary: Rails Template Handler for Handlebars
|