massimo 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/massimo/javascript.rb +34 -14
  2. data/lib/massimo.rb +1 -1
  3. metadata +47 -19
@@ -1,24 +1,44 @@
1
1
  module Massimo
2
2
  class Javascript < Massimo::Resource
3
3
  def render
4
- case source_path.extname.to_s
5
- when '.coffee'
6
- require 'coffee-script' unless defined?(CoffeeScript)
7
- CoffeeScript.compile(content, Massimo.config.options_for(:coffee_script))
8
- else
9
- require 'sprockets' unless defined?(Sprockets)
10
- options = Massimo.config.options_for(:sprockets).merge(
11
- :assert_root => Massimo.config.output_path,
12
- :source_files => [ source_path.to_s ]
13
- )
14
- secretary = Sprockets::Secretary.new(options)
15
- secretary.install_assets
16
- secretary.concatenation.to_s
17
- end
4
+ compress(compile)
18
5
  end
19
6
 
20
7
  def extension
21
8
  @extension ||= '.js'
22
9
  end
10
+
11
+ protected
12
+
13
+ def compile
14
+ case source_path.extname.to_s
15
+ when '.coffee'
16
+ require 'coffee-script' unless defined?(CoffeeScript)
17
+ CoffeeScript.compile(content, Massimo.config.options_for(:coffee_script))
18
+ else
19
+ require 'sprockets' unless defined?(Sprockets)
20
+ options = Massimo.config.options_for(:sprockets).merge(
21
+ :assert_root => Massimo.config.output_path,
22
+ :source_files => [ source_path.to_s ]
23
+ )
24
+ secretary = Sprockets::Secretary.new(options)
25
+ secretary.install_assets
26
+ secretary.concatenation.to_s
27
+ end
28
+ end
29
+
30
+ def compress(javascript)
31
+ case Massimo.config.javascripts_compressor.to_s
32
+ when 'min', 'jsmin'
33
+ require 'jsmin' unless defined?(JSMin)
34
+ JSMin.minify(javascript).strip
35
+ when 'pack', 'packr'
36
+ require 'packr' unless defined?(Packr)
37
+ options = { :shrink_vars => true }.merge Massimo.config.options_for(:packr)
38
+ Packr.pack(javascript, options)
39
+ else
40
+ javascript
41
+ end
42
+ end
23
43
  end
24
44
  end
data/lib/massimo.rb CHANGED
@@ -12,7 +12,7 @@ module Massimo
12
12
  autoload :View, 'massimo/view'
13
13
  autoload :Watcher, 'massimo/watcher'
14
14
 
15
- VERSION = '0.6.2'
15
+ VERSION = '0.6.3'
16
16
 
17
17
  class << self
18
18
  def site
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 2
9
- version: 0.6.2
8
+ - 3
9
+ version: 0.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Browne
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-30 00:00:00 -05:00
17
+ date: 2010-05-03 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -145,9 +145,23 @@ dependencies:
145
145
  type: :development
146
146
  version_requirements: *id009
147
147
  - !ruby/object:Gem::Dependency
148
- name: haml
148
+ name: unindent
149
149
  prerelease: false
150
150
  requirement: &id010 !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ~>
153
+ - !ruby/object:Gem::Version
154
+ segments:
155
+ - 0
156
+ - 9
157
+ - 0
158
+ version: 0.9.0
159
+ type: :development
160
+ version_requirements: *id010
161
+ - !ruby/object:Gem::Dependency
162
+ name: haml
163
+ prerelease: false
164
+ requirement: &id011 !ruby/object:Gem::Requirement
151
165
  requirements:
152
166
  - - ">="
153
167
  - !ruby/object:Gem::Version
@@ -158,11 +172,11 @@ dependencies:
158
172
  - beta
159
173
  version: 3.0.0.beta
160
174
  type: :development
161
- version_requirements: *id010
175
+ version_requirements: *id011
162
176
  - !ruby/object:Gem::Dependency
163
177
  name: less
164
178
  prerelease: false
165
- requirement: &id011 !ruby/object:Gem::Requirement
179
+ requirement: &id012 !ruby/object:Gem::Requirement
166
180
  requirements:
167
181
  - - ~>
168
182
  - !ruby/object:Gem::Version
@@ -172,11 +186,11 @@ dependencies:
172
186
  - 0
173
187
  version: 1.2.0
174
188
  type: :development
175
- version_requirements: *id011
189
+ version_requirements: *id012
176
190
  - !ruby/object:Gem::Dependency
177
191
  name: coffee-script
178
192
  prerelease: false
179
- requirement: &id012 !ruby/object:Gem::Requirement
193
+ requirement: &id013 !ruby/object:Gem::Requirement
180
194
  requirements:
181
195
  - - ~>
182
196
  - !ruby/object:Gem::Version
@@ -186,11 +200,11 @@ dependencies:
186
200
  - 0
187
201
  version: 0.3.0
188
202
  type: :development
189
- version_requirements: *id012
203
+ version_requirements: *id013
190
204
  - !ruby/object:Gem::Dependency
191
205
  name: sprockets
192
206
  prerelease: false
193
- requirement: &id013 !ruby/object:Gem::Requirement
207
+ requirement: &id014 !ruby/object:Gem::Requirement
194
208
  requirements:
195
209
  - - ~>
196
210
  - !ruby/object:Gem::Version
@@ -200,25 +214,25 @@ dependencies:
200
214
  - 0
201
215
  version: 1.0.0
202
216
  type: :development
203
- version_requirements: *id013
217
+ version_requirements: *id014
204
218
  - !ruby/object:Gem::Dependency
205
- name: unindent
219
+ name: growl
206
220
  prerelease: false
207
- requirement: &id014 !ruby/object:Gem::Requirement
221
+ requirement: &id015 !ruby/object:Gem::Requirement
208
222
  requirements:
209
223
  - - ~>
210
224
  - !ruby/object:Gem::Version
211
225
  segments:
226
+ - 1
212
227
  - 0
213
- - 9
214
228
  - 0
215
- version: 0.9.0
229
+ version: 1.0.0
216
230
  type: :development
217
- version_requirements: *id014
231
+ version_requirements: *id015
218
232
  - !ruby/object:Gem::Dependency
219
- name: growl
233
+ name: jsmin
220
234
  prerelease: false
221
- requirement: &id015 !ruby/object:Gem::Requirement
235
+ requirement: &id016 !ruby/object:Gem::Requirement
222
236
  requirements:
223
237
  - - ~>
224
238
  - !ruby/object:Gem::Version
@@ -228,7 +242,21 @@ dependencies:
228
242
  - 0
229
243
  version: 1.0.0
230
244
  type: :development
231
- version_requirements: *id015
245
+ version_requirements: *id016
246
+ - !ruby/object:Gem::Dependency
247
+ name: packr
248
+ prerelease: false
249
+ requirement: &id017 !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - ~>
252
+ - !ruby/object:Gem::Version
253
+ segments:
254
+ - 3
255
+ - 1
256
+ - 0
257
+ version: 3.1.0
258
+ type: :development
259
+ version_requirements: *id017
232
260
  description: Massimo builds HTML, Javascript, and CSS Files from your source.
233
261
  email: me@petebrowne.com
234
262
  executables: