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.
@@ -24,6 +24,12 @@ module Pubba
24
24
  @asset_minifier = Pubba::Assets::YUIMinifier
25
25
  @script_folder = 'js'
26
26
  @style_folder = 'css'
27
+
28
+ init_asset_host
29
+ end
30
+
31
+ def init_asset_host
32
+ @asset_host = -> asset {asset}
27
33
  end
28
34
 
29
35
  def validate_settings
@@ -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
- contents = File.read(file)
11
- File.open(file, "w") {|f| f.write(compressor.compress(contents))}
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
 
@@ -10,7 +10,7 @@ module Pubba
10
10
  end
11
11
 
12
12
  def digest_url(url)
13
- url.start_with?('http') ? url : Site.asset_host[::Statica.digest_url(url)]
13
+ url.start_with?('http') ? url : Pubba.asset_host[::Statica.digest_url(url)]
14
14
  end
15
15
 
16
16
  private
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Pubba
2
2
  # Pubba version string
3
3
  # @api public
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.1'
5
5
  end
@@ -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::Site.asset_host = -> asset {"http://myasset.mydomain.com#{asset}"}
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::Site.asset_host = nil
28
+ Pubba.init_asset_host
29
29
  end
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: