cyborg 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d8b08048534b62f35c83ac4f8c353086245959a
4
- data.tar.gz: 4c60ed9cb6a9c40ca3f1de57c10fd6ae99ec67b1
3
+ metadata.gz: fcb6cfc1ed5a818503a94a5b7fef6fb0ad4486a7
4
+ data.tar.gz: c8d676709ec57add85191063867c6032b1594f92
5
5
  SHA512:
6
- metadata.gz: 1ea65d049e68aedfc0977cd759245e3ccad938b61b8ab1c77e381bf4514010f3cc809cfae224c4d458a55e03c5f1cd219a282cb01166b7c63c667aed2b460c07
7
- data.tar.gz: a332f85c88c83f073c15d5b174ff974cd6ce19317398d63bf8e832241b722303998f1319ba8c336ea39a978836c82ad438519d529f78b7e308d75257f313c7a4
6
+ metadata.gz: 02844216991140690fb61a15488de0486ea50e48991fd0c1b4f118e6c494ff57c692e5663a2dcafeea730daf56385c748a7afa0c32f2e88c5bc3a9c6fceeb5c1
7
+ data.tar.gz: ec49d9b1570cc577410e80068987476aef18907c1397aca573a7e768cafeb8eded653b35ee4333b4583625e56e19f3a481d8213fda1a56e3044dd1ae398f9eeb
data/lib/cyborg.rb CHANGED
@@ -16,6 +16,10 @@ module Cyborg
16
16
  ENV['CI'] || ENV['RAILS_ENV'] == 'production' || Command.production?
17
17
  end
18
18
 
19
+ def gzip_assets?
20
+ production? && plugin.gzip_in_production?
21
+ end
22
+
19
23
  def plugin
20
24
  @plugin
21
25
  end
@@ -12,7 +12,7 @@ module Cyborg
12
12
 
13
13
  stylesheet_url(args).each do |url|
14
14
  tag = stylesheet_link_tag url, options
15
- tag.gsub(/\.css/i, ".css.gz") if Cyborg.production? && request.accept_encoding =~ /gzip/i
15
+ tag = tag.gsub(/\.css/i, ".css.gz") if request.accept_encoding =~ /gzip/i && Cyborg.gzip_assets?
16
16
  tags += tag
17
17
  end
18
18
 
@@ -26,7 +26,7 @@ module Cyborg
26
26
  puts "searching for: #{javascript_url(args)}"
27
27
  javascript_url(args).each do |url|
28
28
  tag = javascript_include_tag url, options
29
- tag.gsub(/\.js/i, ".js.gz") if Cyborg.production? && request.accept_encoding =~ /gzip/i
29
+ tag = tag.gsub(/\.js/i, ".js.gz") if request.accept_encoding =~ /gzip/i && Cyborg.gzip_assets?
30
30
  tags += tag
31
31
  end
32
32
 
data/lib/cyborg/plugin.rb CHANGED
@@ -89,6 +89,7 @@ module Cyborg
89
89
  root: @gem.full_gem_path,
90
90
  version: @gem.version.to_s,
91
91
  gem_name: @gem.name,
92
+ gzip_in_production: true,
92
93
  paths: {
93
94
  stylesheets: "app/assets/stylesheets/#{name}",
94
95
  javascripts: "app/assets/javascripts/#{name}",
@@ -101,6 +102,10 @@ module Cyborg
101
102
  end
102
103
  end
103
104
 
105
+ def gzip_in_production?
106
+ @gzip_in_production
107
+ end
108
+
104
109
  def expand_asset_paths
105
110
  @paths.each do |type, path|
106
111
  @paths[type] = File.join(root, path)
@@ -1,3 +1,3 @@
1
1
  module Cyborg
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyborg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass