webpack_stats 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webpack_stats.rb +13 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8623a3f007c05887c26231a507819042099d024
|
4
|
+
data.tar.gz: 0c2efbcd0fe7e535efc3c7189f9742b0c0dab9d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f51cfb98c53704c674df7bef5020c96f3ebcf387ce1263a18d0b384e3b8ff319e26ce983c78921166ba26372b53b33c430221f5dd54a205217cb35ede3e96d
|
7
|
+
data.tar.gz: 906ec6ebb399977e46bebc2899b16cea08e437cf4b3cce1933d998ba47c78f1c8c747000fa9318ae9ed288691e1f748438d2700f098a8b347de936db9a6a8752
|
data/lib/webpack_stats.rb
CHANGED
@@ -15,25 +15,22 @@ module WebpackStats
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def assets
|
18
|
-
@reload
|
18
|
+
load! if @reload || !@assets
|
19
|
+
@assets
|
19
20
|
end
|
20
21
|
|
21
22
|
def stats
|
22
|
-
@reload
|
23
|
+
load! if @reload || !@stats
|
24
|
+
@stats
|
23
25
|
end
|
24
26
|
|
25
|
-
def
|
26
|
-
JSON.parse File.read @stats_path
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
_stats = stats
|
32
|
-
_stats['assets'].each do |asset|
|
33
|
-
key, value = split_asset_name(_stats, asset['name'])
|
34
|
-
ret[key] = value
|
27
|
+
def load!
|
28
|
+
@stats = JSON.parse File.read @stats_path
|
29
|
+
@assets = {}
|
30
|
+
@stats['assets'].each do |asset|
|
31
|
+
key, value = split_asset_name(@stats, asset['name'])
|
32
|
+
@assets[key] = value
|
35
33
|
end
|
36
|
-
ret
|
37
34
|
end
|
38
35
|
|
39
36
|
def split_asset_name stats, asset_name
|
@@ -62,8 +59,9 @@ begin
|
|
62
59
|
|
63
60
|
ActiveSupport.on_load(:after_initialize) do
|
64
61
|
WebpackStats.configure do |config|
|
65
|
-
config.reload = Rails.env.production?
|
62
|
+
config.reload = !Rails.env.production?
|
66
63
|
config.stats_path = Rails.root.join('stats.json')
|
67
64
|
end
|
68
65
|
end
|
69
|
-
|
66
|
+
rescue LoadError
|
67
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpack_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jian Weihang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|