lighthouse-ruby 0.1.1 → 0.1.6
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 +12 -7
- data/lib/lighthouse/ruby/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 848f2062e40f16d82d53a9360f9be22d30451f41812cb82225e5d4b6fe6067a1
|
4
|
+
data.tar.gz: 5d640301953439b48e9519236451b1d47edfbd5d6f541642ba84abaf9430f373
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ecf377743b4e9da2666d2d970874e23de527bf919eb91963b20197e52ae1b35ca39c5c4b93df96db5d5602cb283c80d675eb2a300f76fd6d06757202975ffb7
|
7
|
+
data.tar.gz: f57f6b77bafbfb3216c882bbddbd2c3fb3b148b0d4c9a401acd50c186473deb8812b12e7249d59f6ed794df6b0d3e7a137b2ee6da0422d878b33f6207290399a
|
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
|
@@ -18,8 +20,12 @@ module Lighthouse
|
|
18
20
|
@response = @runner.call("#{@cli} #{options}")
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
get_test_scores(
|
23
|
+
def parsed_response
|
24
|
+
get_test_scores(raw_response)
|
25
|
+
end
|
26
|
+
|
27
|
+
def raw_response
|
28
|
+
JSON.parse(@response)
|
23
29
|
end
|
24
30
|
|
25
31
|
private
|
@@ -35,13 +41,12 @@ module Lighthouse
|
|
35
41
|
end
|
36
42
|
|
37
43
|
def get_test_scores(response)
|
38
|
-
json_result = JSON.parse(response)
|
39
44
|
@test_scores = { url: @url}
|
40
45
|
@test_scores[:run_time] = Time.now
|
41
|
-
@test_scores[:performance] =
|
42
|
-
@test_scores[:accessibility] =
|
43
|
-
@test_scores[:best_practices] =
|
44
|
-
@test_scores[:seo] =
|
46
|
+
@test_scores[:performance] = response.dig("categories", "performance" , "score").to_f * 100
|
47
|
+
@test_scores[:accessibility] = response.dig("categories", "accessibility" , "score").to_f * 100
|
48
|
+
@test_scores[:best_practices] = response.dig("categories", "best-practices" , "score").to_f * 100
|
49
|
+
@test_scores[:seo] = response.dig("categories", "seo" , "score").to_f * 100
|
45
50
|
@test_scores
|
46
51
|
end
|
47
52
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Budi Sugianto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,7 +82,7 @@ metadata:
|
|
82
82
|
homepage_uri: https://github.com/UseFedora/lighthouse-ruby
|
83
83
|
source_code_uri: https://github.com/UseFedora/lighthouse-ruby
|
84
84
|
changelog_uri: https://github.com/UseFedora/lighthouse-ruby/blob/master/CHANGELOG.md
|
85
|
-
post_install_message:
|
85
|
+
post_install_message:
|
86
86
|
rdoc_options: []
|
87
87
|
require_paths:
|
88
88
|
- lib
|
@@ -97,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.0.
|
101
|
-
signing_key:
|
100
|
+
rubygems_version: 3.0.8
|
101
|
+
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Ruby wrapper for lighthouse-cli command by execute and evaluate for Lighthouse-cli
|
104
104
|
test JSON report ~ inspired from lighthouse-matchers gem by Ackama Group ~
|