bunch 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@ require 'bunch/coffee_node'
23
23
  require 'bunch/sass_node'
24
24
  require 'bunch/null_node'
25
25
  require 'bunch/ejs_node'
26
+ require 'bunch/jade_node'
26
27
 
27
28
  module Bunch
28
29
  class CompileError < StandardError
@@ -64,6 +65,8 @@ class << Bunch
64
65
  Bunch::SassNode.new(path)
65
66
  when path =~ /\.ejs$/
66
67
  Bunch::EJSNode.new(path)
68
+ when path =~ /\.jade/
69
+ Bunch::JadeNode.new(path)
67
70
  else
68
71
  Bunch::FileNode.new(path)
69
72
  end
@@ -0,0 +1,50 @@
1
+ module Bunch
2
+ class JadeNode < FileNode
3
+ def initialize(fn)
4
+ JadeNode.require_jade
5
+ @filename = fn
6
+ end
7
+
8
+ def content
9
+ @content ||= fetch(@filename) {
10
+ <<-JAVASCRIPT
11
+ (function() {
12
+ this.JST || (this.JST = {});
13
+ this.JST['#{template_name}'] = #{Jade.compile(File.read(@filename))};
14
+ })();
15
+ JAVASCRIPT
16
+ }
17
+ rescue => e
18
+ raise CompileError.new(e, @filename)
19
+ end
20
+
21
+ def name
22
+ File.basename(@filename, '.jade')
23
+ end
24
+
25
+ def template_name
26
+ name = @filename.sub(/\.jst\.jade/, '')
27
+
28
+ if @options[:root]
29
+ name.sub(/^#{Regexp.escape(@options[:root].to_s)}\//, '')
30
+ else
31
+ name
32
+ end
33
+ end
34
+
35
+ def target_extension
36
+ '.js'
37
+ end
38
+ end
39
+
40
+ class << JadeNode
41
+ def require_jade
42
+ unless @required
43
+ require 'ruby-jade'
44
+ @required = true
45
+ end
46
+ rescue LoadError
47
+ raise "'gem install ruby-jade' to compile .jade files."
48
+ end
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module Bunch
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,144 +1,144 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
4
  prerelease:
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Fitzgerald
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: mime-types
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
20
+ none: false
21
+ name: mime-types
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
24
+ requirement: !ruby/object:Gem::Requirement
26
25
  requirements:
27
26
  - - ! '>='
28
27
  - !ruby/object:Gem::Version
29
28
  version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: yard
32
- requirement: !ruby/object:Gem::Requirement
33
29
  none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
34
32
  requirements:
35
33
  - - ! '>='
36
34
  - !ruby/object:Gem::Version
37
35
  version: '0'
36
+ none: false
37
+ name: yard
38
38
  type: :development
39
39
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
40
+ requirement: !ruby/object:Gem::Requirement
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rdiscount
48
- requirement: !ruby/object:Gem::Requirement
49
45
  none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
50
48
  requirements:
51
49
  - - ! '>='
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
52
+ none: false
53
+ name: rdiscount
54
54
  type: :development
55
55
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
56
+ requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - ! '>='
60
59
  - !ruby/object:Gem::Version
61
60
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: shoulda-context
64
- requirement: !ruby/object:Gem::Requirement
65
61
  none: false
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
66
64
  requirements:
67
65
  - - ! '>='
68
66
  - !ruby/object:Gem::Version
69
67
  version: '0'
68
+ none: false
69
+ name: shoulda-context
70
70
  type: :development
71
71
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
72
+ requirement: !ruby/object:Gem::Requirement
74
73
  requirements:
75
74
  - - ! '>='
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: mocha
80
- requirement: !ruby/object:Gem::Requirement
81
77
  none: false
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: !ruby/object:Gem::Requirement
82
80
  requirements:
83
81
  - - ! '>='
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
84
+ none: false
85
+ name: mocha
86
86
  type: :development
87
87
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
88
+ requirement: !ruby/object:Gem::Requirement
90
89
  requirements:
91
90
  - - ! '>='
92
91
  - !ruby/object:Gem::Version
93
92
  version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: coffee-script
96
- requirement: !ruby/object:Gem::Requirement
97
93
  none: false
94
+ - !ruby/object:Gem::Dependency
95
+ version_requirements: !ruby/object:Gem::Requirement
98
96
  requirements:
99
97
  - - ! '>='
100
98
  - !ruby/object:Gem::Version
101
99
  version: '0'
100
+ none: false
101
+ name: coffee-script
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
104
+ requirement: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - ! '>='
108
107
  - !ruby/object:Gem::Version
109
108
  version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: sass
112
- requirement: !ruby/object:Gem::Requirement
113
109
  none: false
110
+ - !ruby/object:Gem::Dependency
111
+ version_requirements: !ruby/object:Gem::Requirement
114
112
  requirements:
115
113
  - - ! '>='
116
114
  - !ruby/object:Gem::Version
117
115
  version: '0'
116
+ none: false
117
+ name: sass
118
118
  type: :development
119
119
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
120
+ requirement: !ruby/object:Gem::Requirement
122
121
  requirements:
123
122
  - - ! '>='
124
123
  - !ruby/object:Gem::Version
125
124
  version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: ejs
128
- requirement: !ruby/object:Gem::Requirement
129
125
  none: false
126
+ - !ruby/object:Gem::Dependency
127
+ version_requirements: !ruby/object:Gem::Requirement
130
128
  requirements:
131
129
  - - ! '>='
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
132
+ none: false
133
+ name: ejs
134
134
  type: :development
135
135
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
136
+ requirement: !ruby/object:Gem::Requirement
138
137
  requirements:
139
138
  - - ! '>='
140
139
  - !ruby/object:Gem::Version
141
140
  version: '0'
141
+ none: false
142
142
  description: Directory-structure-based asset bundling.
143
143
  email:
144
144
  - rfitz@academia.edu
@@ -183,6 +183,7 @@ files:
183
183
  - lib/bunch/directory_node.rb
184
184
  - lib/bunch/ejs_node.rb
185
185
  - lib/bunch/file_node.rb
186
+ - lib/bunch/jade_node.rb
186
187
  - lib/bunch/middleware.rb
187
188
  - lib/bunch/null_node.rb
188
189
  - lib/bunch/rack.rb
@@ -198,17 +199,17 @@ rdoc_options: []
198
199
  require_paths:
199
200
  - lib
200
201
  required_ruby_version: !ruby/object:Gem::Requirement
201
- none: false
202
202
  requirements:
203
203
  - - ! '>='
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
- required_rubygems_version: !ruby/object:Gem::Requirement
207
206
  none: false
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  requirements:
209
209
  - - ! '>='
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
+ none: false
212
213
  requirements: []
213
214
  rubyforge_project: bunch
214
215
  rubygems_version: 1.8.24