sinatra-assetpack 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +11 -11
- data/lib/sinatra/assetpack/css.rb +26 -24
- data/lib/sinatra/assetpack/options.rb +3 -1
- data/lib/sinatra/assetpack/version.rb +1 -1
- data/test/app/app.rb +2 -0
- data/test/app/app/css/style.css +1 -0
- data/test/asset_host_test.rb +1 -2
- data/test/preproc_test.rb +7 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d663bf9909c651baf667925dc70d3e434e3df7d5
|
4
|
+
data.tar.gz: 44e7f4b6b69d7ef2de0405d38b64a0d75fc95416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 661a0a911bc4f8deb66185be8ea943d025efb80f26b85a337873830989d4113a7b6e66bbc44b19be9ac1734dae684d9841022f82c2aabbff940449785906ef4f
|
7
|
+
data.tar.gz: 9c4cca3b82255e195c06044604afda72582e5ba09d85081b3ec8230460b9141ef39a4e49c87f760b114cd816e5d795c35b10d2e95cec862e7ca7df544be1e3ae
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�ʬ6�ߛ#=���F���R@2��I�\Ի�2�$����sX�C�'�v�7�����0�Z�{�0+��pz�k��J�5���v�9�/�z7wK���*=�pJ���_��9�nWA�tD��؟�ϖ���3�fsc�Z�Jȕ��Y
|
1
|
+
$����$ܯ���P��~��W!7�բ�W�@�`�Z7��<����j3�#7/�O�2�`�8�E_ar$q��}ʲ�2,A¹����x]����9A��Jݹ���Y�Λc��+f�ӂ1��M�����)<_��D�^ȏ��\QD8�=��X��̰�%v��=����JAa� k�1���:����gv����,G�^Rƙnlq���{C�r��<<����]�Ll�$Z��LJ�;��ֹ���s�dO�� sF@�
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sinatra-assetpack (0.2.
|
4
|
+
sinatra-assetpack (0.2.8)
|
5
5
|
jsmin
|
6
6
|
rack-test
|
7
7
|
sinatra
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
coffee-script (2.2.0)
|
19
19
|
coffee-script-source
|
20
20
|
execjs
|
21
|
-
coffee-script-source (1.6.
|
21
|
+
coffee-script-source (1.6.2)
|
22
22
|
columnize (0.3.6)
|
23
23
|
commonjs (0.2.6)
|
24
24
|
contest (0.1.3)
|
@@ -31,33 +31,33 @@ GEM
|
|
31
31
|
execjs (1.4.0)
|
32
32
|
multi_json (~> 1.0)
|
33
33
|
gem-release (0.6.0)
|
34
|
-
haml (4.0.
|
34
|
+
haml (4.0.3)
|
35
35
|
tilt
|
36
36
|
jsmin (1.0.1)
|
37
|
-
less (2.3.
|
37
|
+
less (2.3.2)
|
38
38
|
commonjs (~> 0.2.6)
|
39
39
|
metaclass (0.0.1)
|
40
|
-
mocha (0.
|
40
|
+
mocha (0.14.0)
|
41
41
|
metaclass (~> 0.0.1)
|
42
|
-
multi_json (1.7.
|
42
|
+
multi_json (1.7.7)
|
43
43
|
open4 (1.3.0)
|
44
44
|
rack (1.5.2)
|
45
45
|
rack-protection (1.5.0)
|
46
46
|
rack
|
47
47
|
rack-test (0.6.2)
|
48
48
|
rack (>= 1.0)
|
49
|
-
rake (10.0
|
50
|
-
sass (3.2.
|
49
|
+
rake (10.1.0)
|
50
|
+
sass (3.2.9)
|
51
51
|
sinatra (1.4.3)
|
52
52
|
rack (~> 1.4)
|
53
53
|
rack-protection (~> 1.4)
|
54
54
|
tilt (~> 1.3, >= 1.3.4)
|
55
|
-
stylus (0.7.
|
55
|
+
stylus (0.7.2)
|
56
56
|
execjs
|
57
57
|
stylus-source
|
58
58
|
stylus-source (0.31.0)
|
59
|
-
tilt (1.
|
60
|
-
uglifier (1.
|
59
|
+
tilt (1.4.1)
|
60
|
+
uglifier (2.1.1)
|
61
61
|
execjs (>= 0.3.0)
|
62
62
|
multi_json (~> 1.0, >= 1.0.2)
|
63
63
|
yui-compressor (0.9.6)
|
@@ -3,32 +3,34 @@ require 'uri'
|
|
3
3
|
module Sinatra
|
4
4
|
module AssetPack
|
5
5
|
module Css
|
6
|
-
def self.preproc(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
6
|
+
def self.preproc(source, assets)
|
7
|
+
source.gsub(/url\((["']?)(.*?)(["']?)\)/) do |match|
|
8
|
+
uri = URI.parse($2)
|
9
|
+
|
10
|
+
# Not a valid complete url
|
11
|
+
next match if uri.path.nil?
|
12
|
+
|
13
|
+
# Not found in served assets
|
14
|
+
local = assets.local_file_for(uri.path)
|
15
|
+
next match if local.nil?
|
16
|
+
|
17
|
+
asset_url = build_url(assets, local, uri)
|
18
|
+
"url(#{$1}#{asset_url}#{$3})"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build_url(assets, local, uri)
|
23
|
+
if uri.query && uri.query.include?('embed')
|
24
|
+
build_data_uri(local)
|
25
|
+
else
|
26
|
+
serve = URI(HtmlHelpers.get_file_uri(uri.path, assets))
|
27
|
+
serve.query = uri.query
|
28
|
+
serve.fragment = uri.fragment
|
29
|
+
serve.to_s
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
|
-
def self.
|
33
|
+
def self.build_data_uri(file)
|
32
34
|
require 'base64'
|
33
35
|
|
34
36
|
data = File.read(file)
|
@@ -218,7 +218,9 @@ module Sinatra
|
|
218
218
|
return if !from
|
219
219
|
|
220
220
|
path = File.join(expand_from(from), request.sub(serve_path, ''))
|
221
|
-
|
221
|
+
return if !File.file?(path)
|
222
|
+
|
223
|
+
path
|
222
224
|
end
|
223
225
|
|
224
226
|
# Returns the local file for a given URI path. (for dynamic files)
|
data/test/app/app.rb
CHANGED
data/test/app/app/css/style.css
CHANGED
data/test/asset_host_test.rb
CHANGED
@@ -54,8 +54,7 @@ class AssetHostTest < UnitTest
|
|
54
54
|
app.stubs(:development?).returns(false)
|
55
55
|
get '/css/style.css'
|
56
56
|
assert body =~ /background: url\(\/\/cdn-[0|1].example.org\/images\/background.[a-f0-9]{32}.jpg\)/
|
57
|
-
|
58
|
-
# does not alter non-existing files (design or flaw???)
|
57
|
+
# Does not alter not served assets
|
59
58
|
assert body.include?('background: url(/images/404.png)')
|
60
59
|
end
|
61
60
|
|
data/test/preproc_test.rb
CHANGED
@@ -15,12 +15,18 @@ class PreprocTest < UnitTest
|
|
15
15
|
assert body =~ %r{background.[a-f0-9]{32}.jpg}
|
16
16
|
end
|
17
17
|
|
18
|
-
test "no cache-busting
|
18
|
+
test "no cache-busting hash for non-existent images" do
|
19
19
|
app.stubs(:development?).returns(false)
|
20
20
|
get '/css/style.css'
|
21
21
|
assert body.include?('background: url(/images/404.png)')
|
22
22
|
end
|
23
23
|
|
24
|
+
test "no cache-busting hash for non-existent images" do
|
25
|
+
app.stubs(:development?).returns(false)
|
26
|
+
get '/css/style.css'
|
27
|
+
assert body.include?("@import url('//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700');")
|
28
|
+
end
|
29
|
+
|
24
30
|
test "preproc on minify" do
|
25
31
|
app.stubs(:clear_cache).returns(true)
|
26
32
|
app.stubs(:development?).returns(false)
|
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.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rico Sta. Cruz
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
kzgF4O2OL+8O23we4E1LvfRn5gV77Dij6s9V4HHzMBuLwnNb8T+6lOnUWbtiIddD
|
31
31
|
e8c8i7PlrzhVJ/8sXUJsCkyE8d2MyRyjlxM=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2013-06-
|
33
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: jsmin
|
metadata.gz.sig
CHANGED
Binary file
|