fastlane-plugin-jira_util 0.2.1 → 0.2.3

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: 3e2dc8a0d0e2b0488a8c543325074db3591b803f47481f042106f8472b9e72ec
4
- data.tar.gz: d18e7184d7facd0ad1521f265120aa6c8ef21d04989f940d039058a49a35a522
3
+ metadata.gz: 01ceb94a8d182889d004872ede3566f529912621ff25de0e4cdcf0a447d209e6
4
+ data.tar.gz: f18b82b15fc492d88e68b0d12f1bd5013f51a108dc731c3b12a7f61418eed6d0
5
5
  SHA512:
6
- metadata.gz: 6186af046785dab9d719bf6905dd9f870429704efeb48d09bf43cfcc06dba96b1222fdd95e837a1644fa8fcd8ef5d98559af14def9b7b82aac706f76a32ce7ab
7
- data.tar.gz: 13d9ca92ba43aac17b7d167fdd2ef63677bb59e33349d7c89f29f09c0946e89a51c16cc83c8cfe74c88e996fd8129b252909120d4d71a6c44bda281d536c0821
6
+ metadata.gz: 58de2e7dbd44c2acb7ee31addb9e6952eac4d943e10bcfdcd9565125e17d53abb89bbc9429b1c08788fb9d00e3f0857ef6d035dabea94a8eeb05a4472e37fcd9
7
+ data.tar.gz: 0ce8fc44dd3e0ac3a733b38f5e18456207e9f886fc2afcbeedcafe79e3acf524aca1e9ba08ac742067d76c8758b2a69423f641dbfd7aa0388af9b070bc1bb26e
data/README.md CHANGED
@@ -14,12 +14,14 @@ fastlane add_plugin jira_util
14
14
 
15
15
  Manage your JIRA project's releases/versions with this plugin.
16
16
 
17
- Currently, jira_util comes with following actions actions: `create_jira_issue`, `create_jira_version`, `create_or_update_jira_version` and `release_jira_version`.
17
+ Currently, jira_util comes with following actions actions: `create_jira_issue`, `create_jira_version`, `get_jira_release_report_link`, `get_jira_version`, `release_jira_version` and `update_jira_version`.
18
18
  About actions:
19
19
  * `create_jira_issue` - will create a new issue in your JIRA project.
20
20
  * `create_jira_version` - will create a new version. It fails if version with same name already exists in JIRA project.
21
- * `create_or_update_jira_version` - similar to `create_jira_version`, but will update existing version.
21
+ * `get_jira_release_report_link` - returns link to JIRA release report.
22
+ * `get_jira_version` - returns existing JIRA version.
22
23
  * `release_jira_version` - release existing version in JIRA project.
24
+ * `update_jira_version` - updates existing version.
23
25
 
24
26
  ## Create Version Example
25
27
 
@@ -0,0 +1,166 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ JIRA_UTIL_GET_JIRA_RELEASE_REPORT_LINK_RESULT = :JIRA_UTIL_GET_JIRA_RELEASE_REPORT_LINK_RESULT
5
+ end
6
+
7
+ class GetJiraReleaseReportLinkAction < Action
8
+ def self.run(params)
9
+ Actions.verify_gem!('jira-ruby')
10
+ require 'jira-ruby'
11
+
12
+ site = params[:url]
13
+ context_path = ""
14
+ auth_type = :basic
15
+ username = params[:username]
16
+ password = params[:password]
17
+ project_name = params[:project_name]
18
+ project_id = params[:project_id]
19
+ released = true
20
+
21
+ options = {
22
+ username: username,
23
+ password: password,
24
+ site: site,
25
+ context_path: context_path,
26
+ auth_type: auth_type,
27
+ read_timeout: 120
28
+ }
29
+
30
+ client = JIRA::Client.new(options)
31
+
32
+ unless project_name.nil?
33
+ project = client.Project.find(project_name)
34
+ project_id = project.key
35
+ end
36
+ raise ArgumentError.new("Project not found.") if project_id.nil?
37
+
38
+ version = nil
39
+ if !params[:version_id].nil?
40
+ version = project.versions.find { |version| version.id == params[:version_id] }
41
+ elsif !params[:version_name].nil?
42
+ version = project.versions.find { |version| version.name == params[:version_name] }
43
+ end
44
+
45
+ raise ArgumentError.new("Version not found.") if version.nil?
46
+
47
+ version_id = version.id
48
+
49
+ raise ArgumentError.new("Version has empty id.") if version_id.nil?
50
+
51
+ release_report_path = "/projects/#{project.key}/versions/#{version_id}/tab/release-report-all-issues"
52
+ release_report_link = URI.join(site, release_report_path).to_s
53
+
54
+ Actions.lane_context[SharedValues::JIRA_UTIL_GET_JIRA_RELEASE_REPORT_LINK_RESULT] = release_report_link
55
+ release_report_link
56
+ rescue RuntimeError
57
+ UI.user_error!("#{$!}")
58
+ nil
59
+ rescue JIRA::HTTPError
60
+ UI.user_error!("Failed to find JIRA version: #{$!.response.body}")
61
+ nil
62
+ end
63
+
64
+ #####################################################
65
+ # @!group Documentation
66
+ #####################################################
67
+
68
+ def self.description
69
+ "Return link to JIRA release report."
70
+ end
71
+
72
+ def self.details
73
+ "Return link to JIRA release report. Link looks like https://JIRA_SITE/projects/PROJ/versions/VERSION/tab/release-report-all-issues"
74
+ end
75
+
76
+ def self.available_options
77
+ [
78
+ FastlaneCore::ConfigItem.new(key: :url,
79
+ env_name: "FL_JIRA_UTIL_SITE",
80
+ description: "URL for Jira instance",
81
+ type: String,
82
+ verify_block: proc do |value|
83
+ UI.user_error!("No url for Jira given, pass using `url: 'url'`") unless value and !value.empty?
84
+ end),
85
+ FastlaneCore::ConfigItem.new(key: :username,
86
+ env_name: "FL_JIRA_UTIL_USERNAME",
87
+ description: "Username for JIRA instance",
88
+ type: String,
89
+ verify_block: proc do |value|
90
+ UI.user_error!("No username given, pass using `username: 'jira_user'`") unless value and !value.empty?
91
+ end),
92
+ FastlaneCore::ConfigItem.new(key: :password,
93
+ env_name: "FL_JIRA_UTIL_PASSWORD",
94
+ description: "Password for Jira",
95
+ type: String,
96
+ verify_block: proc do |value|
97
+ UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
98
+ end),
99
+ FastlaneCore::ConfigItem.new(key: :project_name,
100
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
101
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
102
+ type: String,
103
+ optional: true,
104
+ conflicting_options: [:project_id],
105
+ conflict_block: proc do |value|
106
+ UI.user_error!("You can't use 'project_name' and '#{project_id}' options in one run")
107
+ end,
108
+ verify_block: proc do |value|
109
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
110
+ end),
111
+ FastlaneCore::ConfigItem.new(key: :project_id,
112
+ env_name: "FL_JIRA_UTIL_PROJECT_ID",
113
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
114
+ type: String,
115
+ optional: true,
116
+ conflicting_options: [:project_name],
117
+ conflict_block: proc do |value|
118
+ UI.user_error!("You can't use 'project_id' and '#{project_name}' options in one run")
119
+ end,
120
+ verify_block: proc do |value|
121
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
122
+ end),
123
+ FastlaneCore::ConfigItem.new(key: :version_id,
124
+ description: "JIRA version id. E.g. 123456",
125
+ optional: true,
126
+ conflicting_options: [ :version_name ],
127
+ conflict_block: proc do |value|
128
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
129
+ end,
130
+ verify_block: proc do |value|
131
+ UI.user_error!("Empty verison id") unless !value.nil? and !value.empty?
132
+ end),
133
+ FastlaneCore::ConfigItem.new(key: :version_name,
134
+ description: "JIRA version name",
135
+ is_string: false,
136
+ optional: true,
137
+ conflicting_options: [:version_id],
138
+ conflict_block: proc do |value|
139
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
140
+ end,
141
+ verify_block: proc do |value|
142
+ UI.user_error!("Empty verison name") unless !value.nil? and !value.empty?
143
+ end)
144
+ ]
145
+ end
146
+
147
+ def self.output
148
+ [
149
+ ['JIRA_UTIL_GET_JIRA_RELEASE_REPORT_LINK_RESULT', 'JIRA release report link']
150
+ ]
151
+ end
152
+
153
+ def self.return_value
154
+ 'JIRA release report link'
155
+ end
156
+
157
+ def self.authors
158
+ [ "https://github.com/alexeyn-martynov" ]
159
+ end
160
+
161
+ def self.is_supported?(platform)
162
+ true
163
+ end
164
+ end
165
+ end
166
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module JiraUtil
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-jira_util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "%q{Alexey Martynov}"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2019-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jira-ruby
@@ -161,6 +161,7 @@ files:
161
161
  - lib/fastlane/plugin/jira_util.rb
162
162
  - lib/fastlane/plugin/jira_util/actions/create_jira_issue.rb
163
163
  - lib/fastlane/plugin/jira_util/actions/create_jira_version.rb
164
+ - lib/fastlane/plugin/jira_util/actions/get_jira_release_report_link.rb
164
165
  - lib/fastlane/plugin/jira_util/actions/get_jira_version.rb
165
166
  - lib/fastlane/plugin/jira_util/actions/release_jira_version.rb
166
167
  - lib/fastlane/plugin/jira_util/actions/update_jira_version.rb
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  - !ruby/object:Gem::Version
186
187
  version: '0'
187
188
  requirements: []
188
- rubygems_version: 3.0.6
189
+ rubygems_version: 3.0.3
189
190
  signing_key:
190
191
  specification_version: 4
191
192
  summary: "%q{Create JIRA issues and manage versions with this plugin}"