fastlane-plugin-jira_fetch_tickets 0.1.0 → 0.1.1

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: 527b5e571224926a0340d61568456d9bc7d4952e9192a8cc788077ceeef19350
4
- data.tar.gz: ddfef4f47585103f70034b47bbffa6968678b0a7f48e724d62e9abfe87c32fcf
3
+ metadata.gz: 36c47590076e0bc1642714f517cf98d7993bffecda6f77d0151281382e81e778
4
+ data.tar.gz: 97a25af86199612808a8800baf81ae500d243a6b011d7dd8ff9aaad88dd14eae
5
5
  SHA512:
6
- metadata.gz: 307121a63096d8163fc166d540d6165fc5a3561530615a9aa0800565f31627acfc35e3748713d6f0da685a8da79e57a4d637c7767515d9e6e227aa25853e3fa0
7
- data.tar.gz: 9952e9cf8094bbdc2489c1404eb76c98f00b6abeacb271190404d83e961e284f488c774fca176918b3f71c69e34b7b3374d7c71f0c2376ce1c26a7cf716ee24a
6
+ metadata.gz: 20e181d913a7f435f879ad42a9df3e9bb0071ed486b406f3c30216eaf34d0d55d09a74a8c1fc6de05b91cbd0e3da4fa719f7d2dacaf83931ae138465e85a3a91
7
+ data.tar.gz: 4f2120e8050d342e5495a73d511c41d036dd39698fafb751ed182a9099de16436662cea0b16544539c03ec5edf709fe1531da35fb97bcc79d346c01d02800990
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fastlane/action'
2
4
  require 'fastlane_core'
3
- require_relative '../helper/jira_fetch_tickets_helper'
4
5
 
5
6
  module Fastlane
6
7
  module Actions
@@ -10,16 +11,18 @@ module Fastlane
10
11
 
11
12
  class JiraFetchTicketsAction < Action
12
13
  # rubocop:disable Metrics/PerceivedComplexity
14
+ # rubocop:disable Metrics/CyclomaticComplexity
15
+ # rubocop:disable Metrics/MethodLength
13
16
  def self.run(params)
14
17
  Actions.verify_gem!('jira-ruby')
15
18
  require 'jira-ruby'
16
19
 
17
20
  client = JIRA::Client.new(
18
- username: params[:username],
19
- password: params[:password],
20
- site: params[:url],
21
+ username: params[:username],
22
+ password: params[:password],
23
+ site: params[:url],
21
24
  context_path: '',
22
- auth_type: :basic
25
+ auth_type: :basic
23
26
  )
24
27
 
25
28
  projects = params[:projects]
@@ -32,51 +35,51 @@ module Fastlane
32
35
  sprint = params[:sprint]
33
36
  custom_jql = params[:custom_jql]
34
37
 
35
- jql = ""
38
+ jql = ''
36
39
 
37
40
  unless projects.instance_of?(NilClass)
38
- options = { key: "project", values: projects }
41
+ options = { key: 'project', values: projects }
39
42
  jql = jql_from_array?(options)
40
43
  end
41
44
 
42
45
  if jql.empty? && !project.instance_of?(NilClass)
43
- options = { key: "project", value: project }
46
+ options = { key: 'project', value: project }
44
47
  jql = jql_from_string?(options)
45
48
  end
46
49
 
47
50
  added = false
48
51
  unless statuses.instance_of?(NilClass)
49
- options = { key: "status", values: statuses, jql: jql }
52
+ options = { key: 'status', values: statuses, jql: jql }
50
53
  jql = append_jql_from_array?(options)
51
54
  added = true
52
55
  end
53
56
 
54
57
  if !added && !status.instance_of?(NilClass)
55
- options = { key: "status", value: status, jql: jql }
58
+ options = { key: 'status', value: status, jql: jql }
56
59
  jql = append_jql_from_string?(options)
57
60
  end
58
61
 
59
62
  added = false
60
63
  unless labels.instance_of?(NilClass)
61
- options = { key: "labels", values: labels, jql: jql }
64
+ options = { key: 'labels', values: labels, jql: jql }
62
65
  jql = append_jql_from_array?(options)
63
66
  added = true
64
67
  end
65
68
 
66
69
  if !added && !label.instance_of?(NilClass)
67
- options = { key: "labels", value: label, jql: jql }
70
+ options = { key: 'labels', value: label, jql: jql }
68
71
  jql = append_jql_from_string?(options)
69
72
  end
70
73
 
71
74
  added = false
72
75
  unless sprints.instance_of?(NilClass)
73
- options = { key: "Sprint", values: sprints, jql: jql }
76
+ options = { key: 'sprint', values: sprints, jql: jql }
74
77
  jql = append_jql_from_array?(options)
75
78
  added = true
76
79
  end
77
80
 
78
81
  if !added && !sprint.instance_of?(NilClass)
79
- options = { key: "Sprint", value: sprint, jql: jql }
82
+ options = { key: 'sprint', value: sprint, jql: jql }
80
83
  jql = append_jql_from_string?(options)
81
84
  end
82
85
 
@@ -85,7 +88,7 @@ module Fastlane
85
88
  jql = append_jql?(options)
86
89
  end
87
90
 
88
- UI.message("JQL query is '#{jql}'")
91
+ FastlaneCore::UI.message("JQL query is '#{jql}'")
89
92
 
90
93
  issues = client.Issue.jql(jql)
91
94
 
@@ -95,13 +98,19 @@ module Fastlane
95
98
 
96
99
  Actions.lane_context[SharedValues::JIRA_FETCH_TICKETS_RESULT] = issues
97
100
 
98
- UI.success('Successfully fetched JIRA tickets!')
101
+ FastlaneCore::UI.success('Successfully fetched JIRA tickets!')
99
102
  issues
100
103
  end
101
104
 
102
105
  def self.jql_from_array?(options)
103
106
  values = options[:values]
104
- values = values.map { |string| "\"#{string}\"" }
107
+ values = values.map do |string|
108
+ if string.include?(' ')
109
+ "\"#{string}\""
110
+ else
111
+ string.to_s
112
+ end
113
+ end
105
114
  "#{options[:key]} in (#{values.join(', ')})"
106
115
  end
107
116
 
@@ -114,7 +123,12 @@ module Fastlane
114
123
  end
115
124
 
116
125
  def self.jql_from_string?(options)
117
- "#{options[:key]} = \"#{options[:value]}\""
126
+ value = options[:value]
127
+ if value.include?(' ')
128
+ "#{options[:key]} = \"#{options[:value]}\""
129
+ else
130
+ "#{options[:key]} = #{options[:value]}"
131
+ end
118
132
  end
119
133
 
120
134
  def self.append_jql_from_string?(options)
@@ -129,27 +143,26 @@ module Fastlane
129
143
  jql = options[:jql]
130
144
  new_value = options[:new_value]
131
145
 
132
- appended = ""
133
146
  if jql.empty?
134
- appended = new_value
147
+ new_value
135
148
  else
136
- appended = "#{jql} AND #{new_value}"
149
+ "#{jql} AND #{new_value}"
137
150
  end
138
-
139
- appended
140
151
  end
141
152
  # rubocop:enable Metrics/PerceivedComplexity
153
+ # rubocop:enable Metrics/CyclomaticComplexity
154
+ # rubocop:enable Metrics/MethodLength
142
155
 
143
156
  def self.description
144
- "Fetch ticekts on jira project using jql query"
157
+ 'Fetch ticekts on jira project using jql query'
145
158
  end
146
159
 
147
160
  def self.authors
148
- ["Luca Tagliabue"]
161
+ ['Luca Tagliabue']
149
162
  end
150
163
 
151
164
  def self.return_value
152
- "Hash object of key and issue."
165
+ 'Hash object of key and issue.'
153
166
  end
154
167
 
155
168
  def self.output
@@ -159,97 +172,100 @@ module Fastlane
159
172
  end
160
173
 
161
174
  def self.details
162
- "Fetch ticekts on jira project using jql query"
175
+ 'Fetch ticekts on jira project using jql query'
163
176
  end
164
177
 
178
+ # rubocop:disable Metrics/MethodLength
165
179
  def self.available_options
166
180
  [
167
181
  FastlaneCore::ConfigItem.new(key: :url,
168
- env_name: "FL_JIRA_SITE",
169
- description: "URL for Jira instance",
182
+ env_name: 'FL_JIRA_SITE',
183
+ description: 'URL for Jira instance',
170
184
  sensitive: true,
171
185
  type: String,
172
186
  verify_block: ->(value) { verify_option(key: 'url', value: value) }),
173
187
  FastlaneCore::ConfigItem.new(key: :username,
174
- env_name: "FL_JIRA_USERNAME",
175
- description: "Username for Jira instance",
188
+ env_name: 'FL_JIRA_USERNAME',
189
+ description: 'Username for Jira instance',
176
190
  sensitive: true,
177
191
  type: String,
178
192
  verify_block: ->(value) { verify_option(key: 'username', value: value) }),
179
193
  FastlaneCore::ConfigItem.new(key: :password,
180
- env_name: "FL_JIRA_PASSWORD",
181
- description: "Password or api token for Jira",
194
+ env_name: 'FL_JIRA_PASSWORD',
195
+ description: 'Password or api token for Jira',
182
196
  sensitive: true,
183
197
  type: String,
184
198
  verify_block: ->(value) { verify_option(key: 'password', value: value) }),
185
199
  FastlaneCore::ConfigItem.new(key: :projects,
186
- env_name: "FL_JIRA_FETCH_JQL_PROJECTS",
187
- description: "Array of Jira projects",
200
+ env_name: 'FL_JIRA_FETCH_JQL_PROJECTS',
201
+ description: 'Array of Jira projects',
188
202
  type: Array,
189
203
  optional: true),
190
204
  FastlaneCore::ConfigItem.new(key: :project,
191
- env_name: "FL_JIRA_FETCH_JQL_PROJECT",
192
- description: "Jira project",
205
+ env_name: 'FL_JIRA_FETCH_JQL_PROJECT',
206
+ description: 'Jira project',
193
207
  type: String,
194
208
  optional: true,
195
209
  conflicting_options: [:projects],
196
- conflict_block: proc do |other|
197
- UI.message("Ignoring :project in favor of :projects")
210
+ conflict_block: proc do |_other|
211
+ FastlaneCore::UI.message('Ignoring :project in favor of :projects')
198
212
  end),
199
213
  FastlaneCore::ConfigItem.new(key: :statuses,
200
- env_name: "FL_JIRA_FETCH_JQL_STATUSES",
201
- description: "Array of Jira status",
214
+ env_name: 'FL_JIRA_FETCH_JQL_STATUSES',
215
+ description: 'Array of Jira status',
202
216
  type: Array,
203
217
  optional: true),
204
218
  FastlaneCore::ConfigItem.new(key: :status,
205
- env_name: "FL_JIRA_FETCH_JQL_STATUS",
206
- description: "Jira status",
219
+ env_name: 'FL_JIRA_FETCH_JQL_STATUS',
220
+ description: 'Jira status',
207
221
  type: String,
208
222
  optional: true,
209
223
  conflicting_options: [:statuses],
210
- conflict_block: proc do |other|
211
- UI.message("Ignoring :status in favor of :statuses")
224
+ conflict_block: proc do |_other|
225
+ FastlaneCore::UI.message('Ignoring :status in favor of :statuses')
212
226
  end),
213
227
  FastlaneCore::ConfigItem.new(key: :labels,
214
- env_name: "FL_JIRA_FETCH_JQL_LABELS",
215
- description: "Array of Jira labels",
228
+ env_name: 'FL_JIRA_FETCH_JQL_LABELS',
229
+ description: 'Array of Jira labels',
216
230
  type: Array,
217
231
  optional: true),
218
232
  FastlaneCore::ConfigItem.new(key: :label,
219
- env_name: "FL_JIRA_FETCH_JQL_LABEL",
220
- description: "Jira label",
233
+ env_name: 'FL_JIRA_FETCH_JQL_LABEL',
234
+ description: 'Jira label',
221
235
  type: String,
222
236
  optional: true,
223
237
  conflicting_options: [:labels],
224
- conflict_block: proc do |other|
225
- UI.message("Ignoring :label in favor of :labels")
238
+ conflict_block: proc do |_other|
239
+ FastlaneCore::UI.message('Ignoring :label in favor of :labels')
226
240
  end),
227
241
  FastlaneCore::ConfigItem.new(key: :sprints,
228
- env_name: "FL_JIRA_FETCH_JQL_SPRINTS",
229
- description: "Jira sprints",
242
+ env_name: 'FL_JIRA_FETCH_JQL_SPRINTS',
243
+ description: 'Jira sprints',
230
244
  type: Array,
231
245
  optional: true),
232
246
  FastlaneCore::ConfigItem.new(key: :sprint,
233
- env_name: "FL_JIRA_FETCH_JQL_SPRINT",
234
- description: "Jira sprint",
247
+ env_name: 'FL_JIRA_FETCH_JQL_SPRINT',
248
+ description: 'Jira sprint',
235
249
  type: String,
236
250
  optional: true,
237
251
  conflicting_options: [:sprints],
238
- conflict_block: proc do |other|
239
- UI.message("Ignoring :sprint in favor of :sprints")
252
+ conflict_block: proc do |_other|
253
+ FastlaneCore::UI.message('Ignoring :sprint in favor of :sprints')
240
254
  end),
241
255
  FastlaneCore::ConfigItem.new(key: :custom_jql,
242
- env_name: "FL_JIRA_FETCH_JQL_CUSTOM",
243
- description: "Jira custom jql",
256
+ env_name: 'FL_JIRA_FETCH_JQL_CUSTOM',
257
+ description: 'Jira custom jql',
244
258
  type: String,
245
259
  optional: true)
246
260
  ]
247
261
  end
262
+ # rubocop:enable Metrics/MethodLength
248
263
 
249
264
  def self.verify_option(options)
250
- UI.user_error!("No value found for '#{options[:key]}'") if options[:value].to_s.empty?
265
+ FastlaneCore::UI.user_error!("No value found for '#{options[:key]}'") if options[:value].to_s.empty?
251
266
  end
252
267
 
268
+ # rubocop:disable Metrics/MethodLength
253
269
  def self.example_code
254
270
  [
255
271
  'jira_fetch_tickets(
@@ -266,7 +282,7 @@ module Fastlane
266
282
  end
267
283
  # rubocop:enable Metrics/MethodLength
268
284
 
269
- def self.is_supported?(platform)
285
+ def self.is_supported?(_platform)
270
286
  true
271
287
  end
272
288
  end
@@ -1,16 +1,6 @@
1
- require 'fastlane_core/ui/ui'
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Fastlane
4
- UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
5
-
6
4
  module Helper
7
- class JiraFetchTicketsHelper
8
- # class methods that you define here become available in your action
9
- # as `Helper::JiraFetchTicketsHelper.your_method`
10
- #
11
- def self.show_message
12
- UI.message("Hello from the jira_fetch_tickets plugin helper!")
13
- end
14
- end
15
5
  end
16
6
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Fastlane
2
4
  module JiraFetchTickets
3
- VERSION = "0.1.0"
5
+ VERSION = '0.1.1'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fastlane/plugin/jira_fetch_tickets/version'
2
4
 
3
5
  module Fastlane
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-jira_fetch_tickets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Tagliabue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-19 00:00:00.000000000 Z
11
+ date: 2024-03-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: homobonus-luca@hotmail.it