rasputin 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ module Rasputin
2
+ class HandlebarsTemplate < Tilt::Template
3
+ def self.default_mime_type
4
+ 'application/javascript'
5
+ end
6
+
7
+ def prepare; end
8
+
9
+ def evaluate(scope, locals, &block)
10
+ if Rails.configuration.rasputin.precompile_handlebars
11
+ func = Rasputin::Handlebars.compile(data)
12
+ "SC.TEMPLATES[#{template_path(scope.logical_path).inspect}] = Handlebars.template(#{func});"
13
+ else
14
+ "SC.TEMPLATES[#{template_path(scope.logical_path).inspect}] = SC.Handlebars.compile(#{indent(data).inspect});"
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def template_path(path)
21
+ path = path.split('/')
22
+ path.delete('templates')
23
+ path.join('/')
24
+ end
25
+
26
+ def indent(string)
27
+ string.gsub(/$(.)/m, "\\1 ").strip
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ module Slim
2
+ class EmbeddedEngine
3
+ register :handlebars, TagEngine, :tag => :script, :attributes => { :type => 'text/x-handlebars' }
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Rasputin
2
- VERSION = "0.8.2"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,67 +1,66 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rasputin
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
4
5
  prerelease:
5
- version: 0.8.2
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Paul Chavard
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-09-04 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-10 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: railties
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70149605754100 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
18
+ requirements:
21
19
  - - ~>
22
- - !ruby/object:Gem::Version
20
+ - !ruby/object:Gem::Version
23
21
  version: 3.1.0
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: actionpack
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70149605754100
25
+ - !ruby/object:Gem::Dependency
26
+ name: actionpack
27
+ requirement: &70149605753320 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
29
+ requirements:
32
30
  - - ~>
33
- - !ruby/object:Gem::Version
31
+ - !ruby/object:Gem::Version
34
32
  version: 3.1.0
35
33
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: sprockets
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70149605753320
36
+ - !ruby/object:Gem::Dependency
37
+ name: sprockets
38
+ requirement: &70149605752480 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
40
+ requirements:
43
41
  - - ~>
44
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
45
43
  version: 2.0.0
46
44
  type: :runtime
47
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *70149605752480
48
47
  description: SproutCore 2.0 for the Rails asset pipeline.
49
- email:
48
+ email:
50
49
  - paul@chavard.net
51
50
  executables: []
52
-
53
51
  extensions: []
54
-
55
52
  extra_rdoc_files: []
56
-
57
- files:
53
+ files:
58
54
  - .gitignore
59
55
  - Gemfile
60
56
  - Gemfile.lock
61
57
  - README.md
62
58
  - Rakefile
63
59
  - lib/rasputin.rb
64
- - lib/rasputin/handlebars_template.rb
60
+ - lib/rasputin/handlebars/compiler.rb
61
+ - lib/rasputin/handlebars/handlebars.js
62
+ - lib/rasputin/handlebars/template.rb
63
+ - lib/rasputin/slim.rb
65
64
  - lib/rasputin/version.rb
66
65
  - rasputin.gemspec
67
66
  - vendor/assets/javascripts/sproutcore-datastore.js
@@ -72,30 +71,26 @@ files:
72
71
  - vendor/assets/stylesheets/normalize.css
73
72
  homepage: http://github.com/tchak/rasputin
74
73
  licenses: []
75
-
76
74
  post_install_message:
77
75
  rdoc_options: []
78
-
79
- require_paths:
76
+ require_paths:
80
77
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
78
+ required_ruby_version: !ruby/object:Gem::Requirement
82
79
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: "0"
87
- required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
85
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: "0"
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
93
90
  requirements: []
94
-
95
91
  rubyforge_project: rasputin
96
- rubygems_version: 1.8.5
92
+ rubygems_version: 1.8.10
97
93
  signing_key:
98
94
  specification_version: 3
99
95
  summary: SproutCore 2.0 adapter for the Rails asset pipeline.
100
96
  test_files: []
101
-
@@ -1,32 +0,0 @@
1
- require 'tilt'
2
- require 'sprockets/engines'
3
-
4
- module Rasputin
5
- class HandlebarsTemplate < Tilt::Template
6
- def self.default_mime_type
7
- 'application/javascript'
8
- end
9
-
10
- def prepare
11
- end
12
-
13
- def evaluate(scope, locals, &block)
14
- <<-HANDLEBARS
15
- SC.TEMPLATES[#{template_path(scope.logical_path).inspect}] = SC.Handlebars.compile(#{indent(data).inspect});
16
- HANDLEBARS
17
- end
18
-
19
- private
20
- def template_path(path)
21
- path = path.split('/')
22
- path.delete('templates')
23
- path.join('_')
24
- end
25
-
26
- def indent(string)
27
- string.gsub(/$(.)/m, "\\1 ").strip
28
- end
29
- end
30
- end
31
-
32
- Sprockets.register_engine '.handlebars', Rasputin::HandlebarsTemplate