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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e7b870fb6324f0497790a8e4a5b5924e1340aaa4d33465f114e5dfe4d499b44
4
- data.tar.gz: 744b5ed24dae228555193ecf6e0a0f36de24f3d33665e75549f33e657fcc89a4
3
+ metadata.gz: 848f2062e40f16d82d53a9360f9be22d30451f41812cb82225e5d4b6fe6067a1
4
+ data.tar.gz: 5d640301953439b48e9519236451b1d47edfbd5d6f541642ba84abaf9430f373
5
5
  SHA512:
6
- metadata.gz: 284a6301e0f4f28eac94f8ede197aaaba6e367282edf5eaaa99c2d35b038fe1f991ccc5a4e6b1aed03d3388cf61e962de11436b97d8df6a826a2392cbee8cb20
7
- data.tar.gz: 7646a486ae91c4a7a878558e18160af35b226a586e4d6f1e26b791e7d023e06daf830bd6cfda36955ccaf0a43e0957c46f222bc3030b953db62f93630fba1d85
6
+ metadata.gz: 8ecf377743b4e9da2666d2d970874e23de527bf919eb91963b20197e52ae1b35ca39c5c4b93df96db5d5602cb283c80d675eb2a300f76fd6d06757202975ffb7
7
+ data.tar.gz: f57f6b77bafbfb3216c882bbddbd2c3fb3b148b0d4c9a401acd50c186473deb8812b12e7249d59f6ed794df6b0d3e7a137b2ee6da0422d878b33f6207290399a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lighthouse-ruby (0.1.0)
4
+ lighthouse-ruby (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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 test_scores
22
- get_test_scores(@response)
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] = json_result.dig("categories", "performance" , "score") * 100
42
- @test_scores[:accessibility] = json_result.dig("categories", "accessibility" , "score") * 100
43
- @test_scores[:best_practices] = json_result.dig("categories", "best-practices" , "score") * 100
44
- @test_scores[:seo] = json_result.dig("categories", "seo" , "score") * 100
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
 
@@ -1,5 +1,5 @@
1
1
  module Lighthouse
2
2
  module Ruby
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.6"
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.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-05-14 00:00:00.000000000 Z
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.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 ~