assette 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -15,4 +15,5 @@ gem "json", '>= 1.4'
15
15
  gem "sass", '>= 3.1'
16
16
  gem "mime-types", ">= 1.16", :require => 'mime/types'
17
17
  gem "git"
18
- gem "coffee-script", "~> 2"
18
+ gem "coffee-script", "~> 2"
19
+ gem "uglifier"
data/Gemfile.lock CHANGED
@@ -31,6 +31,9 @@ GEM
31
31
  rspec-mocks (2.4.0)
32
32
  sass (3.1.2)
33
33
  thor (0.14.6)
34
+ uglifier (1.1.0)
35
+ execjs (>= 0.3.0)
36
+ multi_json (>= 1.0.2)
34
37
  yard (0.6.8)
35
38
 
36
39
  PLATFORMS
@@ -49,4 +52,5 @@ DEPENDENCIES
49
52
  rspec (~> 2.4.0)
50
53
  sass (>= 3.1)
51
54
  thor (~> 0)
55
+ uglifier
52
56
  yard (~> 0.6.0)
data/Rakefile CHANGED
@@ -28,6 +28,7 @@ Jeweler::Tasks.new do |gem|
28
28
  gem.add_runtime_dependency "json", '>= 1.4'
29
29
  gem.add_runtime_dependency "sass", '>= 3.1'
30
30
  gem.add_runtime_dependency "coffee-script", '~> 2'
31
+ gem.add_runtime_dependency "uglifier"
31
32
  gem.add_runtime_dependency "mime-types", ">= 1.16"
32
33
  end
33
34
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
data/assette.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{assette}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Tal Atlas}]
12
- s.date = %q{2011-11-22}
12
+ s.date = %q{2011-12-09}
13
13
  s.description = %q{Renders all asset types (coffeescript/sass/scss) as equals}
14
14
  s.email = %q{me@tal.by}
15
15
  s.executables = [%q{assette}]
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "assette.gemspec",
31
31
  "bin/assette",
32
32
  "examples/.asset_key",
33
- "examples/.assette_pid",
34
33
  "examples/config/assets.rb",
35
34
  "examples/myapp/templates/bar/index.html.mustache",
36
35
  "examples/myapp/templates/foo/_partial.html.mustache",
@@ -56,6 +55,7 @@ Gem::Specification.new do |s|
56
55
  "lib/assette/post_processor.rb",
57
56
  "lib/assette/post_processors.rb",
58
57
  "lib/assette/post_processors/cache_buster.rb",
58
+ "lib/assette/post_processors/js_min.rb",
59
59
  "lib/assette/reader.rb",
60
60
  "lib/assette/readers.rb",
61
61
  "lib/assette/readers/coffee.rb",
@@ -111,6 +111,7 @@ Gem::Specification.new do |s|
111
111
  s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
112
112
  s.add_runtime_dependency(%q<git>, [">= 0"])
113
113
  s.add_runtime_dependency(%q<coffee-script>, ["~> 2"])
114
+ s.add_runtime_dependency(%q<uglifier>, [">= 0"])
114
115
  s.add_development_dependency(%q<rspec>, ["~> 2.4.0"])
115
116
  s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
116
117
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -122,6 +123,7 @@ Gem::Specification.new do |s|
122
123
  s.add_runtime_dependency(%q<json>, [">= 1.4"])
123
124
  s.add_runtime_dependency(%q<sass>, [">= 3.1"])
124
125
  s.add_runtime_dependency(%q<coffee-script>, ["~> 2"])
126
+ s.add_runtime_dependency(%q<uglifier>, [">= 0"])
125
127
  s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
126
128
  else
127
129
  s.add_dependency(%q<rack>, ["~> 1"])
@@ -131,6 +133,7 @@ Gem::Specification.new do |s|
131
133
  s.add_dependency(%q<mime-types>, [">= 1.16"])
132
134
  s.add_dependency(%q<git>, [">= 0"])
133
135
  s.add_dependency(%q<coffee-script>, ["~> 2"])
136
+ s.add_dependency(%q<uglifier>, [">= 0"])
134
137
  s.add_dependency(%q<rspec>, ["~> 2.4.0"])
135
138
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
136
139
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -142,6 +145,7 @@ Gem::Specification.new do |s|
142
145
  s.add_dependency(%q<json>, [">= 1.4"])
143
146
  s.add_dependency(%q<sass>, [">= 3.1"])
144
147
  s.add_dependency(%q<coffee-script>, ["~> 2"])
148
+ s.add_dependency(%q<uglifier>, [">= 0"])
145
149
  s.add_dependency(%q<mime-types>, [">= 1.16"])
146
150
  end
147
151
  else
@@ -152,6 +156,7 @@ Gem::Specification.new do |s|
152
156
  s.add_dependency(%q<mime-types>, [">= 1.16"])
153
157
  s.add_dependency(%q<git>, [">= 0"])
154
158
  s.add_dependency(%q<coffee-script>, ["~> 2"])
159
+ s.add_dependency(%q<uglifier>, [">= 0"])
155
160
  s.add_dependency(%q<rspec>, ["~> 2.4.0"])
156
161
  s.add_dependency(%q<yard>, ["~> 0.6.0"])
157
162
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -163,6 +168,7 @@ Gem::Specification.new do |s|
163
168
  s.add_dependency(%q<json>, [">= 1.4"])
164
169
  s.add_dependency(%q<sass>, [">= 3.1"])
165
170
  s.add_dependency(%q<coffee-script>, ["~> 2"])
171
+ s.add_dependency(%q<uglifier>, [">= 0"])
166
172
  s.add_dependency(%q<mime-types>, [">= 1.16"])
167
173
  end
168
174
  end
@@ -15,7 +15,6 @@ template_format 'GC.foo.t[{*path*}] = Handlebars.compile({*template*});'
15
15
 
16
16
  cache_method 'path'
17
17
 
18
- after_compile do
19
- a = 1
20
- a + 2
21
- end
18
+ after_compile do |sha|
19
+
20
+ end
@@ -3,4 +3,10 @@
3
3
  // @require two.js
4
4
  // /ASSETTE CONFIG
5
5
 
6
- window.foo = 'foo' || "bar";
6
+ window.foo = 'foo' || "bar";
7
+
8
+ function Foo() {
9
+ var omgz = 'yo';
10
+
11
+ return omgz;
12
+ }
data/lib/assette/cli.rb CHANGED
@@ -155,6 +155,8 @@ module Assette
155
155
  version_file = Assette.config.asset_version_file
156
156
  File.delete(version_file) if File.exist?(version_file)
157
157
  create_file(version_file,sha)
158
+
159
+ Assette.config.after_compile.call(sha)
158
160
  end
159
161
 
160
162
  def initialize(*)
@@ -38,7 +38,8 @@ module Assette
38
38
  :asset_hosts => [],
39
39
  :file_paths => %w{public},
40
40
  :templates_path => 'app/templates',
41
- :template_format => 'AT.t[{*path*}] = {*template*};'
41
+ :template_format => 'AT.t[{*path*}] = {*template*};',
42
+ :after_compile => Proc.new {}
42
43
  }.freeze
43
44
 
44
45
  def initialize args = {}
@@ -0,0 +1,40 @@
1
+ # Available options and their defaults are
2
+ #
3
+ # {
4
+ # :mangle => true, # Mangle variables names
5
+ # :toplevel => false, # Mangle top-level variable names
6
+ # :except => [], # Variable names to be excluded from mangling
7
+ # :max_line_length => 32 * 1024, # Maximum line length
8
+ # :squeeze => true, # Squeeze code resulting in smaller, but less-readable code
9
+ # :seqs => true, # Reduce consecutive statements in blocks into single statement
10
+ # :dead_code => true, # Remove dead code (e.g. after return)
11
+ # :lift_vars => false, # Lift all var declarations at the start of the scope
12
+ # :unsafe => false, # Optimizations known to be unsafe in some situations
13
+ # :copyright => true, # Show copyright message
14
+ # :ascii_only => false, # Encode non-ASCII characters as Unicode code points
15
+ # :inline_script => false, # Escape </script
16
+ # :quote_keys => false, # Quote keys in object literals
17
+ # :beautify => false, # Ouput indented code
18
+ # :beautify_options => {
19
+ # :indent_level => 4,
20
+ # :indent_start => 0,
21
+ # :space_colon => false
22
+ # }
23
+ # }
24
+
25
+ require 'uglifier'
26
+
27
+ module Assette
28
+ class PostProcessor::JSMin < Assette::PostProcessor(:js)
29
+
30
+ def should_process?
31
+ Assette.config.compiling?
32
+ end
33
+
34
+ def processor
35
+ puts @str
36
+ Uglifier.compile(@str)
37
+ end
38
+
39
+ end
40
+ end
@@ -10,6 +10,25 @@ describe Assette::PostProcessor do
10
10
  after(:all) do
11
11
  Dir.chdir(@dir_before)
12
12
  end
13
+
14
+ describe Assette::PostProcessor::JSMin do
15
+ before(:all) do
16
+ Assette.config.compiling = true
17
+ Assette.config.sha = "1234567"
18
+ end
19
+
20
+ after(:all) do
21
+ Assette.config.compiling = nil
22
+ end
23
+
24
+ subject do
25
+ Assette::File.open('public/javascripts/foo.js')
26
+ end
27
+
28
+ it "should minify the js" do
29
+ subject.all_code.should == ''
30
+ end
31
+ end
13
32
 
14
33
  describe Assette::PostProcessor::CacheBuster do
15
34
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assette
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tal Atlas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-22 00:00:00 Z
18
+ date: 2011-12-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -120,6 +120,20 @@ dependencies:
120
120
  requirement: *id007
121
121
  - !ruby/object:Gem::Dependency
122
122
  version_requirements: &id008 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ name: uglifier
132
+ prerelease: false
133
+ type: :runtime
134
+ requirement: *id008
135
+ - !ruby/object:Gem::Dependency
136
+ version_requirements: &id009 !ruby/object:Gem::Requirement
123
137
  none: false
124
138
  requirements:
125
139
  - - ~>
@@ -133,9 +147,9 @@ dependencies:
133
147
  name: rspec
134
148
  prerelease: false
135
149
  type: :development
136
- requirement: *id008
150
+ requirement: *id009
137
151
  - !ruby/object:Gem::Dependency
138
- version_requirements: &id009 !ruby/object:Gem::Requirement
152
+ version_requirements: &id010 !ruby/object:Gem::Requirement
139
153
  none: false
140
154
  requirements:
141
155
  - - ~>
@@ -149,9 +163,9 @@ dependencies:
149
163
  name: yard
150
164
  prerelease: false
151
165
  type: :development
152
- requirement: *id009
166
+ requirement: *id010
153
167
  - !ruby/object:Gem::Dependency
154
- version_requirements: &id010 !ruby/object:Gem::Requirement
168
+ version_requirements: &id011 !ruby/object:Gem::Requirement
155
169
  none: false
156
170
  requirements:
157
171
  - - ~>
@@ -165,9 +179,9 @@ dependencies:
165
179
  name: bundler
166
180
  prerelease: false
167
181
  type: :development
168
- requirement: *id010
182
+ requirement: *id011
169
183
  - !ruby/object:Gem::Dependency
170
- version_requirements: &id011 !ruby/object:Gem::Requirement
184
+ version_requirements: &id012 !ruby/object:Gem::Requirement
171
185
  none: false
172
186
  requirements:
173
187
  - - ~>
@@ -181,9 +195,9 @@ dependencies:
181
195
  name: jeweler
182
196
  prerelease: false
183
197
  type: :development
184
- requirement: *id011
198
+ requirement: *id012
185
199
  - !ruby/object:Gem::Dependency
186
- version_requirements: &id012 !ruby/object:Gem::Requirement
200
+ version_requirements: &id013 !ruby/object:Gem::Requirement
187
201
  none: false
188
202
  requirements:
189
203
  - - ">="
@@ -195,9 +209,9 @@ dependencies:
195
209
  name: rcov
196
210
  prerelease: false
197
211
  type: :development
198
- requirement: *id012
212
+ requirement: *id013
199
213
  - !ruby/object:Gem::Dependency
200
- version_requirements: &id013 !ruby/object:Gem::Requirement
214
+ version_requirements: &id014 !ruby/object:Gem::Requirement
201
215
  none: false
202
216
  requirements:
203
217
  - - ">="
@@ -209,9 +223,9 @@ dependencies:
209
223
  name: rack-test
210
224
  prerelease: false
211
225
  type: :development
212
- requirement: *id013
226
+ requirement: *id014
213
227
  - !ruby/object:Gem::Dependency
214
- version_requirements: &id014 !ruby/object:Gem::Requirement
228
+ version_requirements: &id015 !ruby/object:Gem::Requirement
215
229
  none: false
216
230
  requirements:
217
231
  - - ~>
@@ -223,9 +237,9 @@ dependencies:
223
237
  name: rack
224
238
  prerelease: false
225
239
  type: :runtime
226
- requirement: *id014
240
+ requirement: *id015
227
241
  - !ruby/object:Gem::Dependency
228
- version_requirements: &id015 !ruby/object:Gem::Requirement
242
+ version_requirements: &id016 !ruby/object:Gem::Requirement
229
243
  none: false
230
244
  requirements:
231
245
  - - ~>
@@ -237,9 +251,9 @@ dependencies:
237
251
  name: thor
238
252
  prerelease: false
239
253
  type: :runtime
240
- requirement: *id015
254
+ requirement: *id016
241
255
  - !ruby/object:Gem::Dependency
242
- version_requirements: &id016 !ruby/object:Gem::Requirement
256
+ version_requirements: &id017 !ruby/object:Gem::Requirement
243
257
  none: false
244
258
  requirements:
245
259
  - - ">="
@@ -252,9 +266,9 @@ dependencies:
252
266
  name: json
253
267
  prerelease: false
254
268
  type: :runtime
255
- requirement: *id016
269
+ requirement: *id017
256
270
  - !ruby/object:Gem::Dependency
257
- version_requirements: &id017 !ruby/object:Gem::Requirement
271
+ version_requirements: &id018 !ruby/object:Gem::Requirement
258
272
  none: false
259
273
  requirements:
260
274
  - - ">="
@@ -267,9 +281,9 @@ dependencies:
267
281
  name: sass
268
282
  prerelease: false
269
283
  type: :runtime
270
- requirement: *id017
284
+ requirement: *id018
271
285
  - !ruby/object:Gem::Dependency
272
- version_requirements: &id018 !ruby/object:Gem::Requirement
286
+ version_requirements: &id019 !ruby/object:Gem::Requirement
273
287
  none: false
274
288
  requirements:
275
289
  - - ~>
@@ -281,9 +295,23 @@ dependencies:
281
295
  name: coffee-script
282
296
  prerelease: false
283
297
  type: :runtime
284
- requirement: *id018
298
+ requirement: *id019
285
299
  - !ruby/object:Gem::Dependency
286
- version_requirements: &id019 !ruby/object:Gem::Requirement
300
+ version_requirements: &id020 !ruby/object:Gem::Requirement
301
+ none: false
302
+ requirements:
303
+ - - ">="
304
+ - !ruby/object:Gem::Version
305
+ hash: 3
306
+ segments:
307
+ - 0
308
+ version: "0"
309
+ name: uglifier
310
+ prerelease: false
311
+ type: :runtime
312
+ requirement: *id020
313
+ - !ruby/object:Gem::Dependency
314
+ version_requirements: &id021 !ruby/object:Gem::Requirement
287
315
  none: false
288
316
  requirements:
289
317
  - - ">="
@@ -296,7 +324,7 @@ dependencies:
296
324
  name: mime-types
297
325
  prerelease: false
298
326
  type: :runtime
299
- requirement: *id019
327
+ requirement: *id021
300
328
  description: Renders all asset types (coffeescript/sass/scss) as equals
301
329
  email: me@tal.by
302
330
  executables:
@@ -319,7 +347,6 @@ files:
319
347
  - assette.gemspec
320
348
  - bin/assette
321
349
  - examples/.asset_key
322
- - examples/.assette_pid
323
350
  - examples/config/assets.rb
324
351
  - examples/myapp/templates/bar/index.html.mustache
325
352
  - examples/myapp/templates/foo/_partial.html.mustache
@@ -345,6 +372,7 @@ files:
345
372
  - lib/assette/post_processor.rb
346
373
  - lib/assette/post_processors.rb
347
374
  - lib/assette/post_processors/cache_buster.rb
375
+ - lib/assette/post_processors/js_min.rb
348
376
  - lib/assette/reader.rb
349
377
  - lib/assette/readers.rb
350
378
  - lib/assette/readers/coffee.rb
@@ -1 +0,0 @@
1
- 9709