fastlane-plugin-sonarcloud_metric_kit 0.1.2 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9937149157a6ce405039b7620b058d30b72d4da49b5af6a09af5318fa796c882
4
- data.tar.gz: 64512ec468f1905429f9f186e757edd5e1e0272d0cb8c2b55d813514f8b9f284
3
+ metadata.gz: 3002e5c1f9aeb9fb87cccee5d719e4b4ff7efd3e088db5a35b5dd55d19728426
4
+ data.tar.gz: 89135f2c805e7e14e5c673c000c2c5da8756565d551b991aec5bee399c133d61
5
5
  SHA512:
6
- metadata.gz: 27daa2068beb22d13187eaa29e9c58dd0c1580f395a291336bac4399dc3242fa390b5a06b0f63d670f8368c3e412136905fc7e55492c08b77051a4767a96fa59
7
- data.tar.gz: a1da12010c6c2a5d809583f137800e2dea3efe38f57046e548fb8798546a4d91efcde99f541d72ed524c78aa4070b3e07f414b749ce2d02c59182a1c5fd74d40
6
+ metadata.gz: 434f43511a8c5c5745d6cfde729fc9cb52945f2f3052f91414f4dc6f92a8a7479f1c6e04c02e6eca8690a6497d370f5813f6df830830f37a197937bc97371e35
7
+ data.tar.gz: 8171c035d8ab2960dc26a327945fb815cd596c7ebd5ce3fe86c80d20c55c135a06f9c73b05505e4d3d7a0d64432f32b394ee2ee5cd0d654163423442e00285a8
@@ -36,15 +36,21 @@ module Fastlane
36
36
  end
37
37
 
38
38
  def self.get_measures(params)
39
- queries = "componentKey=#{params[:project_key]}&metricKeys=#{metric_keys.join(',')}"
40
- url = URI("#{api_url}/measures/component?#{queries}")
41
- response = request(url, token: params[:sonar_token])
42
- json_parse(response.read_body)['component']['measures']
39
+ queries = ["componentKey=#{params[:project_key]}", "metricKeys=#{metric_keys.join(',')}"]
40
+ queries << "branch=#{params[:branch]}" if params[:branch]
41
+ url = URI("#{api_url}/measures/component?#{queries.join('&')}")
42
+ response = json_parse(request(url, token: params[:sonar_token]).read_body)
43
+ UI.user_error!(response) unless response['component']
44
+ response['component']['measures']
43
45
  end
44
46
 
45
47
  def self.get_quality_gate(params)
46
- url = URI("#{api_url}/qualitygates/project_status?projectKey=#{params[:project_key]}")
47
- JSON.parse(request(url, token: params[:sonar_token]).read_body)['projectStatus']
48
+ queries = ["projectKey=#{params[:project_key]}"]
49
+ queries << "branch=#{params[:branch]}" if params[:branch]
50
+ url = URI("#{api_url}/qualitygates/project_status?#{queries.join('&')}")
51
+ response = json_parse(request(url, token: params[:sonar_token]).read_body)
52
+ UI.user_error!(response) unless response['projectStatus']
53
+ response['projectStatus']
48
54
  end
49
55
 
50
56
  def self.request(url, token:)
@@ -166,6 +172,12 @@ module Fastlane
166
172
  is_string: false,
167
173
  optional: true,
168
174
  default_value: false
175
+ ),
176
+ FastlaneCore::ConfigItem.new(
177
+ key: :branch,
178
+ description: 'Git branch to use for collecting metrics',
179
+ is_string: true,
180
+ optional: true
169
181
  )
170
182
  ]
171
183
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SonarcloudMetricKit
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sonarcloud_metric_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alteral
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler