lighthouse-ruby 0.1.2 → 0.1.8

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
  SHA256:
3
- metadata.gz: e4fcbcfe84e6da713a30ee7cb5ecf3ff3439903bd541b0b6d0e1b7a400727ba0
4
- data.tar.gz: 860089ede53ecd28a61f89f3d9d8a3fb951c45b2c91353cfe13d23789f99f0db
3
+ metadata.gz: 22af57ad86348f3461e430da52497878b1234839d4d8e436b4668ce0da21e2ff
4
+ data.tar.gz: 47d325f1197e2b4df8483cfb2338d9b482ce9ce6698060604e6efc86e7e5db7c
5
5
  SHA512:
6
- metadata.gz: 98fa94e5d230733b4797f6faa12e38fb0945601c5ceb521a9d7d6d8938a1a8f75a9e233780495d4565918cad8134f3ff384ef380be80bf945730c562c37f8ff7
7
- data.tar.gz: 8a2270362c61611ebd4adf8a7a09a039e798bdde1c4aa1a9d00d2fa2dd80af03b2414d5e2d0633aad3ae8715d46e762af1c0536f9cc5a436d29d8587e623ac62
6
+ metadata.gz: a4bcc3c7e9202a5d94b949a80fbfd40f293a33d233b7d7a790ff4f9903e0a79e629428853e9878695f4852b74e630b17b91c586d356696aa5e3ffffd5acb66a0
7
+ data.tar.gz: 9619d29f305570b33e8ede4836d255340795dddac528d27bd01d59d1bcc3ab66f2a28e17833cdb8016c7b3d405c69c9cce220dfe85e0ca768013394560b1b863
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lighthouse-ruby (0.1.1)
4
+ lighthouse-ruby (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -5,7 +5,10 @@ module Lighthouse
5
5
  module Ruby
6
6
  class Builder
7
7
 
8
- def initialize
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(url)
17
- @response = @runner.call("#{@cli} #{options(url)}")
19
+ def execute
20
+ @response = @runner.call("#{@cli} #{options}")
18
21
  end
19
22
 
20
- def test_scores
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(url)
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] = json_result.dig("categories", "performance" , "score") * 100
41
- @test_scores[:accessibility] = json_result.dig("categories", "accessibility" , "score") * 100
42
- @test_scores[:best_practices] = json_result.dig("categories", "best-practices" , "score") * 100
43
- @test_scores[:seo] = json_result.dig("categories", "seo" , "score") * 100
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
 
@@ -1,5 +1,5 @@
1
1
  module Lighthouse
2
2
  module Ruby
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
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.2
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-05-14 00:00:00.000000000 Z
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.3
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 ~