sinatra-assetpack 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +8 -0
- data/README.md +5 -0
- data/lib/sinatra/assetpack/class_methods.rb +6 -5
- data/lib/sinatra/assetpack/compressor.rb +1 -0
- data/lib/sinatra/assetpack/engines/less.rb +11 -0
- data/lib/sinatra/assetpack/options.rb +7 -2
- data/lib/sinatra/assetpack/version.rb +1 -1
- data/sinatra-assetpack.gemspec +1 -0
- data/test/app/app.rb +1 -0
- data/test/app/app/fonts/cantarell-regular-webfont.eot +0 -0
- data/test/app/app/fonts/cantarell-regular-webfont.svg +18 -0
- data/test/app/app/fonts/cantarell-regular-webfont.ttf +0 -0
- data/test/app/app/fonts/cantarell-regular-webfont.woff +0 -0
- data/test/app/config.ru +2 -0
- data/test/local_file_test.rb +6 -0
- data/test/mime_type_test.rb +25 -0
- data/test/tilt_test.rb +1 -0
- metadata +24 -2
data/HISTORY.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
v0.1.1 - Jan 15, 2013
|
2
|
+
----------------------
|
3
|
+
|
4
|
+
### Fixed
|
5
|
+
* Added less engine support and test (#69)
|
6
|
+
* Support for fonts & other AssetPack.supported_formats file format. (#50)
|
7
|
+
* Deal with multiple static files with same name but different extensions (ex. fonts).
|
8
|
+
|
1
9
|
v0.1.0 - Jan 14, 2013
|
2
10
|
----------------------
|
3
11
|
|
data/README.md
CHANGED
@@ -43,9 +43,9 @@ module Sinatra
|
|
43
43
|
|
44
44
|
# Sanity checks
|
45
45
|
pass unless AssetPack.supported_formats.include?(fmt)
|
46
|
-
fn = asset_path_for(file, from)
|
46
|
+
fn = asset_path_for(file, from) or pass
|
47
47
|
|
48
|
-
pass
|
48
|
+
pass if settings.assets.ignored?("#{path}/#{file}")
|
49
49
|
|
50
50
|
# Send headers
|
51
51
|
content_type fmt.to_sym
|
@@ -55,12 +55,13 @@ module Sinatra
|
|
55
55
|
format = File.extname(fn)[1..-1]
|
56
56
|
|
57
57
|
if AssetPack.supported_formats.include?(format)
|
58
|
-
#
|
59
|
-
not_found unless format == fmt
|
60
|
-
|
58
|
+
# Static file
|
61
59
|
if fmt == 'css'
|
60
|
+
# Matching static file format
|
61
|
+
pass unless fmt == File.extname(fn)[1..-1]
|
62
62
|
@template_cache.fetch(fn) { asset_filter_css File.read(fn) }
|
63
63
|
else
|
64
|
+
# It's a raw file, just send it
|
64
65
|
send_file fn
|
65
66
|
end
|
66
67
|
else
|
@@ -47,6 +47,7 @@ module Sinatra
|
|
47
47
|
require "#{AssetPack::PREFIX}/assetpack/engines/jsmin"
|
48
48
|
require "#{AssetPack::PREFIX}/assetpack/engines/yui"
|
49
49
|
require "#{AssetPack::PREFIX}/assetpack/engines/sass"
|
50
|
+
require "#{AssetPack::PREFIX}/assetpack/engines/less"
|
50
51
|
require "#{AssetPack::PREFIX}/assetpack/engines/sqwish"
|
51
52
|
require "#{AssetPack::PREFIX}/assetpack/engines/closure"
|
52
53
|
require "#{AssetPack::PREFIX}/assetpack/engines/uglify"
|
@@ -245,11 +245,16 @@ module Sinatra
|
|
245
245
|
file.sub(/^(.*)(\.[^\.]+)$/) { file, extension = $1, $2 }
|
246
246
|
|
247
247
|
# Remove cache-buster (/js/app.28389.js => /js/app)
|
248
|
-
file = $1
|
248
|
+
file = $1 if file =~ /^(.*)\.[0-9]+$/
|
249
249
|
|
250
250
|
matches = Dir[File.join(app.root, from, "#{file}.*")]
|
251
|
+
|
251
252
|
# Fix for filenames with dots (can't do this with glob)
|
252
|
-
matches.select { |f| f =~ /#{file}\.[^.]+$/ }
|
253
|
+
matches.select! { |f| f =~ /#{file}\.[^.]+$/ }
|
254
|
+
|
255
|
+
# Sort static file match first
|
256
|
+
matches.sort! { |f| File.basename(f) == "#{file}#{extension}" ? -1 : 1 }
|
257
|
+
matches.first
|
253
258
|
end
|
254
259
|
|
255
260
|
# Writes `public/#{path}` based on contents of `output`.
|
data/sinatra-assetpack.gemspec
CHANGED
data/test/app/app.rb
CHANGED
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<metadata></metadata>
|
5
|
+
<defs>
|
6
|
+
<font id="cantarellregular" horiz-adv-x="748" >
|
7
|
+
<font-face units-per-em="2048" ascent="1513" descent="-535" />
|
8
|
+
<missing-glyph horiz-adv-x="559" />
|
9
|
+
<glyph horiz-adv-x="2048" />
|
10
|
+
<glyph horiz-adv-x="2048" />
|
11
|
+
<glyph unicode="
" horiz-adv-x="682" />
|
12
|
+
<glyph unicode=" " horiz-adv-x="559" />
|
13
|
+
<glyph unicode="	" horiz-adv-x="559" />
|
14
|
+
<glyph unicode=" " horiz-adv-x="559" />
|
15
|
+
<glyph unicode="A" horiz-adv-x="1382" d="M129 0l506 1421h192l506 -1421h-172l-143 414h-588l-143 -414h-158zM481 561h484l-240 694z" />
|
16
|
+
<glyph unicode="" horiz-adv-x="985" d="M0 0v985h985v-985h-985z" />
|
17
|
+
</font>
|
18
|
+
</defs></svg>
|
Binary file
|
Binary file
|
data/test/app/config.ru
ADDED
data/test/local_file_test.rb
CHANGED
@@ -6,6 +6,7 @@ class LocalFileTest < UnitTest
|
|
6
6
|
|
7
7
|
assets {
|
8
8
|
css :application, [ '/css/*.css' ]
|
9
|
+
serve '/fonts', :from => 'app/fonts'
|
9
10
|
}
|
10
11
|
end
|
11
12
|
|
@@ -14,6 +15,11 @@ class LocalFileTest < UnitTest
|
|
14
15
|
assert_equal r('app/images/background.jpg'), fn
|
15
16
|
end
|
16
17
|
|
18
|
+
test "local file for (in existing files, custom serve path)" do
|
19
|
+
fn = App.assets.local_file_for '/fonts/cantarell-regular-webfont.ttf'
|
20
|
+
assert_equal r('app/fonts/cantarell-regular-webfont.ttf'), fn
|
21
|
+
end
|
22
|
+
|
17
23
|
test "local file for (in nonexisting files)" do
|
18
24
|
fn = App.assets.local_file_for '/images/404.jpg'
|
19
25
|
assert fn.nil?
|
data/test/mime_type_test.rb
CHANGED
@@ -30,4 +30,29 @@ class AppTest < UnitTest
|
|
30
30
|
get '/skitch.js'
|
31
31
|
assert last_response.content_type =~ %r[^.*?/javascript]
|
32
32
|
end
|
33
|
+
|
34
|
+
test 'eot' do
|
35
|
+
get '/fonts/cantarell-regular-webfont.eot'
|
36
|
+
assert last_response.content_type =~ %r[^application/vnd.ms-fontobject]
|
37
|
+
end
|
38
|
+
|
39
|
+
test 'svg' do
|
40
|
+
get '/fonts/cantarell-regular-webfont.svg'
|
41
|
+
assert last_response.content_type =~ %r[^image/svg\+xml]
|
42
|
+
end
|
43
|
+
|
44
|
+
test 'ttf' do
|
45
|
+
get '/fonts/cantarell-regular-webfont.ttf'
|
46
|
+
assert last_response.content_type =~ %r[^application/octet-stream]
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'woff' do
|
50
|
+
get '/fonts/cantarell-regular-webfont.woff'
|
51
|
+
assert last_response.content_type =~ %r[^application/font-woff]
|
52
|
+
end
|
53
|
+
|
54
|
+
test 'woff' do
|
55
|
+
get '/fonts/cantarell-regular-webfont.woff'
|
56
|
+
assert last_response.content_type =~ %r[^application/font-woff]
|
57
|
+
end
|
33
58
|
end
|
data/test/tilt_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-assetpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tilt
|
@@ -219,6 +219,22 @@ dependencies:
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
none: false
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: less
|
224
|
+
prerelease: false
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ! '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
none: false
|
231
|
+
type: :development
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ! '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
none: false
|
222
238
|
description: Package your assets for Sinatra.
|
223
239
|
email:
|
224
240
|
- rico@sinefunc.com
|
@@ -269,6 +285,7 @@ files:
|
|
269
285
|
- lib/sinatra/assetpack/engine.rb
|
270
286
|
- lib/sinatra/assetpack/engines/closure.rb
|
271
287
|
- lib/sinatra/assetpack/engines/jsmin.rb
|
288
|
+
- lib/sinatra/assetpack/engines/less.rb
|
272
289
|
- lib/sinatra/assetpack/engines/sass.rb
|
273
290
|
- lib/sinatra/assetpack/engines/simple.rb
|
274
291
|
- lib/sinatra/assetpack/engines/sqwish.rb
|
@@ -293,6 +310,10 @@ files:
|
|
293
310
|
- test/app/app/css/style.css
|
294
311
|
- test/app/app/css/stylus.styl
|
295
312
|
- test/app/app/css_stylus/stylus.styl
|
313
|
+
- test/app/app/fonts/cantarell-regular-webfont.eot
|
314
|
+
- test/app/app/fonts/cantarell-regular-webfont.svg
|
315
|
+
- test/app/app/fonts/cantarell-regular-webfont.ttf
|
316
|
+
- test/app/app/fonts/cantarell-regular-webfont.woff
|
296
317
|
- test/app/app/images/background.jpg
|
297
318
|
- test/app/app/images/email.png
|
298
319
|
- test/app/app/js/_ignoreme.js
|
@@ -306,6 +327,7 @@ files:
|
|
306
327
|
- test/app/app/js_glob/a/b/c2/hi.js
|
307
328
|
- test/app/app/js_glob/a/b/c2/hola.js
|
308
329
|
- test/app/app/views/index.haml
|
330
|
+
- test/app/config.ru
|
309
331
|
- test/arity_test.rb
|
310
332
|
- test/build_test.rb
|
311
333
|
- test/cache_test.rb
|