fastlane-plugin-jira_transition 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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/lib/fastlane/plugin/jira_transition.rb +16 -0
- data/lib/fastlane/plugin/jira_transition/actions/jira_transition_action.rb +116 -0
- data/lib/fastlane/plugin/jira_transition/helper/jira_transition_helper.rb +12 -0
- data/lib/fastlane/plugin/jira_transition/version.rb +5 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b572eff91499f69b29300be76ecb2a14a45c930d
|
4
|
+
data.tar.gz: 88b989556ae25721be7c6fdfa9f235e3fe467a6d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47537557ab7a34978ea7679b1f2698bcaf5ddbbf329024ab85188defe044da0f1f5bef96fe2037e22c846aee45fe94f171c3d6519f2ed167fd7a3c4768a0f20a
|
7
|
+
data.tar.gz: 0a90ee4203babb4a6b47d316e1212a8756b0cf85ad904d009c205b6b21c81360f7a2ed54298b9e709b3a56072c58c6408ed95bfbc65cd5e927350b499b20a18d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Valerio Mazzeo <valerio.mazzeo@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.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# fastlane-plugin-jira_transition `fastlane` Plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-jira_transition)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with fastlane-plugin-jira_transition, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin jira_transition
|
11
|
+
```
|
12
|
+
|
13
|
+
## About jira_transition
|
14
|
+
|
15
|
+
Apply a JIRA transition to issues mentioned in the changelog
|
16
|
+
|
17
|
+
## Example
|
18
|
+
|
19
|
+
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 test`.
|
20
|
+
|
21
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
22
|
+
|
23
|
+
## Issues and Feedback
|
24
|
+
|
25
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
26
|
+
|
27
|
+
## Troubleshooting
|
28
|
+
|
29
|
+
For some more detailed help with plugins problems, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
|
30
|
+
|
31
|
+
## Using `fastlane` Plugins
|
32
|
+
|
33
|
+
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) in the main `fastlane` repo.
|
34
|
+
|
35
|
+
## About `fastlane`
|
36
|
+
|
37
|
+
`fastlane` automates building, testing, and releasing your app for beta and app store distributions. To learn more about `fastlane`, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/jira_transition/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module JiraTransition
|
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::JiraTransition.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class JiraTransitionAction < Action
|
4
|
+
|
5
|
+
def self.run(params)
|
6
|
+
Actions.verify_gem!('jira-ruby')
|
7
|
+
require 'jira'
|
8
|
+
|
9
|
+
site = params[:url]
|
10
|
+
context_path = ""
|
11
|
+
auth_type = :basic
|
12
|
+
username = params[:username]
|
13
|
+
password = params[:password]
|
14
|
+
project_key = params[:project_key]
|
15
|
+
transition_id = params[:transition_id]
|
16
|
+
comment_text = params[:comment]
|
17
|
+
|
18
|
+
options = {
|
19
|
+
site: site,
|
20
|
+
context_path: context_path,
|
21
|
+
auth_type: auth_type,
|
22
|
+
username: username,
|
23
|
+
password: password
|
24
|
+
}
|
25
|
+
|
26
|
+
client = JIRA::Client.new(options)
|
27
|
+
|
28
|
+
if Actions.lane_context[SharedValues::FL_CHANGELOG].nil?
|
29
|
+
changelog_configuration = FastlaneCore::Configuration.create(Actions::ChangelogFromGitCommitsAction.available_options, {})
|
30
|
+
Actions::ChangelogFromGitCommitsAction.run(changelog_configuration)
|
31
|
+
end
|
32
|
+
|
33
|
+
issue_ids = Actions.lane_context[SharedValues::FL_CHANGELOG].scan(/#{project_key}-\d+/i).uniq
|
34
|
+
|
35
|
+
issue_ids.each do |issue_id|
|
36
|
+
begin
|
37
|
+
issue = client.Issue.find(issue_id)
|
38
|
+
transition = issue.transitions.build
|
39
|
+
transition.save!("transition" => { "id" => transition_id })
|
40
|
+
|
41
|
+
if comment_text
|
42
|
+
comment = issue.comments.build
|
43
|
+
comment.save({"body" => comment_text})
|
44
|
+
end
|
45
|
+
rescue JIRA::HTTPError
|
46
|
+
"Skipping issue #{issue_id}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
#####################################################
|
52
|
+
# @!group Documentation
|
53
|
+
#####################################################
|
54
|
+
|
55
|
+
def self.description
|
56
|
+
"Apply a JIRA transition to issues mentioned in the changelog"
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.available_options
|
60
|
+
[
|
61
|
+
FastlaneCore::ConfigItem.new(key: :url,
|
62
|
+
env_name: "FL_JIRA_SITE",
|
63
|
+
description: "URL for Jira instance",
|
64
|
+
verify_block: proc do |value|
|
65
|
+
UI.user_error!("No url for Jira given, pass using `url: 'url'`") if value.to_s.length == 0
|
66
|
+
end),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
68
|
+
env_name: "FL_JIRA_USERNAME",
|
69
|
+
description: "Username for JIRA instance",
|
70
|
+
verify_block: proc do |value|
|
71
|
+
UI.user_error!("No username") if value.to_s.length == 0
|
72
|
+
end),
|
73
|
+
FastlaneCore::ConfigItem.new(key: :password,
|
74
|
+
env_name: "FL_JIRA_PASSWORD",
|
75
|
+
description: "Password for Jira",
|
76
|
+
verify_block: proc do |value|
|
77
|
+
UI.user_error!("No password") if value.to_s.length == 0
|
78
|
+
end),
|
79
|
+
FastlaneCore::ConfigItem.new(key: :project_key,
|
80
|
+
env_name: "FL_JIRA_TRANSITION_PROJECT_KEY",
|
81
|
+
description: "Project Key for Jira, i.e. IOS",
|
82
|
+
verify_block: proc do |value|
|
83
|
+
UI.user_error!("No Project Key specified") if value.to_s.length == 0
|
84
|
+
end),
|
85
|
+
FastlaneCore::ConfigItem.new(key: :transition_id,
|
86
|
+
env_name: "FL_JIRA_TRANSITION_TRANSITION_ID",
|
87
|
+
description: "Transition to apply to the tickets referenced in the changelog",
|
88
|
+
verify_block: proc do |value|
|
89
|
+
UI.user_error!("No transition id specified") if value.to_s.length == 0
|
90
|
+
end),
|
91
|
+
FastlaneCore::ConfigItem.new(key: :comment,
|
92
|
+
env_name: "FL_JIRA_TRANSITION_COMMENT",
|
93
|
+
description: "Comment to add if the transition is applied",
|
94
|
+
optional: true,
|
95
|
+
verify_block: proc do |value|
|
96
|
+
UI.user_error!("No transition id specified") if value.to_s.length == 0
|
97
|
+
end)
|
98
|
+
]
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.output
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.return_value
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.authors
|
108
|
+
["Valerio Mazzeo", "Tiziano Bruni"]
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.is_supported?(platform)
|
112
|
+
true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class JiraTransitionHelper
|
4
|
+
# class methods that you define here become available in your action
|
5
|
+
# as `Helper::JiraTransitionHelper.your_method`
|
6
|
+
#
|
7
|
+
def self.show_message
|
8
|
+
UI.message("Hello from the jira_transition plugin helper!")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-jira_transition
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Valerio Mazzeo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
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: rspec
|
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: fastlane
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.93.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.93.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jira-ruby
|
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
|
+
description:
|
84
|
+
email: valerio.mazzeo@gmail.com
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- lib/fastlane/plugin/jira_transition/actions/jira_transition_action.rb
|
90
|
+
- lib/fastlane/plugin/jira_transition/helper/jira_transition_helper.rb
|
91
|
+
- lib/fastlane/plugin/jira_transition/version.rb
|
92
|
+
- lib/fastlane/plugin/jira_transition.rb
|
93
|
+
- README.md
|
94
|
+
- LICENSE
|
95
|
+
homepage: https://github.com/valeriomazzeo/fastlane-plugin-jira_transition
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.0.14.1
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Apply a JIRA transition to issues mentioned in the changelog
|
119
|
+
test_files: []
|