fastlane-plugin-jira_util 0.1.9 → 0.2.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: '08734786ccc5a2b20f72a37e288838eb9b07d5b1a0454bef52fd9e2cc4a44cd6'
4
- data.tar.gz: 8c854ea3e17683f8b5b9e1b246607036341cfd524dddeaf6fbcae6df0feff201
3
+ metadata.gz: 3e2dc8a0d0e2b0488a8c543325074db3591b803f47481f042106f8472b9e72ec
4
+ data.tar.gz: d18e7184d7facd0ad1521f265120aa6c8ef21d04989f940d039058a49a35a522
5
5
  SHA512:
6
- metadata.gz: 116d9e5347a4c6164b4b3e5f8f0ad8e1a5c0b75d232d39d6e7d6df853b2eeddeaa7f38a36e57d3c8d7811bc5dbc2b06e170d8d3ebafc4c414bcc725c14c2d24d
7
- data.tar.gz: 582e526d151bf6c98f21e1e96fb1a8631903b3979db342eed678b74c175d91bb31e6c909d226ee74ddac67ae3d707d9935b7f86e13f208da16a9662536c3a9ec
6
+ metadata.gz: 6186af046785dab9d719bf6905dd9f870429704efeb48d09bf43cfcc06dba96b1222fdd95e837a1644fa8fcd8ef5d98559af14def9b7b82aac706f76a32ce7ab
7
+ data.tar.gz: 13d9ca92ba43aac17b7d167fdd2ef63677bb59e33349d7c89f29f09c0946e89a51c16cc83c8cfe74c88e996fd8129b252909120d4d71a6c44bda281d536c0821
@@ -1,9 +1,9 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
- CREATE_JIRA_ISSUE_ISSUE_ID = :CREATE_JIRA_ISSUE_ISSUE_ID
5
- CREATE_JIRA_ISSUE_ISSUE_KEY = :CREATE_JIRA_ISSUE_ISSUE_KEY
6
- CREATE_JIRA_ISSUE_ISSUE_LINK = :CREATE_JIRA_ISSUE_ISSUE_LINK
4
+ JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_ID = :JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_ID
5
+ JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_KEY = :JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_KEY
6
+ JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_LINK = :JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_LINK
7
7
  end
8
8
 
9
9
  class CreateJiraIssueAction < Action
@@ -89,9 +89,9 @@ module Fastlane
89
89
 
90
90
  issue.fetch
91
91
  issue_link = URI.join(params[:url], '/browse/', "#{issue.key}/").to_s
92
- Actions.lane_context[SharedValues::CREATE_JIRA_ISSUE_ISSUE_ID] = issue.id
93
- Actions.lane_context[SharedValues::CREATE_JIRA_ISSUE_ISSUE_KEY] = issue.key
94
- Actions.lane_context[SharedValues::CREATE_JIRA_ISSUE_ISSUE_LINK] = issue_link
92
+ Actions.lane_context[SharedValues::JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_ID] = issue.id
93
+ Actions.lane_context[SharedValues::JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_KEY] = issue.key
94
+ Actions.lane_context[SharedValues::JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_LINK] = issue_link
95
95
  issue.id
96
96
  rescue JIRA::HTTPError
97
97
  UI.user_error!("Failed to create JIRA issue: #{$!.response.body}")
@@ -137,7 +137,7 @@ module Fastlane
137
137
  UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
138
138
  end),
139
139
  FastlaneCore::ConfigItem.new(key: :project_name,
140
- env_name: "FL_CREATE_JIRA_ISSUE_PROJECT_NAME",
140
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
141
141
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
142
142
  type: String,
143
143
  verify_block: proc do |value|
@@ -186,9 +186,9 @@ module Fastlane
186
186
 
187
187
  def self.output
188
188
  [
189
- ['CREATE_JIRA_ISSUE_ISSUE_ID', 'The id for the newly created JIRA issue'],
190
- ['CREATE_JIRA_ISSUE_ISSUE_KEY', 'The key (e.g. MYPOJ-123) for the newly created JIRA issue'],
191
- ['CREATE_JIRA_ISSUE_ISSUE_LINK', 'The jira link to created issue (https://mycompany.jira.com/browse/MYPOJ-123)']
189
+ ['JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_ID', 'The id for the newly created JIRA issue'],
190
+ ['JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_KEY', 'The key (e.g. MYPOJ-123) for the newly created JIRA issue'],
191
+ ['JIRA_UTIL_CREATE_JIRA_ISSUE_ISSUE_LINK', 'The jira link to created issue (https://mycompany.jira.com/browse/MYPOJ-123)']
192
192
  ]
193
193
  end
194
194
 
@@ -1,7 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
- CREATE_JIRA_VERSION_VERSION_ID = :CREATE_JIRA_VERSION_VERSION_ID
4
+ JIRA_UTIL_CREATE_JIRA_VERSION_VERSION_ID = :JIRA_UTIL_CREATE_JIRA_VERSION_VERSION_ID
5
5
  end
6
6
 
7
7
  class CreateJiraVersionAction < Action
@@ -9,18 +9,19 @@ module Fastlane
9
9
  Actions.verify_gem!('jira-ruby')
10
10
  require 'jira-ruby'
11
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
- name = params[:name]
20
- description = params[:description]
21
- archived = params[:archived]
22
- released = params[:released]
23
- start_date = params[:start_date]
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
+ name = params[:name]
20
+ description = params[:description]
21
+ archived = params[:archived]
22
+ released = params[:released]
23
+ start_date = params[:start_date]
24
+ update_if_exists = params[:update_if_exists]
24
25
 
25
26
  options = {
26
27
  username: username,
@@ -43,22 +44,37 @@ module Fastlane
43
44
  start_date = Date.today.to_s
44
45
  end
45
46
 
46
- version = client.Version.build
47
- version.save!({
48
- "description" => description,
49
- "name" => name,
50
- "archived" => archived,
51
- "released" => released,
52
- "startDate" => start_date,
53
- "projectId" => project_id
54
- })
47
+ version = project.versions.find { |version| version.name == name }
48
+ if version.nil?
49
+ version = client.Version.build
50
+ version.save!({
51
+ "description" => description,
52
+ "name" => name,
53
+ "archived" => archived,
54
+ "released" => released,
55
+ "startDate" => start_date,
56
+ "projectId" => project_id
57
+ })
58
+ elsif update_if_exists
59
+ version.save!({
60
+ "description" => description,
61
+ "archived" => archived,
62
+ "released" => released,
63
+ "startDate" => start_date,
64
+ })
65
+ else
66
+ raise RuntimeError.new("Version with such name already exists.")
67
+ end
55
68
 
56
69
  version.fetch
57
- Actions.lane_context[SharedValues::CREATE_JIRA_VERSION_VERSION_ID] = version.id
70
+ Actions.lane_context[SharedValues::JIRA_UTIL_CREATE_JIRA_VERSION_VERSION_ID] = version.id
58
71
  version.id
72
+ rescue JIRA::HTTPError
73
+ UI.user_error!("Failed to create JIRA issue: #{$!.response.body}")
74
+ nil
59
75
  rescue
60
- UI.user_error!("Failed to create JIRA version: #{$!.response.body}")
61
- false
76
+ UI.user_error!("Failed to create JIRA issue: #{$!}")
77
+ nil
62
78
  end
63
79
 
64
80
  #####################################################
@@ -97,7 +113,7 @@ module Fastlane
97
113
  UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
98
114
  end),
99
115
  FastlaneCore::ConfigItem.new(key: :project_name,
100
- env_name: "FL_CREATE_JIRA_VERSION_PROJECT_NAME",
116
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
101
117
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
102
118
  type: String,
103
119
  optional: true,
@@ -109,7 +125,7 @@ module Fastlane
109
125
  UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
110
126
  end),
111
127
  FastlaneCore::ConfigItem.new(key: :project_id,
112
- env_name: "FL_CREATE_JIRA_VERSION_PROJECT_ID",
128
+ env_name: "FL_JIRA_UTIL_PROJECT_ID",
113
129
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
114
130
  type: String,
115
131
  optional: true,
@@ -121,41 +137,43 @@ module Fastlane
121
137
  UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
122
138
  end),
123
139
  FastlaneCore::ConfigItem.new(key: :name,
124
- env_name: "FL_CREATE_JIRA_VERSION_NAME",
140
+ is_string: true,
141
+ optional: true,
125
142
  description: "The name of the version. E.g. 1.0.0",
126
- type: String,
127
143
  verify_block: proc do |value|
128
144
  UI.user_error!("No version name given, pass using `name: '1.0.0'`") unless value and !value.empty?
129
145
  end),
130
146
  FastlaneCore::ConfigItem.new(key: :description,
131
- env_name: "FL_CREATE_JIRA_VERSION_DESCRIPTION",
132
- description: "The description of the JIRA project version",
133
- type: String,
147
+ is_string: true,
134
148
  optional: true,
149
+ description: "The description of the JIRA project version",
135
150
  default_value: ''),
136
151
  FastlaneCore::ConfigItem.new(key: :archived,
137
- env_name: "FL_CREATE_JIRA_VERSION_ARCHIVED",
138
- description: "Whether the version should be archived",
152
+ is_string: false,
139
153
  optional: true,
154
+ description: "Whether the version should be archived",
140
155
  default_value: false),
141
156
  FastlaneCore::ConfigItem.new(key: :released,
142
- env_name: "FL_CREATE_JIRA_VERSION_CREATED",
143
- description: "Whether the version should be released",
157
+ is_string: false,
144
158
  optional: true,
159
+ description: "Whether the version should be released",
145
160
  default_value: false),
146
161
  FastlaneCore::ConfigItem.new(key: :start_date,
147
- env_name: "FL_CREATE_JIRA_VERSION_START_DATE",
148
- description: "The date this version will start on",
149
- type: String,
150
162
  is_string: true,
151
163
  optional: true,
152
- default_value: Date.today.to_s)
164
+ description: "The date this version will start on",
165
+ default_value: Date.today.to_s),
166
+ FastlaneCore::ConfigItem.new(key: :update_if_exists,
167
+ is_string: false,
168
+ optional: true,
169
+ description: "If version with 'name' exists it will be updated",
170
+ default_value: false),
153
171
  ]
154
172
  end
155
173
 
156
174
  def self.output
157
175
  [
158
- ['CREATE_JIRA_VERSION_VERSION_ID', 'The versionId for the newly created JIRA project version']
176
+ ['JIRA_UTIL_CREATE_JIRA_VERSION_VERSION_ID', 'The versionId for the newly created JIRA project version']
159
177
  ]
160
178
  end
161
179
 
@@ -164,7 +182,7 @@ module Fastlane
164
182
  end
165
183
 
166
184
  def self.authors
167
- ["https://github.com/SandyChapman"]
185
+ [ "https://github.com/SandyChapman", "https://github.com/alexeyn-martynov" ]
168
186
  end
169
187
 
170
188
  def self.is_supported?(platform)
@@ -0,0 +1,163 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ JIRA_UTIL_GET_JIRA_VERSION_RESULT = :JIRA_UTIL_GET_JIRA_VERSION_RESULT
5
+ end
6
+
7
+ class GetJiraVersionAction < 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.id
35
+ end
36
+ raise ArgumentError.new("Project not found.") if project_id.nil?
37
+
38
+ version = nil
39
+ if !params[:id].nil?
40
+ version = project.versions.find { |version| version.id == params[:id] }
41
+ elsif !params[:name].nil?
42
+ version = project.versions.find { |version| version.name == params[:name] }
43
+ end
44
+
45
+ version_attrs = if !version.nil? then
46
+ Helper::JiraUtilHelper.transform_keys_to_symbols(version.attrs)
47
+ else
48
+ nil
49
+ end
50
+
51
+ Actions.lane_context[SharedValues::JIRA_UTIL_GET_JIRA_VERSION_RESULT] = version_attrs
52
+ version_attrs
53
+ rescue RuntimeError
54
+ UI.user_error!("#{$!}")
55
+ nil
56
+ rescue JIRA::HTTPError
57
+ UI.user_error!("Failed to find JIRA version: #{$!.response.body}")
58
+ nil
59
+ end
60
+
61
+ #####################################################
62
+ # @!group Documentation
63
+ #####################################################
64
+
65
+ def self.description
66
+ "Finds project version in your JIRA project by id or by name"
67
+ end
68
+
69
+ def self.details
70
+ "Use this action to find a version in JIRA"
71
+ end
72
+
73
+ def self.available_options
74
+ [
75
+ FastlaneCore::ConfigItem.new(key: :url,
76
+ env_name: "FL_JIRA_UTIL_SITE",
77
+ description: "URL for Jira instance",
78
+ type: String,
79
+ verify_block: proc do |value|
80
+ UI.user_error!("No url for Jira given, pass using `url: 'url'`") unless value and !value.empty?
81
+ end),
82
+ FastlaneCore::ConfigItem.new(key: :username,
83
+ env_name: "FL_JIRA_UTIL_USERNAME",
84
+ description: "Username for JIRA instance",
85
+ type: String,
86
+ verify_block: proc do |value|
87
+ UI.user_error!("No username given, pass using `username: 'jira_user'`") unless value and !value.empty?
88
+ end),
89
+ FastlaneCore::ConfigItem.new(key: :password,
90
+ env_name: "FL_JIRA_UTIL_PASSWORD",
91
+ description: "Password for Jira",
92
+ type: String,
93
+ verify_block: proc do |value|
94
+ UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
95
+ end),
96
+ FastlaneCore::ConfigItem.new(key: :project_name,
97
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
98
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
99
+ type: String,
100
+ optional: true,
101
+ conflicting_options: [:project_id],
102
+ conflict_block: proc do |value|
103
+ UI.user_error!("You can't use 'project_name' and '#{project_id}' options in one run")
104
+ end,
105
+ verify_block: proc do |value|
106
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
107
+ end),
108
+ FastlaneCore::ConfigItem.new(key: :project_id,
109
+ env_name: "FL_JIRA_UTIL_PROJECT_ID",
110
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
111
+ type: String,
112
+ optional: true,
113
+ conflicting_options: [:project_name],
114
+ conflict_block: proc do |value|
115
+ UI.user_error!("You can't use 'project_id' and '#{project_name}' options in one run")
116
+ end,
117
+ verify_block: proc do |value|
118
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
119
+ end),
120
+ FastlaneCore::ConfigItem.new(key: :id,
121
+ description: "JIRA version id. E.g. 123456",
122
+ optional: true,
123
+ conflicting_options: [ :name ],
124
+ conflict_block: proc do |value|
125
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
126
+ end,
127
+ verify_block: proc do |value|
128
+ UI.user_error!("Empty verison id") unless !value.nil? and !value.empty?
129
+ end),
130
+ FastlaneCore::ConfigItem.new(key: :name,
131
+ description: "JIRA version name",
132
+ is_string: false,
133
+ optional: true,
134
+ conflicting_options: [:id],
135
+ conflict_block: proc do |value|
136
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
137
+ end,
138
+ verify_block: proc do |value|
139
+ UI.user_error!("Empty verison name") unless !value.nil? and !value.empty?
140
+ end)
141
+ ]
142
+ end
143
+
144
+ def self.output
145
+ [
146
+ ['JIRA_UTIL_GET_JIRA_VERSION_RESULT', 'Hash containing all version attributes']
147
+ ]
148
+ end
149
+
150
+ def self.return_value
151
+ 'Hash containing all version attributes'
152
+ end
153
+
154
+ def self.authors
155
+ [ "https://github.com/alexeyn-martynov" ]
156
+ end
157
+
158
+ def self.is_supported?(platform)
159
+ true
160
+ end
161
+ end
162
+ end
163
+ end
@@ -101,7 +101,7 @@ module Fastlane
101
101
  UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
102
102
  end),
103
103
  FastlaneCore::ConfigItem.new(key: :project_name,
104
- env_name: "FL_RELEASE_JIRA_VERSION_PROJECT_NAME",
104
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
105
105
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
106
106
  type: String,
107
107
  optional: true,
@@ -113,7 +113,7 @@ module Fastlane
113
113
  UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
114
114
  end),
115
115
  FastlaneCore::ConfigItem.new(key: :project_id,
116
- env_name: "FL_RELEASE_JIRA_VERSION_PROJECT_ID",
116
+ env_name: "FL_JIRA_UTIL_PROJECT_ID",
117
117
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
118
118
  type: String,
119
119
  optional: true,
@@ -1,10 +1,10 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  module SharedValues
4
- CREATE_OR_UPDATE_JIRA_VERSION_VERSION_ID = :CREATE_OR_UPDATE_JIRA_VERSION_VERSION_ID
4
+ JIRA_UTIL_UPDATE_JIRA_VERSION_VERSION_ID = :JIRA_UTIL_UPDATE_JIRA_VERSION_VERSION_ID
5
5
  end
6
6
 
7
- class CreateOrUpdateJiraVersionAction < Action
7
+ class UpdateJiraVersionAction < Action
8
8
  def self.run(params)
9
9
  Actions.verify_gem!('jira-ruby')
10
10
  require 'jira-ruby'
@@ -17,6 +17,7 @@ module Fastlane
17
17
  project_name = params[:project_name]
18
18
  project_id = params[:project_id]
19
19
  name = params[:name]
20
+ new_name = params[:new_name]
20
21
  description = params[:description]
21
22
  archived = params[:archived]
22
23
  released = params[:released]
@@ -37,38 +38,52 @@ module Fastlane
37
38
  project = client.Project.find(project_name)
38
39
  project_id = project.id
39
40
  end
40
- raise ArgumentError.new("Project not found.") if project_id.nil?
41
+ raise ArgumentError.new('Project not found') if project_id.nil?
41
42
 
42
43
  if start_date.nil?
43
44
  start_date = Date.today.to_s
44
45
  end
45
46
 
46
- # INFO: If version exist update it
47
- version = project.versions.find { |version| version.name == name }
48
- if version.nil?
49
- version = client.Version.build
50
- version.save!({
51
- "description" => description,
52
- "name" => name,
53
- "archived" => archived,
54
- "released" => released,
55
- "startDate" => start_date,
56
- "projectId" => project_id
57
- })
58
- else
59
- version.save!({
60
- "description" => description,
61
- "archived" => archived,
62
- "released" => released,
63
- "startDate" => start_date,
64
- })
47
+ version = nil
48
+ if !params[:id].nil?
49
+ version = project.versions.find { |version| version.id == params[:id] }
50
+ elsif !params[:name].nil?
51
+ version = project.versions.find { |version| version.name == params[:name] }
65
52
  end
66
53
 
67
- version.fetch
68
- Actions.lane_context[SharedValues::CREATE_OR_UPDATE_JIRA_VERSION_VERSION_ID] = version.id
54
+ raise ArgumentError.new('Version not found') if version.nil?
55
+
56
+ version_fields = {
57
+ }
58
+
59
+ unless new_name.nil?
60
+ version_fields['name'] = new_name
61
+ end
62
+
63
+ unless description.nil?
64
+ version_fields['description'] = description
65
+ end
66
+
67
+ unless archived.nil?
68
+ version_fields['archived'] = archived
69
+ end
70
+
71
+ unless released.nil?
72
+ version_fields['released'] = released
73
+ end
74
+
75
+ unless start_date.nil?
76
+ version_fields['startDate'] = start_date
77
+ end
78
+
79
+ raise ArgumentError.new('Nothng to update') if version_fields.empty?
80
+
81
+ version.save!(version_fields)
82
+
83
+ Actions.lane_context[SharedValues::JIRA_UTIL_UPDATE_JIRA_VERSION_VERSION_ID] = version.id
69
84
  version.id
70
85
  rescue
71
- UI.user_error!("Failed to create JIRA version: #{$!.response.body}")
86
+ UI.user_error!("Failed to update JIRA version: #{$!.response.body}")
72
87
  false
73
88
  end
74
89
 
@@ -108,7 +123,7 @@ module Fastlane
108
123
  UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
109
124
  end),
110
125
  FastlaneCore::ConfigItem.new(key: :project_name,
111
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_PROJECT_NAME",
126
+ env_name: "FL_JIRA_UTIL_PROJECT_NAME",
112
127
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
113
128
  type: String,
114
129
  optional: true,
@@ -120,7 +135,7 @@ module Fastlane
120
135
  UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
121
136
  end),
122
137
  FastlaneCore::ConfigItem.new(key: :project_id,
123
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_PROJECT_ID",
138
+ env_name: "FL_JIRA_UTIL_PROJECT_ID",
124
139
  description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
125
140
  type: String,
126
141
  optional: true,
@@ -131,47 +146,60 @@ module Fastlane
131
146
  verify_block: proc do |value|
132
147
  UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
133
148
  end),
149
+ FastlaneCore::ConfigItem.new(key: :id,
150
+ description: "JIRA version id. E.g. 123456",
151
+ optional: true,
152
+ conflicting_options: [ :name ],
153
+ conflict_block: proc do |value|
154
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
155
+ end,
156
+ verify_block: proc do |value|
157
+ UI.user_error!("Empty verison id") unless value and !value.empty?
158
+ end),
134
159
  FastlaneCore::ConfigItem.new(key: :name,
135
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_NAME",
136
- description: "The name of the version. E.g. 1.0.0",
137
- type: String,
160
+ description: "JIRA version name",
161
+ is_string: false,
162
+ optional: true,
163
+ conflicting_options: [:id],
164
+ conflict_block: proc do |value|
165
+ UI.user_error!("You can't use 'id' and 'name' options in one run")
166
+ end,
138
167
  verify_block: proc do |value|
139
- UI.user_error!("No version name given, pass using `name: '1.0.0'`") unless value and !value.empty?
168
+ UI.user_error!("Empty verison name") unless value and !value.empty?
169
+ end),
170
+ FastlaneCore::ConfigItem.new(key: :new_name,
171
+ optional: true,
172
+ description: "New name for the version. E.g. 1.0.0",
173
+ verify_block: proc do |value|
174
+ UI.user_error!("new_name is empty") unless value and !value.empty?
140
175
  end),
141
176
  FastlaneCore::ConfigItem.new(key: :description,
142
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_DESCRIPTION",
143
- description: "The description of the JIRA project version",
144
- type: String,
145
177
  optional: true,
146
- default_value: ''),
178
+ description: "The description of the JIRA project version"),
147
179
  FastlaneCore::ConfigItem.new(key: :archived,
148
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_ARCHIVED",
149
180
  description: "Whether the version should be archived",
150
181
  optional: true,
151
- default_value: false),
182
+ is_string: false),
152
183
  FastlaneCore::ConfigItem.new(key: :released,
153
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_CREATED",
154
184
  description: "Whether the version should be released",
155
185
  optional: true,
156
- default_value: false),
186
+ is_string: false),
157
187
  FastlaneCore::ConfigItem.new(key: :start_date,
158
- env_name: "FL_CREATE_OR_UPDATE_JIRA_VERSION_START_DATE",
159
188
  description: "The date this version will start on",
160
189
  type: String,
161
190
  is_string: true,
162
- optional: true,
163
- default_value: Date.today.to_s)
191
+ optional: true)
164
192
  ]
165
193
  end
166
194
 
167
195
  def self.output
168
196
  [
169
- ['CREATE_OR_UPDATE_JIRA_VERSION_VERSION_ID', 'The versionId for the newly created JIRA project version']
197
+ ['JIRA_UTIL_UPDATE_JIRA_VERSION_VERSION_ID', 'The id for the updated JIRA project version']
170
198
  ]
171
199
  end
172
200
 
173
201
  def self.return_value
174
- 'The versionId for the newly create JIRA project version'
202
+ 'The id for the updated JIRA project version'
175
203
  end
176
204
 
177
205
  def self.authors
@@ -11,6 +11,11 @@ module Fastlane
11
11
  def self.show_message
12
12
  UI.message("Hello from the jira_util plugin helper!")
13
13
  end
14
+
15
+ def self.transform_keys_to_symbols(value)
16
+ return value if not value.is_a?(Hash)
17
+ return value.inject({}){|memo,(k,v)| memo[k.to_sym] = Helper::JiraUtilHelper.transform_keys_to_symbols(v); memo}
18
+ end
14
19
  end
15
20
  end
16
21
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module JiraUtil
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.1"
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.1.9
4
+ version: 0.2.1
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-11-25 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jira-ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.0
19
+ version: 1.7.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.0
26
+ version: 1.7.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -161,8 +161,9 @@ 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/create_or_update_jira_version.rb
164
+ - lib/fastlane/plugin/jira_util/actions/get_jira_version.rb
165
165
  - lib/fastlane/plugin/jira_util/actions/release_jira_version.rb
166
+ - lib/fastlane/plugin/jira_util/actions/update_jira_version.rb
166
167
  - lib/fastlane/plugin/jira_util/helper/jira_util_helper.rb
167
168
  - lib/fastlane/plugin/jira_util/version.rb
168
169
  homepage: https://github.com/alexeyn-martynov/fastlane-plugin-jira_versions
@@ -184,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
185
  - !ruby/object:Gem::Version
185
186
  version: '0'
186
187
  requirements: []
187
- rubygems_version: 3.0.3
188
+ rubygems_version: 3.0.6
188
189
  signing_key:
189
190
  specification_version: 4
190
191
  summary: "%q{Create JIRA issues and manage versions with this plugin}"