lighthouse-ruby 0.1.2 → 0.1.8
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/lighthouse/ruby/builder.rb +14 -12
- 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: 22af57ad86348f3461e430da52497878b1234839d4d8e436b4668ce0da21e2ff
|
4
|
+
data.tar.gz: 47d325f1197e2b4df8483cfb2338d9b482ce9ce6698060604e6efc86e7e5db7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4bcc3c7e9202a5d94b949a80fbfd40f293a33d233b7d7a790ff4f9903e0a79e629428853e9878695f4852b74e630b17b91c586d356696aa5e3ffffd5acb66a0
|
7
|
+
data.tar.gz: 9619d29f305570b33e8ede4836d255340795dddac528d27bd01d59d1bcc3ab66f2a28e17833cdb8016c7b3d405c69c9cce220dfe85e0ca768013394560b1b863
|
data/Gemfile.lock
CHANGED
@@ -5,7 +5,10 @@ module Lighthouse
|
|
5
5
|
module Ruby
|
6
6
|
class Builder
|
7
7
|
|
8
|
-
|
8
|
+
attr_reader :response
|
9
|
+
|
10
|
+
def initialize(url)
|
11
|
+
@url = url
|
9
12
|
@runner = Lighthouse::Preferences.runner
|
10
13
|
@cli = Lighthouse::Preferences.lighthouse_cli
|
11
14
|
@port = Lighthouse::Preferences.remote_debugging_port
|
@@ -13,18 +16,18 @@ module Lighthouse
|
|
13
16
|
@lighthouse_options = Lighthouse::Preferences.lighthouse_options
|
14
17
|
end
|
15
18
|
|
16
|
-
def execute
|
17
|
-
@response = @runner.call("#{@cli} #{options
|
19
|
+
def execute
|
20
|
+
@response = @runner.call("#{@cli} #{options}")
|
18
21
|
end
|
19
22
|
|
20
|
-
def
|
21
|
-
get_test_scores(@response)
|
23
|
+
def parsed_response
|
24
|
+
get_test_scores(JSON.parse(@response))
|
22
25
|
end
|
23
26
|
|
24
27
|
private
|
25
28
|
|
26
|
-
def options
|
27
|
-
"'#{url}'".tap do |builder|
|
29
|
+
def options
|
30
|
+
"'#{@url}'".tap do |builder|
|
28
31
|
builder << ' --quiet'
|
29
32
|
builder << ' --output=json'
|
30
33
|
builder << " --port=#{@port}" if @port
|
@@ -34,13 +37,12 @@ module Lighthouse
|
|
34
37
|
end
|
35
38
|
|
36
39
|
def get_test_scores(response)
|
37
|
-
json_result = JSON.parse(response)
|
38
40
|
@test_scores = { url: @url}
|
39
41
|
@test_scores[:run_time] = Time.now
|
40
|
-
@test_scores[:performance] =
|
41
|
-
@test_scores[:accessibility] =
|
42
|
-
@test_scores[:best_practices] =
|
43
|
-
@test_scores[:seo] =
|
42
|
+
@test_scores[:performance] = response.dig("categories", "performance" , "score").to_f * 100
|
43
|
+
@test_scores[:accessibility] = response.dig("categories", "accessibility" , "score").to_f * 100
|
44
|
+
@test_scores[:best_practices] = response.dig("categories", "best-practices" , "score").to_f * 100
|
45
|
+
@test_scores[:seo] = response.dig("categories", "seo" , "score").to_f * 100
|
44
46
|
@test_scores
|
45
47
|
end
|
46
48
|
|
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.8
|
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-06 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 ~
|