pubba 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pubba.rb +6 -0
- data/lib/pubba/assets/yui_minifier.rb +6 -2
- data/lib/pubba/html/helpers.rb +1 -1
- data/lib/pubba/site.rb +0 -8
- data/lib/pubba/version.rb +1 -1
- data/test/pubba/html/test_helpers.rb +2 -2
- metadata +1 -1
data/lib/pubba.rb
CHANGED
@@ -7,8 +7,12 @@ module Pubba
|
|
7
7
|
def self.minify(folder, handler)
|
8
8
|
compressor = get_compressor(handler)
|
9
9
|
Dir.glob("#{folder}/*.*") do |file|
|
10
|
-
|
11
|
-
|
10
|
+
begin
|
11
|
+
compressed_contents = compressor.compress( File.read(file) )
|
12
|
+
File.open(file, "w") {|f| f.write( compressed_contents) }
|
13
|
+
rescue YUI::Compressor::RuntimeError => e
|
14
|
+
puts "> Compressor encountered an error in #{file}"
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
|
data/lib/pubba/html/helpers.rb
CHANGED
data/lib/pubba/site.rb
CHANGED
@@ -47,14 +47,6 @@ module Pubba
|
|
47
47
|
Pubba.asset_minifier.minify(public_style_folder, :css)
|
48
48
|
end
|
49
49
|
|
50
|
-
def asset_host=(p)
|
51
|
-
@asset_host = p
|
52
|
-
end
|
53
|
-
|
54
|
-
def asset_host
|
55
|
-
@asset_host ||= -> asset {asset}
|
56
|
-
end
|
57
|
-
|
58
50
|
def maybe_init_r18n
|
59
51
|
return unless Pubba.r18n_folder
|
60
52
|
|
data/lib/pubba/version.rb
CHANGED
@@ -20,11 +20,11 @@ class TestPubbaHTMLHelper < TestPubba
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_home_page_body_tags_with_asset_host
|
23
|
-
Pubba
|
23
|
+
Pubba.asset_host = -> asset {"http://myasset.mydomain.com#{asset}"}
|
24
24
|
res = get('/home-page-body-tags').body
|
25
25
|
reg = Regexp.new '<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script><script src="http://myasset.mydomain.com/js/home-body.js/\w+" type="text/javascript"></script>'
|
26
26
|
|
27
27
|
assert_match reg, res
|
28
|
-
Pubba
|
28
|
+
Pubba.init_asset_host
|
29
29
|
end
|
30
30
|
end
|