lighthouse-ruby 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/lighthouse/ruby/builder.rb +9 -7
- data/lib/lighthouse/ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18470aaf1e02625cc7623dd4eec4406d54a748d88e0c8053694aa0fec0b64a13
|
4
|
+
data.tar.gz: 2a85003187142f768f4a6b18918f92b0812a88737e74c4bb64546e0e171cd885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7efe4a8608436d3af69640b20ff5d6f5e0b0a64877db23af17e2589d4a45dafdcdfb3b4c4e8efd6c8b14c99a89c513e9fba29fdfef960eabf5952b262f14386c
|
7
|
+
data.tar.gz: 0b2332ac37de52f263aa4ae8d66ee4945263092da6182a3abe187160ce1bf353f2fcaa3d2e068fd3219782bcb4eb3ff4d34338b0692ba13a0ca4c9892535681f
|
data/Gemfile.lock
CHANGED
@@ -5,6 +5,8 @@ module Lighthouse
|
|
5
5
|
module Ruby
|
6
6
|
class Builder
|
7
7
|
|
8
|
+
attr_reader :response
|
9
|
+
|
8
10
|
def initialize(url)
|
9
11
|
@url = url
|
10
12
|
@runner = Lighthouse::Preferences.runner
|
@@ -16,10 +18,11 @@ module Lighthouse
|
|
16
18
|
|
17
19
|
def execute
|
18
20
|
@response = @runner.call("#{@cli} #{options}")
|
21
|
+
get_test_scores(parsed_response)
|
19
22
|
end
|
20
23
|
|
21
|
-
def
|
22
|
-
|
24
|
+
def parsed_response
|
25
|
+
@parsed_response = JSON.parse(@response)
|
23
26
|
end
|
24
27
|
|
25
28
|
private
|
@@ -35,13 +38,12 @@ module Lighthouse
|
|
35
38
|
end
|
36
39
|
|
37
40
|
def get_test_scores(response)
|
38
|
-
json_result = JSON.parse(response)
|
39
41
|
@test_scores = { url: @url}
|
40
42
|
@test_scores[:run_time] = Time.now
|
41
|
-
@test_scores[:performance] =
|
42
|
-
@test_scores[:accessibility] =
|
43
|
-
@test_scores[:best_practices] =
|
44
|
-
@test_scores[:seo] =
|
43
|
+
@test_scores[:performance] = response.dig("categories", "performance" , "score") * 100
|
44
|
+
@test_scores[:accessibility] = response.dig("categories", "accessibility" , "score") * 100
|
45
|
+
@test_scores[:best_practices] = response.dig("categories", "best-practices" , "score") * 100
|
46
|
+
@test_scores[:seo] = response.dig("categories", "seo" , "score") * 100
|
45
47
|
@test_scores
|
46
48
|
end
|
47
49
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lighthouse-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Budi Sugianto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|