fastlane-plugin-jira_set_fix_version 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 515f013363095ddb506058784ec925dd2e8dc8dd
4
+ data.tar.gz: 8e483542d4086bfd70fd7a77d3c502d7d03687a7
5
+ SHA512:
6
+ metadata.gz: 43e5a0f68427542d31d59ba59d13f76c45118f23b64de85eaa9862edd3df5b57e4555559401d7cbeaf7aec981f51b912faf4a43b44dfaa7db8bd44aadf67975c
7
+ data.tar.gz: be2d1c25cbfea50b2dd77d1cbef68c272b75ddc884fa89f6fe5aa1fa8a5d2a4313dba9086b69e3d7f4a9c9db1c3fff0f1e53b6d0cbb694646ef7977ce2c32017
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Tommy Sadiq Hinrichsen <tommy.lynge@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,63 @@
1
+ # jira_set_fix_version plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-jira_set_fix_version)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-jira_set_fix_version`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin jira_set_fix_version
11
+ ```
12
+
13
+ ## About jira_set_fix_version
14
+
15
+ Tags all Jira issues mentioned in git changelog with with a fix version from parameter :name
16
+
17
+ Usage:
18
+
19
+ ```ruby
20
+ lane :update_jira do
21
+ version_number = get_version_number
22
+ build_number = get_build_number
23
+ lane = lane_context[SharedValues::LANE_NAME].split[-1]
24
+ jira_set_fix_version(
25
+ name: "#{lane} #{version_number} (#{build_number})"
26
+ )
27
+ end
28
+ ```
29
+
30
+ Thank you to https://github.com/valeriomazzeo/fastlane-plugin-jira_transition and https://github.com/valeriomazzeo/fastlane-plugin-jira_transition for inspiration.
31
+
32
+ ## Example
33
+
34
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane update_jira`.
35
+
36
+ ## Run tests for this plugin
37
+
38
+ To run both the tests, and code style validation, run
39
+
40
+ ```
41
+ rake
42
+ ```
43
+
44
+ To automatically fix many of the styling issues, use
45
+ ```
46
+ rubocop -a
47
+ ```
48
+
49
+ ## Issues and Feedback
50
+
51
+ For any other issues and feedback about this plugin, please submit it to this repository.
52
+
53
+ ## Troubleshooting
54
+
55
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
56
+
57
+ ## Using _fastlane_ Plugins
58
+
59
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
60
+
61
+ ## About _fastlane_
62
+
63
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/jira_set_fix_version/version'
2
+
3
+ module Fastlane
4
+ module JiraSetFixVersion
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::JiraSetFixVersion.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,178 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/jira_set_fix_version_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ CREATE_JIRA_VERSION_VERSION_ID = :CREATE_JIRA_VERSION_VERSION_ID
8
+ end
9
+ class JiraSetFixVersionAction < Action
10
+ def self.run(params)
11
+ Actions.verify_gem!('jira-ruby')
12
+ require "jira-ruby"
13
+
14
+ site = params[:url]
15
+ context_path = ""
16
+ auth_type = :basic
17
+ username = params[:username]
18
+ password = params[:password]
19
+ project_name = params[:project_name]
20
+ name = params[:name]
21
+ description = params[:description]
22
+ archived = params[:archived]
23
+ released = params[:released]
24
+ start_date = params[:start_date]
25
+
26
+ options = {
27
+ username: username,
28
+ password: password,
29
+ site: site,
30
+ context_path: context_path,
31
+ auth_type: auth_type,
32
+ read_timeout: 120
33
+ }
34
+
35
+ client = JIRA::Client.new(options)
36
+
37
+ unless project_name.nil?
38
+ project = client.Project.find(project_name)
39
+ project_id = project.id
40
+ end
41
+
42
+ if start_date.nil?
43
+ start_date = Date.today.to_s
44
+ end
45
+
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
+ })
55
+ Actions.lane_context[SharedValues::CREATE_JIRA_VERSION_VERSION_ID] = version.id
56
+
57
+ if Actions.lane_context[SharedValues::FL_CHANGELOG].nil?
58
+ changelog_configuration = FastlaneCore::Configuration.create(Actions::ChangelogFromGitCommitsAction.available_options, {})
59
+ Actions::ChangelogFromGitCommitsAction.run(changelog_configuration)
60
+ end
61
+ issue_ids = Actions.lane_context[SharedValues::FL_CHANGELOG].scan(/#{project_name}-\d+/i).uniq
62
+ issue_ids.each do |issue_id|
63
+ begin
64
+ issue = client.Issue.find(issue_id)
65
+ fixVersions = [version]
66
+ issue.save({"fields"=>{ "fixVersions" => fixVersions }})
67
+ rescue JIRA::HTTPError
68
+ "Skipping issue #{issue_id}"
69
+ end
70
+ end
71
+ version.id
72
+ end
73
+
74
+ def self.description
75
+ "Tags all Jira issues mentioned in git changelog with with a fix version from parameter :name"
76
+ end
77
+
78
+ def self.authors
79
+ ["Tommy Sadiq Hinrichsen"]
80
+ end
81
+
82
+ def self.return_value
83
+ "Return the name of the created Jira version"
84
+ end
85
+
86
+ def self.details
87
+ # Optional:
88
+ # this is your chance to provide a more detailed description of this action
89
+ "This action requires jira-ruby gem.
90
+
91
+ Usage:
92
+ lane :update_jira do
93
+ version_number = get_version_number
94
+ build_number = get_build_number
95
+ lane = lane_context[SharedValues::LANE_NAME].split[-1]
96
+ jira_set_fix_version(
97
+ name: \"#{lane} #{version_number} (#{build_number})\"
98
+ )
99
+ end
100
+
101
+ Thank you to https://github.com/valeriomazzeo/fastlane-plugin-jira_transition and https://github.com/valeriomazzeo/fastlane-plugin-jira_transition for inspiration.
102
+ "
103
+ end
104
+
105
+ def self.available_options
106
+ [
107
+ FastlaneCore::ConfigItem.new(key: :url,
108
+ env_name: "FL_CREATE_JIRA_VERSION_SITE",
109
+ description: "URL for Jira instance",
110
+ type: String,
111
+ verify_block: proc do |value|
112
+ UI.user_error!("No url for Jira given, pass using `url: 'url'`") unless value and !value.empty?
113
+ end),
114
+ FastlaneCore::ConfigItem.new(key: :username,
115
+ env_name: "FL_CREATE_JIRA_VERSION_USERNAME",
116
+ description: "Username for JIRA instance",
117
+ type: String,
118
+ verify_block: proc do |value|
119
+ UI.user_error!("No username given, pass using `username: 'jira_user'`") unless value and !value.empty?
120
+ end),
121
+ FastlaneCore::ConfigItem.new(key: :password,
122
+ env_name: "FL_CREATE_JIRA_VERSION_PASSWORD",
123
+ description: "Password for Jira",
124
+ type: String,
125
+ verify_block: proc do |value|
126
+ UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
127
+ end),
128
+ FastlaneCore::ConfigItem.new(key: :project_name,
129
+ env_name: "FL_CREATE_JIRA_VERSION_PROJECT_NAME",
130
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
131
+ type: String,
132
+ optional: true,
133
+ conflicting_options: [:project_id],
134
+ conflict_block: proc do |value|
135
+ UI.user_error!("You can't use 'project_name' and '#{project_id}' options in one run")
136
+ end,
137
+ verify_block: proc do |value|
138
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
139
+ end),
140
+ FastlaneCore::ConfigItem.new(key: :name,
141
+ env_name: "FL_CREATE_JIRA_VERSION_NAME",
142
+ description: "The name of the version. E.g. 1.0.0",
143
+ type: String,
144
+ verify_block: proc do |value|
145
+ UI.user_error!("No version name given, pass using `name: '1.0.0'`") unless value and !value.empty?
146
+ end),
147
+ FastlaneCore::ConfigItem.new(key: :description,
148
+ env_name: "FL_CREATE_JIRA_VERSION_DESCRIPTION",
149
+ description: "The description of the JIRA project version",
150
+ type: String,
151
+ optional: true,
152
+ default_value: ''),
153
+ FastlaneCore::ConfigItem.new(key: :archived,
154
+ env_name: "FL_CREATE_JIRA_VERSION_ARCHIVED",
155
+ description: "Whether the version should be archived",
156
+ optional: true,
157
+ default_value: false),
158
+ FastlaneCore::ConfigItem.new(key: :released,
159
+ env_name: "FL_CREATE_JIRA_VERSION_CREATED",
160
+ description: "Whether the version should be released",
161
+ optional: true,
162
+ default_value: false),
163
+ FastlaneCore::ConfigItem.new(key: :start_date,
164
+ env_name: "FL_CREATE_JIRA_VERSION_START_DATE",
165
+ description: "The date this version will start on",
166
+ type: String,
167
+ is_string: true,
168
+ optional: true,
169
+ default_value: Date.today.to_s)
170
+ ]
171
+ end
172
+
173
+ def self.is_supported?(platform)
174
+ true
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class JiraSetFixVersionHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::JiraSetFixVersionHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the jira_set_fix_version plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module JiraSetFixVersion
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-jira_set_fix_version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Tommy Sadiq Hinrichsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jira-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec_junit_formatter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.49.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.49.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-require_tools
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: fastlane
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.77.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.77.1
153
+ description:
154
+ email: tommy.lynge@gmail.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/jira_set_fix_version.rb
162
+ - lib/fastlane/plugin/jira_set_fix_version/actions/jira_set_fix_version_action.rb
163
+ - lib/fastlane/plugin/jira_set_fix_version/helper/jira_set_fix_version_helper.rb
164
+ - lib/fastlane/plugin/jira_set_fix_version/version.rb
165
+ homepage: https://github.com/sadiq81/fastlane-plugin-jira_set_fix_version
166
+ licenses:
167
+ - MIT
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubyforge_project:
185
+ rubygems_version: 2.6.11
186
+ signing_key:
187
+ specification_version: 4
188
+ summary: Tags all Jira issues mentioned in git changelog with with a fix version from
189
+ parameter :name
190
+ test_files: []