tilt 1.3 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Tilt
2
- VERSION = '1.3'
2
+ VERSION = '1.3.1'
3
3
 
4
4
  @preferred_mappings = Hash.new
5
5
  @template_mappings = Hash.new { |h, k| h[k] = [] }
@@ -17,9 +17,7 @@ module Tilt
17
17
  def self.register(template_class, *extensions)
18
18
  if template_class.respond_to?(:to_str)
19
19
  # Support register(ext, template_class) too
20
- ext = template_class
21
- template_class = extensions[0]
22
- extensions = [ext]
20
+ extensions, template_class = [template_class], extensions[0]
23
21
  end
24
22
 
25
23
  extensions.each do |ext|
@@ -76,8 +74,8 @@ module Tilt
76
74
  end
77
75
 
78
76
  # Try to find a preferred engine.
79
- klass = @preferred_mappings[pattern]
80
- return klass if klass
77
+ preferred_klass = @preferred_mappings[pattern]
78
+ return preferred_klass if preferred_klass
81
79
 
82
80
  # Fall back to the general list of mappings.
83
81
  klasses = @template_mappings[pattern]
@@ -8,7 +8,7 @@ module Tilt
8
8
  class CoffeeScriptTemplate < Template
9
9
  self.default_mime_type = 'application/javascript'
10
10
 
11
- @@default_bare = true
11
+ @@default_bare = false
12
12
 
13
13
  def self.default_bare
14
14
  @@default_bare
@@ -9,15 +9,16 @@ module Tilt
9
9
  self.default_mime_type = 'text/css'
10
10
 
11
11
  def self.engine_initialized?
12
- defined? ::Sass::Engine
12
+ defined?(::Sass::Engine) && defined?(::Sass::Plugin)
13
13
  end
14
14
 
15
15
  def initialize_engine
16
16
  require_template_library 'sass'
17
+ require_template_library 'sass/plugin'
17
18
  end
18
19
 
19
20
  def prepare
20
- @engine = ::Sass::Engine.new(data, sass_options)
21
+ @engine = ::Sass::Engine.new(data, ::Sass::Plugin.engine_options(sass_options))
21
22
  end
22
23
 
23
24
  def evaluate(scope, locals, &block)
@@ -40,7 +40,8 @@ begin
40
40
 
41
41
  test "no options" do
42
42
  template = Tilt::CoffeeScriptTemplate.new { |t| "puts 'Hello, World!'\n" }
43
- assert_equal "puts('Hello, World!');", template.render
43
+ assert_match "puts('Hello, World!');", template.render
44
+ assert_match "(function() {", template.render
44
45
  end
45
46
 
46
47
  test "overridden by :bare" do
@@ -19,6 +19,17 @@ begin
19
19
  template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
20
20
  3.times { assert_equal "#main {\n background-color: #0000f1; }\n", template.render }
21
21
  end
22
+
23
+ test "uses configuration from Sass::Plugin.engine_options" do
24
+ begin
25
+ orig_style = Sass::Plugin.options[:style]
26
+ Sass::Plugin.options[:style] = :compressed
27
+ template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
28
+ assert_equal "#main{background-color:#0000f1}\n", template.render
29
+ ensure
30
+ Sass::Plugin.options[:style] = orig_style
31
+ end
32
+ end
22
33
  end
23
34
 
24
35
  class ScssTemplateTest < Test::Unit::TestCase
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'tilt'
6
- s.version = '1.3'
7
- s.date = '2011-04-26'
6
+ s.version = '1.3.1'
7
+ s.date = '2011-05-21'
8
8
 
9
9
  s.description = "Generic interface to multiple Ruby template engines"
10
10
  s.summary = s.description
@@ -72,9 +72,7 @@ Gem::Specification.new do |s|
72
72
  ]
73
73
  # = MANIFEST =
74
74
 
75
- s.default_executable = 'tilt'
76
75
  s.executables = ['tilt']
77
-
78
76
  s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
79
77
  s.add_development_dependency 'contest'
80
78
  s.add_development_dependency 'builder'
@@ -93,9 +91,6 @@ Gem::Specification.new do |s|
93
91
  s.add_development_dependency 'creole'
94
92
  s.add_development_dependency 'kramdown'
95
93
 
96
- s.extra_rdoc_files = %w[COPYING]
97
-
98
- s.has_rdoc = true
99
94
  s.homepage = "http://github.com/rtomayko/tilt/"
100
95
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tilt", "--main", "Tilt"]
101
96
  s.require_paths = %w[lib]
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tilt
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: "1.3"
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 1
10
+ version: 1.3.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - Ryan Tomayko
@@ -10,8 +15,8 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-04-26 00:00:00 -07:00
14
- default_executable: tilt
18
+ date: 2011-05-21 00:00:00 -07:00
19
+ default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
17
22
  name: contest
@@ -21,6 +26,9 @@ dependencies:
21
26
  requirements:
22
27
  - - ">="
23
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
24
32
  version: "0"
25
33
  type: :development
26
34
  version_requirements: *id001
@@ -32,6 +40,9 @@ dependencies:
32
40
  requirements:
33
41
  - - ">="
34
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
35
46
  version: "0"
36
47
  type: :development
37
48
  version_requirements: *id002
@@ -43,6 +54,9 @@ dependencies:
43
54
  requirements:
44
55
  - - ">="
45
56
  - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
46
60
  version: "0"
47
61
  type: :development
48
62
  version_requirements: *id003
@@ -54,6 +68,11 @@ dependencies:
54
68
  requirements:
55
69
  - - ">="
56
70
  - !ruby/object:Gem::Version
71
+ hash: 17
72
+ segments:
73
+ - 2
74
+ - 2
75
+ - 11
57
76
  version: 2.2.11
58
77
  type: :development
59
78
  version_requirements: *id004
@@ -65,6 +84,9 @@ dependencies:
65
84
  requirements:
66
85
  - - ">="
67
86
  - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
68
90
  version: "0"
69
91
  type: :development
70
92
  version_requirements: *id005
@@ -76,6 +98,9 @@ dependencies:
76
98
  requirements:
77
99
  - - ">="
78
100
  - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
79
104
  version: "0"
80
105
  type: :development
81
106
  version_requirements: *id006
@@ -87,6 +112,9 @@ dependencies:
87
112
  requirements:
88
113
  - - ">="
89
114
  - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
90
118
  version: "0"
91
119
  type: :development
92
120
  version_requirements: *id007
@@ -98,6 +126,9 @@ dependencies:
98
126
  requirements:
99
127
  - - ">="
100
128
  - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
101
132
  version: "0"
102
133
  type: :development
103
134
  version_requirements: *id008
@@ -109,6 +140,9 @@ dependencies:
109
140
  requirements:
110
141
  - - ">="
111
142
  - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
112
146
  version: "0"
113
147
  type: :development
114
148
  version_requirements: *id009
@@ -120,6 +154,9 @@ dependencies:
120
154
  requirements:
121
155
  - - ">="
122
156
  - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
123
160
  version: "0"
124
161
  type: :development
125
162
  version_requirements: *id010
@@ -131,6 +168,9 @@ dependencies:
131
168
  requirements:
132
169
  - - ">="
133
170
  - !ruby/object:Gem::Version
171
+ hash: 3
172
+ segments:
173
+ - 0
134
174
  version: "0"
135
175
  type: :development
136
176
  version_requirements: *id011
@@ -142,6 +182,9 @@ dependencies:
142
182
  requirements:
143
183
  - - ">="
144
184
  - !ruby/object:Gem::Version
185
+ hash: 3
186
+ segments:
187
+ - 0
145
188
  version: "0"
146
189
  type: :development
147
190
  version_requirements: *id012
@@ -153,6 +196,9 @@ dependencies:
153
196
  requirements:
154
197
  - - ">="
155
198
  - !ruby/object:Gem::Version
199
+ hash: 3
200
+ segments:
201
+ - 0
156
202
  version: "0"
157
203
  type: :development
158
204
  version_requirements: *id013
@@ -164,6 +210,9 @@ dependencies:
164
210
  requirements:
165
211
  - - ">="
166
212
  - !ruby/object:Gem::Version
213
+ hash: 3
214
+ segments:
215
+ - 0
167
216
  version: "0"
168
217
  type: :development
169
218
  version_requirements: *id014
@@ -175,6 +224,9 @@ dependencies:
175
224
  requirements:
176
225
  - - ">="
177
226
  - !ruby/object:Gem::Version
227
+ hash: 3
228
+ segments:
229
+ - 0
178
230
  version: "0"
179
231
  type: :development
180
232
  version_requirements: *id015
@@ -186,6 +238,9 @@ dependencies:
186
238
  requirements:
187
239
  - - ">="
188
240
  - !ruby/object:Gem::Version
241
+ hash: 3
242
+ segments:
243
+ - 0
189
244
  version: "0"
190
245
  type: :development
191
246
  version_requirements: *id016
@@ -195,8 +250,8 @@ executables:
195
250
  - tilt
196
251
  extensions: []
197
252
 
198
- extra_rdoc_files:
199
- - COPYING
253
+ extra_rdoc_files: []
254
+
200
255
  files:
201
256
  - COPYING
202
257
  - README.md
@@ -272,17 +327,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
327
  requirements:
273
328
  - - ">="
274
329
  - !ruby/object:Gem::Version
330
+ hash: 3
331
+ segments:
332
+ - 0
275
333
  version: "0"
276
334
  required_rubygems_version: !ruby/object:Gem::Requirement
277
335
  none: false
278
336
  requirements:
279
337
  - - ">="
280
338
  - !ruby/object:Gem::Version
339
+ hash: 3
340
+ segments:
341
+ - 0
281
342
  version: "0"
282
343
  requirements: []
283
344
 
284
345
  rubyforge_project: wink
285
- rubygems_version: 1.6.0
346
+ rubygems_version: 1.3.7
286
347
  signing_key:
287
348
  specification_version: 2
288
349
  summary: Generic interface to multiple Ruby template engines