fastlane-plugin-jira_versions 0.1.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: 33da91cd26f04c07ab486ee97746da815a11069c
4
+ data.tar.gz: 41d7079efec23a1dbc669045b5c8a253c92a07fc
5
+ SHA512:
6
+ metadata.gz: ae25ab47a6a5cd5e730361b7b2d2af91495c567bc0b9192f90afb72dcf37a88226633ad39bd1d498fb0ea62086be2268efe4eea9301360a0b25c3d8f5a8ab064
7
+ data.tar.gz: 9913ead2679d7c52670cb6f7f033b9cfc3d695d696ef43f9e3959aa490c9c5c196e420c00068dc2495ab38f32710a2521a049d761119e0c9b9df1bf39b4f9640
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Sandy Chapman <sandychapman@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,54 @@
1
+ # jira_versions 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_versions)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-jira_versions`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin jira_versions
11
+ ```
12
+
13
+ ## About jira_versions
14
+
15
+ Manage your JIRA project's releases/versions with this plugin.
16
+
17
+ Currently, jira_versions comes with two actions, `create_jira_version` and `release_jira_version`. The first will create a new version in your JIRA project and the second will release a version.
18
+
19
+ ## Create Version Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins`, modifying the placeholder variables in the Fastfile lane and running `bundle exec fastlane create_version`.
22
+
23
+ ## Release Version Example
24
+
25
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins`, modifying the placeholder variables in the Fastfile lane and running `bundle exec fastlane release_version`.
26
+
27
+ ## Run tests for this plugin
28
+
29
+ To run both the tests, and code style validation, run
30
+
31
+ ```
32
+ rake
33
+ ```
34
+
35
+ To automatically fix many of the styling issues, use
36
+ ```
37
+ rubocop -a
38
+ ```
39
+
40
+ ## Issues and Feedback
41
+
42
+ For any other issues and feedback about this plugin, please submit it to this repository.
43
+
44
+ ## Troubleshooting
45
+
46
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
47
+
48
+ ## Using `fastlane` Plugins
49
+
50
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
51
+
52
+ ## About `fastlane`
53
+
54
+ `fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/jira_versions/version'
2
+
3
+ module Fastlane
4
+ module JiraVersions
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::JiraVersions.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,173 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ CREATE_JIRA_VERSION_VERSION_ID = :CREATE_JIRA_VERSION_VERSION_ID
5
+ end
6
+
7
+ class CreateJiraVersionAction < 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
+ name = params[:name]
20
+ description = params[:description]
21
+ archived = params[:archived]
22
+ released = params[:released]
23
+ start_date = params[:start_date]
24
+
25
+ options = {
26
+ username: username,
27
+ password: password,
28
+ site: site,
29
+ context_path: context_path,
30
+ auth_type: auth_type,
31
+ read_timeout: 120
32
+ }
33
+
34
+ client = JIRA::Client.new(options)
35
+
36
+ unless project_name.nil?
37
+ project = client.Project.find(project_name)
38
+ project_id = project.id
39
+ end
40
+
41
+ if start_date.nil?
42
+ start_date = Date.today.to_s
43
+ end
44
+
45
+ version = client.Version.build
46
+ version.save!({
47
+ "description" => description,
48
+ "name" => name,
49
+ "archived" => archived,
50
+ "released" => released,
51
+ "startDate" => start_date,
52
+ "projectId" => project_id
53
+ })
54
+ version.fetch
55
+ Actions.lane_context[SharedValues::CREATE_JIRA_VERSION_VERSION_ID] = version.id
56
+ version.id
57
+ rescue
58
+ UI.user_error!("Failed to create new JIRA version: #{$!.response.body}")
59
+ false
60
+ end
61
+
62
+ #####################################################
63
+ # @!group Documentation
64
+ #####################################################
65
+
66
+ def self.description
67
+ "Creates a new version in your JIRA project"
68
+ end
69
+
70
+ def self.details
71
+ "Use this action to create a new version in JIRA"
72
+ end
73
+
74
+ def self.available_options
75
+ [
76
+ FastlaneCore::ConfigItem.new(key: :url,
77
+ env_name: "FL_CREATE_JIRA_VERSION_SITE",
78
+ description: "URL for Jira instance",
79
+ type: String,
80
+ verify_block: proc do |value|
81
+ UI.user_error!("No url for Jira given, pass using `url: 'url'`") unless value and !value.empty?
82
+ end),
83
+ FastlaneCore::ConfigItem.new(key: :username,
84
+ env_name: "FL_CREATE_JIRA_VERSION_USERNAME",
85
+ description: "Username for JIRA instance",
86
+ type: String,
87
+ verify_block: proc do |value|
88
+ UI.user_error!("No username given, pass using `username: 'jira_user'`") unless value and !value.empty?
89
+ end),
90
+ FastlaneCore::ConfigItem.new(key: :password,
91
+ env_name: "FL_CREATE_JIRA_VERSION_PASSWORD",
92
+ description: "Password for Jira",
93
+ type: String,
94
+ verify_block: proc do |value|
95
+ UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
96
+ end),
97
+ FastlaneCore::ConfigItem.new(key: :project_name,
98
+ env_name: "FL_CREATE_JIRA_VERSION_PROJECT_NAME",
99
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
100
+ type: String,
101
+ optional: true,
102
+ conflicting_options: [:project_id],
103
+ conflict_block: proc do |value|
104
+ UI.user_error!("You can't use 'project_name' and '#{project_id}' options in one run")
105
+ end,
106
+ verify_block: proc do |value|
107
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
108
+ end),
109
+ FastlaneCore::ConfigItem.new(key: :project_id,
110
+ env_name: "FL_CREATE_JIRA_VERSION_PROJECT_ID",
111
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
112
+ type: String,
113
+ optional: true,
114
+ conflicting_options: [:project_name],
115
+ conflict_block: proc do |value|
116
+ UI.user_error!("You can't use 'project_id' and '#{project_name}' options in one run")
117
+ end,
118
+ verify_block: proc do |value|
119
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
120
+ end),
121
+ FastlaneCore::ConfigItem.new(key: :name,
122
+ env_name: "FL_CREATE_JIRA_VERSION_NAME",
123
+ description: "The name of the version. E.g. 1.0.0",
124
+ type: String,
125
+ verify_block: proc do |value|
126
+ UI.user_error!("No version name given, pass using `name: '1.0.0'`") unless value and !value.empty?
127
+ end),
128
+ FastlaneCore::ConfigItem.new(key: :description,
129
+ env_name: "FL_CREATE_JIRA_VERSION_DESCRIPTION",
130
+ description: "The description of the JIRA project version",
131
+ type: String,
132
+ optional: true,
133
+ default_value: ''),
134
+ FastlaneCore::ConfigItem.new(key: :archived,
135
+ env_name: "FL_CREATE_JIRA_VERSION_ARCHIVED",
136
+ description: "Whether the version should be archived",
137
+ optional: true,
138
+ default_value: false),
139
+ FastlaneCore::ConfigItem.new(key: :released,
140
+ env_name: "FL_CREATE_JIRA_VERSION_CREATED",
141
+ description: "Whether the version should be released",
142
+ optional: true,
143
+ default_value: false),
144
+ FastlaneCore::ConfigItem.new(key: :start_date,
145
+ env_name: "FL_CREATE_JIRA_VERSION_START_DATE",
146
+ description: "The date this version will start on",
147
+ type: String,
148
+ is_string: true,
149
+ optional: true,
150
+ default_value: Date.today.to_s)
151
+ ]
152
+ end
153
+
154
+ def self.output
155
+ [
156
+ ['CREATE_JIRA_VERSION_VERSION_ID', 'The versionId for the newly created JIRA project version']
157
+ ]
158
+ end
159
+
160
+ def self.return_value
161
+ 'The versionId for the newly create JIRA project version'
162
+ end
163
+
164
+ def self.authors
165
+ ["https://github.com/SandyChapman"]
166
+ end
167
+
168
+ def self.is_supported?(platform)
169
+ true
170
+ end
171
+ end
172
+ end
173
+ end
@@ -0,0 +1,155 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ RELEASE_JIRA_VERSION_VERSION_ID = :RELEASE_JIRA_VERSION_VERSION_ID
5
+ end
6
+
7
+ class ReleaseJiraVersionAction < 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
+ name = params[:name]
20
+ release_date = params[:release_date]
21
+ released = true
22
+
23
+ options = {
24
+ username: username,
25
+ password: password,
26
+ site: site,
27
+ context_path: context_path,
28
+ auth_type: auth_type,
29
+ read_timeout: 120
30
+ }
31
+
32
+ client = JIRA::Client.new(options)
33
+
34
+ unless project_name.nil?
35
+ project = client.Project.find(project_name)
36
+ project_id = project.id
37
+ end
38
+
39
+ version = project.versions.find { |version| version.name == name }
40
+ if version.nil?
41
+ raise "Version '#{name}' not found."
42
+ return false
43
+ end
44
+ version.save!({
45
+ "released" => released,
46
+ "releaseDate" => release_date,
47
+ "projectId" => project_id
48
+ })
49
+ version.fetch
50
+ Actions.lane_context[SharedValues::RELEASE_JIRA_VERSION_VERSION_ID] = version.id
51
+ version.id
52
+ rescue RuntimeError
53
+ UI.user_error!("#{$!}")
54
+ false
55
+ rescue JIRA::HTTPError
56
+ UI.user_error!("Failed to release new JIRA version: #{$!.response.body}")
57
+ false
58
+ end
59
+
60
+ #####################################################
61
+ # @!group Documentation
62
+ #####################################################
63
+
64
+ def self.description
65
+ "Releases a version in your JIRA project"
66
+ end
67
+
68
+ def self.details
69
+ "Use this action to release a version in JIRA"
70
+ end
71
+
72
+ def self.available_options
73
+ [
74
+ FastlaneCore::ConfigItem.new(key: :url,
75
+ env_name: "FL_RELEASE_JIRA_VERSION_SITE",
76
+ description: "URL for Jira instance",
77
+ type: String,
78
+ verify_block: proc do |value|
79
+ UI.user_error!("No url for Jira given, pass using `url: 'url'`") unless value and !value.empty?
80
+ end),
81
+ FastlaneCore::ConfigItem.new(key: :username,
82
+ env_name: "FL_RELEASE_JIRA_VERSION_USERNAME",
83
+ description: "Username for JIRA instance",
84
+ type: String,
85
+ verify_block: proc do |value|
86
+ UI.user_error!("No username given, pass using `username: 'jira_user'`") unless value and !value.empty?
87
+ end),
88
+ FastlaneCore::ConfigItem.new(key: :password,
89
+ env_name: "FL_RELEASE_JIRA_VERSION_PASSWORD",
90
+ description: "Password for Jira",
91
+ type: String,
92
+ verify_block: proc do |value|
93
+ UI.user_error!("No password given, pass using `password: 'T0PS3CR3T'`") unless value and !value.empty?
94
+ end),
95
+ FastlaneCore::ConfigItem.new(key: :project_name,
96
+ env_name: "FL_RELEASE_JIRA_VERSION_PROJECT_NAME",
97
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
98
+ type: String,
99
+ optional: true,
100
+ conflicting_options: [:project_id],
101
+ conflict_block: proc do |value|
102
+ UI.user_error!("You can't use 'project_name' and '#{project_id}' options in one run")
103
+ end,
104
+ verify_block: proc do |value|
105
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
106
+ end),
107
+ FastlaneCore::ConfigItem.new(key: :project_id,
108
+ env_name: "FL_RELEASE_JIRA_VERSION_PROJECT_ID",
109
+ description: "Project ID for the JIRA project. E.g. the short abbreviation in the JIRA ticket tags",
110
+ type: String,
111
+ optional: true,
112
+ conflicting_options: [:project_name],
113
+ conflict_block: proc do |value|
114
+ UI.user_error!("You can't use 'project_id' and '#{project_name}' options in one run")
115
+ end,
116
+ verify_block: proc do |value|
117
+ UI.user_error!("No Project ID given, pass using `project_id: 'PROJID'`") unless value and !value.empty?
118
+ end),
119
+ FastlaneCore::ConfigItem.new(key: :name,
120
+ env_name: "FL_RELEASE_JIRA_VERSION_NAME",
121
+ description: "The name of the version. E.g. 1.0.0",
122
+ type: String,
123
+ verify_block: proc do |value|
124
+ UI.user_error!("No version name given, pass using `name: '1.0.0'`") unless value and !value.empty?
125
+ end),
126
+ FastlaneCore::ConfigItem.new(key: :release_date,
127
+ env_name: "FL_CREATE_JIRA_VERSION_RELEASE_DATE",
128
+ description: "The date this version ended on",
129
+ type: String,
130
+ is_string: true,
131
+ optional: true,
132
+ default_value: Date.today.to_s)
133
+ ]
134
+ end
135
+
136
+ def self.output
137
+ [
138
+ ['RELEASE_JIRA_VERSION_VERSION_ID', 'The versionId for the newly released JIRA project version']
139
+ ]
140
+ end
141
+
142
+ def self.return_value
143
+ 'The versionId for the newly release JIRA project version'
144
+ end
145
+
146
+ def self.authors
147
+ ["https://github.com/SandyChapman"]
148
+ end
149
+
150
+ def self.is_supported?(platform)
151
+ true
152
+ end
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class JiraVersionsHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::JiraVersionsHelper.your_method`
6
+ #
7
+ # def self.show_message
8
+ # UI.message("Hello from the jira_versions plugin helper!")
9
+ # end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module JiraVersions
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-jira_versions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sandy Chapman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-02 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.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.0
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: rake
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: rubocop
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: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.102.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.102.0
111
+ description:
112
+ email: sandychapman@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/jira_versions.rb
120
+ - lib/fastlane/plugin/jira_versions/actions/create_jira_version.rb
121
+ - lib/fastlane/plugin/jira_versions/actions/release_jira_version.rb
122
+ - lib/fastlane/plugin/jira_versions/helper/jira_versions_helper.rb
123
+ - lib/fastlane/plugin/jira_versions/version.rb
124
+ homepage: https://github.com/SandyChapman/fastlane-plugin-jira_versions
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.5.1
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Manage your JIRA project's releases/versions with this plugin.
148
+ test_files: []