sundawg-sinatra-assetpack-fork 0.0.12.pre1 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +17 -0
  3. data/CONTRIBUTING.md +27 -0
  4. data/Gemfile +2 -1
  5. data/Gemfile.lock +72 -0
  6. data/HISTORY.md +60 -1
  7. data/README.md +54 -11
  8. data/examples/basic/app.rb +12 -1
  9. data/lib/sinatra/assetpack.rb +1 -1
  10. data/lib/sinatra/assetpack/class_methods.rb +8 -6
  11. data/lib/sinatra/assetpack/compressor.rb +1 -0
  12. data/lib/sinatra/assetpack/css.rb +1 -1
  13. data/lib/sinatra/assetpack/engines/less.rb +11 -0
  14. data/lib/sinatra/assetpack/helpers.rb +13 -3
  15. data/lib/sinatra/assetpack/html_helpers.rb +12 -0
  16. data/lib/sinatra/assetpack/image.rb +2 -2
  17. data/lib/sinatra/assetpack/options.rb +24 -9
  18. data/lib/sinatra/assetpack/package.rb +15 -8
  19. data/lib/sinatra/assetpack/version.rb +1 -1
  20. data/sinatra-assetpack.gemspec +5 -0
  21. data/test/app/app.rb +8 -1
  22. data/test/app/app/fonts/cantarell-regular-webfont.eot +0 -0
  23. data/test/app/app/fonts/cantarell-regular-webfont.svg +18 -0
  24. data/test/app/app/fonts/cantarell-regular-webfont.ttf +0 -0
  25. data/test/app/app/fonts/cantarell-regular-webfont.woff +0 -0
  26. data/test/app/app/js/jquery-1.8.0.min.js +1 -0
  27. data/test/app/app/packages/a_package/package.css +1 -0
  28. data/test/app/app/packages/a_package/package.js +1 -0
  29. data/test/app/app/packages/a_package/package.png +0 -0
  30. data/test/app/config.ru +2 -0
  31. data/test/arity_test.rb +8 -2
  32. data/test/cache_test.rb +17 -1
  33. data/test/glob_test.rb +3 -0
  34. data/test/ignore_test.rb +2 -2
  35. data/test/img_test.rb +2 -2
  36. data/test/local_file_test.rb +6 -0
  37. data/test/mime_type_test.rb +20 -0
  38. data/test/redundant_test.rb +1 -0
  39. data/test/sqwish_test.rb +4 -3
  40. data/test/test_helper.rb +6 -1
  41. data/test/tilt_test.rb +1 -0
  42. data/test/unit_test.rb +42 -5
  43. metadata +207 -189
  44. data/lib/sinatra/assetpack/hasharray.rb +0 -66
data/test/unit_test.rb CHANGED
@@ -49,6 +49,11 @@ class AppTest < UnitTest
49
49
  assert last_response.status == 404
50
50
  end
51
51
 
52
+ test 'returns file of requested type when mixed type assets of varying extension are present' do
53
+ get '/packages/a_package.010101.js'
54
+ assert body.include? 'function(){alert("Hello");'
55
+ end
56
+
52
57
  test 'static css' do
53
58
  get '/css/style.css'
54
59
  assert body.include?('div { color: red; }')
@@ -72,15 +77,14 @@ class AppTest < UnitTest
72
77
  end
73
78
 
74
79
  test "helpers in production (compressed html thingie)" do
75
- app.expects(:production?).returns(true)
80
+ app.expects(:environment).returns(:production)
76
81
  get '/index.html'
77
82
  assert body =~ /<script src='\/js\/app.[0-9]+.js'><\/script>/
78
83
  end
79
84
 
80
- test "compressed js" do
81
- get '/js/app.js'
82
- assert body.include? 'function(){alert("Hello");'
83
- assert_includes body, "var x;x=function(){"
85
+ test "file with multiple dots in name" do
86
+ get '/js/jquery-1.8.0.min.js'
87
+ assert body.include? '$(function() { alert("Hello"); });'
84
88
  end
85
89
 
86
90
  test "compressed js with cache bust" do
@@ -103,4 +107,37 @@ class AppTest < UnitTest
103
107
  get '/helpers/css'
104
108
  assert body =~ %r{link rel='stylesheet' href='/css/screen.[0-9]+.css' media='screen'}
105
109
  end
110
+
111
+ test 'default expiration of single assets' do
112
+ get '/js/hi.js'
113
+ assert_equal "public, max-age=#{86400*30}", last_response.headers['Cache-Control']
114
+ assert_equal (Time.now + (86400*30)).httpdate, last_response.headers['Expires']
115
+ end
116
+
117
+ test 'custom expiration of single assets' do
118
+ app.settings.assets.expires 86400*365, :public
119
+
120
+ get '/js/hi.js'
121
+ assert_equal "public, max-age=#{86400*365}", last_response.headers['Cache-Control']
122
+ assert_equal (Time.now + (86400*365)).httpdate, last_response.headers['Expires']
123
+
124
+ app.settings.assets.instance_variable_set('@expires', nil)
125
+ end
126
+
127
+ test 'default expiration of packed assets' do
128
+ get '/js/app.js'
129
+ assert_equal "public, max-age=#{86400*30}", last_response.headers['Cache-Control']
130
+ assert_equal (Time.now + (86400*30)).httpdate, last_response.headers['Expires']
131
+ end
132
+
133
+ test 'custom expiration of packed assets' do
134
+ app.settings.assets.expires 86400*365, :public
135
+
136
+ get '/js/app.js'
137
+ assert_equal "public, max-age=#{86400*365}", last_response.headers['Cache-Control']
138
+ assert_equal (Time.now + (86400*365)).httpdate, last_response.headers['Expires']
139
+
140
+ app.settings.assets.instance_variable_set('@expires', nil)
141
+ end
142
+
106
143
  end
metadata CHANGED
@@ -1,217 +1,219 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sundawg-sinatra-assetpack-fork
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.12.pre1
5
- prerelease: 7
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 6
9
+ version: 0.1.6
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Rico Sta. Cruz
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-10-14 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2013-03-03 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: tilt
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 1.3.0
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 0
29
31
  version: 1.3.0
30
- - !ruby/object:Gem::Dependency
31
- name: sinatra
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
32
  type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: sinatra
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: jsmin
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
54
44
  type: :runtime
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: jsmin
55
48
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ type: :runtime
57
+ version_requirements: *id003
58
+ - !ruby/object:Gem::Dependency
63
59
  name: rack-test
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
60
+ prerelease: false
61
+ requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
70
68
  type: :runtime
69
+ version_requirements: *id004
70
+ - !ruby/object:Gem::Dependency
71
+ name: backports
71
72
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
73
+ requirement: &id005 !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :runtime
81
+ version_requirements: *id005
82
+ - !ruby/object:Gem::Dependency
79
83
  name: yui-compressor
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
84
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: sass
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
85
+ requirement: &id006 !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
91
+ version: "0"
102
92
  type: :development
93
+ version_requirements: *id006
94
+ - !ruby/object:Gem::Dependency
95
+ name: sass
103
96
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: haml
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
97
+ requirement: &id007 !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
118
104
  type: :development
105
+ version_requirements: *id007
106
+ - !ruby/object:Gem::Dependency
107
+ name: haml
119
108
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: coffee-script
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
109
+ requirement: &id008 !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ segments:
114
+ - 0
115
+ version: "0"
134
116
  type: :development
117
+ version_requirements: *id008
118
+ - !ruby/object:Gem::Dependency
119
+ name: coffee-script
135
120
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: contest
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
- requirements:
147
- - - ! '>='
148
- - !ruby/object:Gem::Version
149
- version: '0'
121
+ requirement: &id009 !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ version: "0"
150
128
  type: :development
129
+ version_requirements: *id009
130
+ - !ruby/object:Gem::Dependency
131
+ name: contest
151
132
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: mocha
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
133
+ requirement: &id010 !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ segments:
138
+ - 0
139
+ version: "0"
166
140
  type: :development
141
+ version_requirements: *id010
142
+ - !ruby/object:Gem::Dependency
143
+ name: mocha
167
144
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- - !ruby/object:Gem::Dependency
175
- name: stylus
176
- requirement: !ruby/object:Gem::Requirement
177
- none: false
178
- requirements:
179
- - - ! '>='
180
- - !ruby/object:Gem::Version
181
- version: '0'
145
+ requirement: &id011 !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ segments:
150
+ - 0
151
+ version: "0"
182
152
  type: :development
153
+ version_requirements: *id011
154
+ - !ruby/object:Gem::Dependency
155
+ name: stylus
183
156
  prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- - !ruby/object:Gem::Dependency
157
+ requirement: &id012 !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ type: :development
165
+ version_requirements: *id012
166
+ - !ruby/object:Gem::Dependency
191
167
  name: uglifier
192
- requirement: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ! '>='
196
- - !ruby/object:Gem::Version
197
- version: '0'
168
+ prerelease: false
169
+ requirement: &id013 !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ segments:
174
+ - 0
175
+ version: "0"
198
176
  type: :development
177
+ version_requirements: *id013
178
+ - !ruby/object:Gem::Dependency
179
+ name: rake
199
180
  prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
181
+ requirement: &id014 !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ segments:
186
+ - 0
187
+ version: "0"
188
+ type: :development
189
+ version_requirements: *id014
190
+ - !ruby/object:Gem::Dependency
191
+ name: less
192
+ prerelease: false
193
+ requirement: &id015 !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ type: :development
201
+ version_requirements: *id015
206
202
  description: Package your assets for Sinatra.
207
- email:
203
+ email:
208
204
  - rico@sinefunc.com
209
205
  executables: []
206
+
210
207
  extensions: []
208
+
211
209
  extra_rdoc_files: []
212
- files:
210
+
211
+ files:
213
212
  - .gitignore
213
+ - .travis.yml
214
+ - CONTRIBUTING.md
214
215
  - Gemfile
216
+ - Gemfile.lock
215
217
  - HISTORY.md
216
218
  - README.md
217
219
  - Rakefile
@@ -252,12 +254,12 @@ files:
252
254
  - lib/sinatra/assetpack/engine.rb
253
255
  - lib/sinatra/assetpack/engines/closure.rb
254
256
  - lib/sinatra/assetpack/engines/jsmin.rb
257
+ - lib/sinatra/assetpack/engines/less.rb
255
258
  - lib/sinatra/assetpack/engines/sass.rb
256
259
  - lib/sinatra/assetpack/engines/simple.rb
257
260
  - lib/sinatra/assetpack/engines/sqwish.rb
258
261
  - lib/sinatra/assetpack/engines/uglify.rb
259
262
  - lib/sinatra/assetpack/engines/yui.rb
260
- - lib/sinatra/assetpack/hasharray.rb
261
263
  - lib/sinatra/assetpack/helpers.rb
262
264
  - lib/sinatra/assetpack/html_helpers.rb
263
265
  - lib/sinatra/assetpack/image.rb
@@ -276,6 +278,10 @@ files:
276
278
  - test/app/app/css/style.css
277
279
  - test/app/app/css/stylus.styl
278
280
  - test/app/app/css_stylus/stylus.styl
281
+ - test/app/app/fonts/cantarell-regular-webfont.eot
282
+ - test/app/app/fonts/cantarell-regular-webfont.svg
283
+ - test/app/app/fonts/cantarell-regular-webfont.ttf
284
+ - test/app/app/fonts/cantarell-regular-webfont.woff
279
285
  - test/app/app/images/background.jpg
280
286
  - test/app/app/images/email.png
281
287
  - test/app/app/js/_ignoreme.js
@@ -283,12 +289,17 @@ files:
283
289
  - test/app/app/js/hello.js
284
290
  - test/app/app/js/helloe.js
285
291
  - test/app/app/js/hi.coffee
292
+ - test/app/app/js/jquery-1.8.0.min.js
286
293
  - test/app/app/js/ugly.js
287
294
  - test/app/app/js/yoe.coffee
288
295
  - test/app/app/js_glob/a/b/c1/hello.js
289
296
  - test/app/app/js_glob/a/b/c2/hi.js
290
297
  - test/app/app/js_glob/a/b/c2/hola.js
298
+ - test/app/app/packages/a_package/package.css
299
+ - test/app/app/packages/a_package/package.js
300
+ - test/app/app/packages/a_package/package.png
291
301
  - test/app/app/views/index.haml
302
+ - test/app/config.ru
292
303
  - test/arity_test.rb
293
304
  - test/build_test.rb
294
305
  - test/cache_test.rb
@@ -314,28 +325,35 @@ files:
314
325
  - test/uglifier_test.rb
315
326
  - test/unit_test.rb
316
327
  - test/yui_test.rb
328
+ has_rdoc: true
317
329
  homepage: http://github.com/rstacruz/sinatra-assetpack
318
330
  licenses: []
331
+
319
332
  post_install_message:
320
333
  rdoc_options: []
321
- require_paths:
334
+
335
+ require_paths:
322
336
  - lib
323
- required_ruby_version: !ruby/object:Gem::Requirement
324
- none: false
325
- requirements:
326
- - - ! '>='
327
- - !ruby/object:Gem::Version
328
- version: '0'
329
- required_rubygems_version: !ruby/object:Gem::Requirement
330
- none: false
331
- requirements:
332
- - - ! '>'
333
- - !ruby/object:Gem::Version
334
- version: 1.3.1
337
+ required_ruby_version: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - ">="
340
+ - !ruby/object:Gem::Version
341
+ segments:
342
+ - 0
343
+ version: "0"
344
+ required_rubygems_version: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - ">="
347
+ - !ruby/object:Gem::Version
348
+ segments:
349
+ - 0
350
+ version: "0"
335
351
  requirements: []
352
+
336
353
  rubyforge_project:
337
- rubygems_version: 1.8.24
354
+ rubygems_version: 1.3.6
338
355
  signing_key:
339
356
  specification_version: 3
340
357
  summary: Asset packager for Sinatra.
341
358
  test_files: []
359
+