danger-jira_issue_links 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93803130e3265ec1afef81b2b532b27daf7c01af
4
+ data.tar.gz: a273d1486a3691c7a5403b15160bf6273df1f8d8
5
+ SHA512:
6
+ metadata.gz: b9e0b277eafe72e3eb78f52bdb2726062b4391574b9dd62ad8705c606693bfe46608d94ecc82bea031dde47e8d33f59bf4eeec490769fb0b2f652d1221b41fb4
7
+ data.tar.gz: cd7da04ee9639e99994bc5ee2b263a6fd32d616742d941f98c773100650f42c696fa15a407772bd51719b04f185aacbca26e13e6da2dc98776a5457102e660f4
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ .yardoc
data/.rubocop.yml ADDED
@@ -0,0 +1,152 @@
1
+ # Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+
3
+ # If you don't like these settings, just delete this file :)
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.0
7
+
8
+ Style/StringLiterals:
9
+ EnforcedStyle: double_quotes
10
+ Enabled: true
11
+
12
+ # kind_of? is a good way to check a type
13
+ Style/ClassCheck:
14
+ EnforcedStyle: kind_of?
15
+
16
+ # It's better to be more explicit about the type
17
+ Style/BracesAroundHashParameters:
18
+ Enabled: false
19
+
20
+ # specs sometimes have useless assignments, which is fine
21
+ Lint/UselessAssignment:
22
+ Exclude:
23
+ - '**/spec/**/*'
24
+
25
+ # We could potentially enable the 2 below:
26
+ Layout/IndentHash:
27
+ Enabled: false
28
+
29
+ Layout/AlignHash:
30
+ Enabled: false
31
+
32
+ # HoundCI doesn't like this rule
33
+ Layout/DotPosition:
34
+ Enabled: false
35
+
36
+ # We allow !! as it's an easy way to convert ot boolean
37
+ Style/DoubleNegation:
38
+ Enabled: false
39
+
40
+ # Cop supports --auto-correct.
41
+ Lint/UnusedBlockArgument:
42
+ Enabled: false
43
+
44
+ # We want to allow class Fastlane::Class
45
+ Style/ClassAndModuleChildren:
46
+ Enabled: false
47
+
48
+ Metrics/AbcSize:
49
+ Max: 60
50
+
51
+ # The %w might be confusing for new users
52
+ Style/WordArray:
53
+ MinSize: 19
54
+
55
+ # raise and fail are both okay
56
+ Style/SignalException:
57
+ Enabled: false
58
+
59
+ # Better too much 'return' than one missing
60
+ Style/RedundantReturn:
61
+ Enabled: false
62
+
63
+ # Having if in the same line might not always be good
64
+ Style/IfUnlessModifier:
65
+ Enabled: false
66
+
67
+ # and and or is okay
68
+ Style/AndOr:
69
+ Enabled: false
70
+
71
+ # Configuration parameters: CountComments.
72
+ Metrics/ClassLength:
73
+ Max: 350
74
+
75
+ Metrics/CyclomaticComplexity:
76
+ Max: 17
77
+
78
+ # Configuration parameters: AllowURI, URISchemes.
79
+ Metrics/LineLength:
80
+ Max: 370
81
+
82
+ # Configuration parameters: CountKeywordArgs.
83
+ Metrics/ParameterLists:
84
+ Max: 10
85
+
86
+ Metrics/PerceivedComplexity:
87
+ Max: 18
88
+
89
+ # Sometimes it's easier to read without guards
90
+ Style/GuardClause:
91
+ Enabled: false
92
+
93
+ # something = if something_else
94
+ # that's confusing
95
+ Style/ConditionalAssignment:
96
+ Enabled: false
97
+
98
+ # Better to have too much self than missing a self
99
+ Style/RedundantSelf:
100
+ Enabled: false
101
+
102
+ Metrics/MethodLength:
103
+ Max: 60
104
+
105
+ # We're not there yet
106
+ Style/Documentation:
107
+ Enabled: false
108
+
109
+ # Adds complexity
110
+ Style/IfInsideElse:
111
+ Enabled: false
112
+
113
+ # danger specific
114
+
115
+ Style/BlockComments:
116
+ Enabled: false
117
+
118
+ Layout/MultilineMethodCallIndentation:
119
+ EnforcedStyle: indented
120
+
121
+ # FIXME: 25
122
+ Metrics/BlockLength:
123
+ Max: 345
124
+ Exclude:
125
+ - "**/*_spec.rb"
126
+
127
+ Style/MixinGrouping:
128
+ Enabled: false
129
+
130
+ Style/FileName:
131
+ Enabled: false
132
+
133
+ Layout/IndentHeredoc:
134
+ Enabled: false
135
+
136
+ Style/SpecialGlobalVars:
137
+ Enabled: false
138
+
139
+ PercentLiteralDelimiters:
140
+ PreferredDelimiters:
141
+ "%": ()
142
+ "%i": ()
143
+ "%q": ()
144
+ "%Q": ()
145
+ "%r": "{}"
146
+ "%s": ()
147
+ "%w": ()
148
+ "%W": ()
149
+ "%x": ()
150
+
151
+ Security/YAMLLoad:
152
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache:
3
+ directories:
4
+ - bundle
5
+
6
+ rvm:
7
+ - 2.0
8
+ - 2.1.3
9
+ - 2.3.1
10
+
11
+ script:
12
+ - bundle exec rake spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in danger-jira_issue_links.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,157 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-jira_issue_links (0.1.0)
5
+ danger-plugin-api (~> 1.0)
6
+ jira-ruby (~> 1.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.2.3)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 0.7, < 2)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ addressable (2.5.2)
17
+ public_suffix (>= 2.0.2, < 4.0)
18
+ ast (2.4.0)
19
+ claide (1.0.2)
20
+ claide-plugins (0.9.2)
21
+ cork
22
+ nap
23
+ open4 (~> 1.3)
24
+ coderay (1.1.2)
25
+ colored2 (3.1.2)
26
+ concurrent-ruby (1.1.5)
27
+ cork (0.3.0)
28
+ colored2 (~> 3.1)
29
+ danger (6.0.6)
30
+ claide (~> 1.0)
31
+ claide-plugins (>= 0.9.2)
32
+ colored2 (~> 3.1)
33
+ cork (~> 0.1)
34
+ faraday (~> 0.9)
35
+ faraday-http-cache (~> 1.0)
36
+ git (~> 1.5)
37
+ kramdown (~> 2.0)
38
+ kramdown-parser-gfm (~> 1.0)
39
+ no_proxy_fix
40
+ octokit (~> 4.7)
41
+ terminal-table (~> 1)
42
+ danger-plugin-api (1.0.0)
43
+ danger (> 2.0)
44
+ diff-lcs (1.3)
45
+ faraday (0.15.4)
46
+ multipart-post (>= 1.2, < 3)
47
+ faraday-http-cache (1.3.1)
48
+ faraday (~> 0.8)
49
+ ffi (1.10.0)
50
+ formatador (0.2.5)
51
+ git (1.5.0)
52
+ guard (2.15.0)
53
+ formatador (>= 0.2.4)
54
+ listen (>= 2.7, < 4.0)
55
+ lumberjack (>= 1.0.12, < 2.0)
56
+ nenv (~> 0.1)
57
+ notiffany (~> 0.0)
58
+ pry (>= 0.9.12)
59
+ shellany (~> 0.0)
60
+ thor (>= 0.18.1)
61
+ guard-compat (1.2.1)
62
+ guard-rspec (4.7.3)
63
+ guard (~> 2.1)
64
+ guard-compat (~> 1.1)
65
+ rspec (>= 2.99.0, < 4.0)
66
+ i18n (1.6.0)
67
+ concurrent-ruby (~> 1.0)
68
+ jaro_winkler (1.5.2)
69
+ jira-ruby (1.6.0)
70
+ activesupport
71
+ multipart-post
72
+ oauth (~> 0.5, >= 0.5.0)
73
+ kramdown (2.1.0)
74
+ kramdown-parser-gfm (1.0.1)
75
+ kramdown (~> 2.0)
76
+ listen (3.0.7)
77
+ rb-fsevent (>= 0.9.3)
78
+ rb-inotify (>= 0.9.7)
79
+ lumberjack (1.0.13)
80
+ method_source (0.9.2)
81
+ minitest (5.11.3)
82
+ multipart-post (2.0.0)
83
+ nap (1.1.0)
84
+ nenv (0.3.0)
85
+ no_proxy_fix (0.1.2)
86
+ notiffany (0.1.1)
87
+ nenv (~> 0.1)
88
+ shellany (~> 0.0)
89
+ oauth (0.5.4)
90
+ octokit (4.14.0)
91
+ sawyer (~> 0.8.0, >= 0.5.3)
92
+ open4 (1.3.4)
93
+ parallel (1.17.0)
94
+ parser (2.6.2.1)
95
+ ast (~> 2.4.0)
96
+ pry (0.12.2)
97
+ coderay (~> 1.1.0)
98
+ method_source (~> 0.9.0)
99
+ psych (3.1.0)
100
+ public_suffix (3.0.3)
101
+ rainbow (3.0.0)
102
+ rake (10.5.0)
103
+ rb-fsevent (0.10.3)
104
+ rb-inotify (0.10.0)
105
+ ffi (~> 1.0)
106
+ rspec (3.8.0)
107
+ rspec-core (~> 3.8.0)
108
+ rspec-expectations (~> 3.8.0)
109
+ rspec-mocks (~> 3.8.0)
110
+ rspec-core (3.8.0)
111
+ rspec-support (~> 3.8.0)
112
+ rspec-expectations (3.8.3)
113
+ diff-lcs (>= 1.2.0, < 2.0)
114
+ rspec-support (~> 3.8.0)
115
+ rspec-mocks (3.8.0)
116
+ diff-lcs (>= 1.2.0, < 2.0)
117
+ rspec-support (~> 3.8.0)
118
+ rspec-support (3.8.0)
119
+ rubocop (0.67.2)
120
+ jaro_winkler (~> 1.5.1)
121
+ parallel (~> 1.10)
122
+ parser (>= 2.5, != 2.5.1.1)
123
+ psych (>= 3.1.0)
124
+ rainbow (>= 2.2.2, < 4.0)
125
+ ruby-progressbar (~> 1.7)
126
+ unicode-display_width (>= 1.4.0, < 1.6)
127
+ ruby-progressbar (1.10.0)
128
+ sawyer (0.8.1)
129
+ addressable (>= 2.3.5, < 2.6)
130
+ faraday (~> 0.8, < 1.0)
131
+ shellany (0.0.1)
132
+ terminal-table (1.8.0)
133
+ unicode-display_width (~> 1.1, >= 1.1.1)
134
+ thor (0.20.3)
135
+ thread_safe (0.3.6)
136
+ tzinfo (1.2.5)
137
+ thread_safe (~> 0.1)
138
+ unicode-display_width (1.5.0)
139
+ yard (0.9.19)
140
+
141
+ PLATFORMS
142
+ ruby
143
+
144
+ DEPENDENCIES
145
+ bundler (~> 2.0)
146
+ danger-jira_issue_links!
147
+ guard (~> 2.14)
148
+ guard-rspec (~> 4.7)
149
+ listen (= 3.0.7)
150
+ pry
151
+ rake (~> 10.0)
152
+ rspec (~> 3.4)
153
+ rubocop
154
+ yard
155
+
156
+ BUNDLED WITH
157
+ 2.0.1
data/Guardfile ADDED
@@ -0,0 +1,19 @@
1
+ # A guardfile for making Danger Plugins
2
+ # For more info see https://github.com/guard/guard#readme
3
+
4
+ # To run, use `bundle exec guard`.
5
+
6
+ guard :rspec, cmd: 'bundle exec rspec' do
7
+ require 'guard/rspec/dsl'
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2019 Anton Glezman <a.glezman@redmadrobot.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # danger-jira_issue_links
2
+
3
+ Collect issue mentions from git commit messages and obtain info from Jira issue tracker.<br>
4
+ Commit message should starts with pattern `[TASK-123]`, where TASK is id of jira project, 123 is issue number. For example commit message:
5
+ ```
6
+ [JSGLK-1145] Resolve bug with incorrect price calculation
7
+ ```
8
+ Results are passed out as a table in the Danger comment for merge request.
9
+
10
+ ![Screenshot](resources/danger-screenshot.png)
11
+
12
+
13
+ ## Installation
14
+
15
+ $ gem install danger-jira_issue_links
16
+
17
+ ## Usage
18
+
19
+ Configure connection to you Jira instance
20
+
21
+ ```
22
+ jira_issue_links.jira_username = "email"
23
+ jira_issue_links.jira_password = "password"
24
+ jira_issue_links.jira_site = "https://your-company.atlassian.net"
25
+ ```
26
+
27
+ Find all issue mentions in commit messages, obtain info from Jira and make table of links
28
+ ```
29
+ jira_issue_links.print_links_with_titles
30
+ ```
31
+
32
+ Find all issue mentions in commit messages and make links. <br>
33
+ No required access to Jira, needs only base url - `jira_site`.
34
+ ```
35
+ jira_issue_links.print_links_only
36
+ ```
37
+
38
+
39
+ ## Development
40
+
41
+ 1. Clone this repo
42
+ 2. Run `bundle install` to setup dependencies.
43
+ 3. Run `bundle exec rake spec` to run the tests.
44
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
45
+ 5. Make your changes.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:specs)
6
+
7
+ task default: :specs
8
+
9
+ task :spec do
10
+ Rake::Task['specs'].invoke
11
+ Rake::Task['rubocop'].invoke
12
+ Rake::Task['spec_docs'].invoke
13
+ end
14
+
15
+ desc 'Run RuboCop on the lib/specs directory'
16
+ RuboCop::RakeTask.new(:rubocop) do |task|
17
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
18
+ end
19
+
20
+ desc 'Ensure that the plugin passes `danger plugins lint`'
21
+ task :spec_docs do
22
+ sh 'bundle exec danger plugins lint'
23
+ end
@@ -0,0 +1,52 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jira_issue_links/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'danger-jira_issue_links'
8
+ spec.version = JiraIssueLinks::VERSION
9
+ spec.authors = ['Anton Glezman']
10
+ spec.email = ['a.glezman@redmadrobot.com']
11
+ spec.description = %q{Collect issue mentions from git commit messages.}
12
+ spec.summary = %q{Collect issue mentions from git commit messages and obtain info from Jira issue tracker.
13
+ Commit message should starts with pattern `[TASK-123]`.
14
+ Results are passed out as a table in markdown.}
15
+ spec.homepage = 'https://github.com/RedMadRobot/danger-jira_issue_links'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
24
+ spec.add_runtime_dependency 'jira-ruby', '~> 1.1'
25
+
26
+ # General ruby development
27
+ spec.add_development_dependency 'bundler', '~> 2.0'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+
30
+ # Testing support
31
+ spec.add_development_dependency 'rspec', '~> 3.4'
32
+
33
+ # Linting code and docs
34
+ spec.add_development_dependency "rubocop"
35
+ spec.add_development_dependency "yard"
36
+
37
+ # Makes testing easy via `bundle exec guard`
38
+ spec.add_development_dependency 'guard', '~> 2.14'
39
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
40
+
41
+ # If you want to work on older builds of ruby
42
+ spec.add_development_dependency 'listen', '3.0.7'
43
+
44
+ # This gives you the chance to run a REPL inside your tests
45
+ # via:
46
+ #
47
+ # require 'pry'
48
+ # binding.pry
49
+ #
50
+ # This will stop test execution and let you inspect the results
51
+ spec.add_development_dependency 'pry'
52
+ end
@@ -0,0 +1 @@
1
+ require "jira_issue_links/gem_version"
@@ -0,0 +1 @@
1
+ require "jira_issue_links/plugin"
@@ -0,0 +1,3 @@
1
+ module JiraIssueLinks
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,110 @@
1
+ require 'jira-ruby'
2
+
3
+ module Danger
4
+
5
+ # Collect issue mentions from git commit messages.
6
+ # Results are passed out as a table in markdown.
7
+ #
8
+ # @example Find issues, obtain types and titles from Jira, and make links to site.
9
+ #
10
+ # jira_issue_links.print_links_with_titles
11
+ #
12
+ # @example Find issues and make links to Jira site.
13
+ #
14
+ # jira_issue_links.print_links_only
15
+ #
16
+ # @see https://github.com/RedMadRobot/danger-jira_issue_links
17
+ # @tags jira, issue, task
18
+ #
19
+ class DangerJiraIssueLinks < Plugin
20
+
21
+ # Jira username
22
+ #
23
+ # @return [String]
24
+ attr_accessor :jira_username
25
+
26
+ # Jira password
27
+ #
28
+ # @return [String]
29
+ attr_accessor :jira_password
30
+
31
+ # Jira site url
32
+ #
33
+ # @return [String]
34
+ attr_accessor :jira_site
35
+
36
+ # Jira context path
37
+ # Default - empty string
38
+ #
39
+ # @return [String]
40
+ attr_accessor :jira_context_path
41
+
42
+
43
+ # Find all issue references in commit messages.
44
+ # Message should starts with pattern: `[TASK-123]`
45
+ # @return [Array<String>]
46
+ def collect_issues_from_commits
47
+ all_issues = []
48
+ git.commits.each do |c|
49
+ captures = c.message.match(/^\[(\w+-\d+)\]*./)&.captures
50
+ if captures
51
+ all_issues.push(captures[0])
52
+ end
53
+ end
54
+ all_issues.uniq
55
+ end
56
+
57
+ # Generates a `markdown` table of issues with type, title and link.
58
+ # Required access to Jira site.
59
+ #
60
+ # @return [void]
61
+ def print_links_with_titles
62
+ found_issues = collect_issues_from_commits
63
+ return if found_issues.empty?
64
+
65
+ jira_context_path = '' if jira_context_path.nil?
66
+ client = JIRA::Client.new(
67
+ username: jira_username,
68
+ password: jira_password,
69
+ site: jira_site,
70
+ context_path: jira_context_path,
71
+ auth_type: :basic
72
+ )
73
+
74
+ message = "### Jira issues\n\n"
75
+ message << "| | |\n"
76
+ message << "| --- | ----- |\n"
77
+
78
+ begin
79
+ found_issues.each do |issue_id|
80
+ issue = client.Issue.jql("ID = '#{issue_id}'").first
81
+ return if issue.nil?
82
+ message << "![#{issue.issuetype.name}](#{issue.issuetype.iconUrl}) | "
83
+ message << "[#{issue.summary}](#{jira_site}/browse/#{issue_id})\n"
84
+ end
85
+ rescue JIRA::HTTPError => e
86
+ print e.message
87
+ end
88
+
89
+ markdown message
90
+ end
91
+
92
+
93
+ # Generates a `markdown` list of issues with links
94
+ # No required access to Jira, needs only base url - `jira_site`.
95
+ #
96
+ # @return [void]
97
+ def print_links_only
98
+ found_issues = collect_issues_from_commits
99
+ return if found_issues.empty?
100
+
101
+ message = "### Jira issues\n\n"
102
+ found_issues.each do |issue_id|
103
+ message << "[#{issue_id}](#{jira_site}/browse/#{issue_id})\n\n"
104
+ end
105
+
106
+ markdown message
107
+ end
108
+
109
+ end
110
+ end
Binary file
@@ -0,0 +1,24 @@
1
+ require File.expand_path("../spec_helper", __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerJiraIssueLinks do
5
+ it "should be a plugin" do
6
+ expect(Danger::DangerJiraIssueLinks.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe "with Dangerfile" do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @my_plugin = @dangerfile.jira_issue_links
13
+ end
14
+
15
+ it "some" do
16
+ @my_plugin.print_links_only
17
+
18
+ expect(@dangerfile.status_report[:warnings]).to eq([])
19
+ end
20
+
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,62 @@
1
+ require "pathname"
2
+ ROOT = Pathname.new(File.expand_path("../../", __FILE__))
3
+ $:.unshift((ROOT + "lib").to_s)
4
+ $:.unshift((ROOT + "spec").to_s)
5
+
6
+ require "bundler/setup"
7
+ require "pry"
8
+
9
+ require "rspec"
10
+ require "danger"
11
+
12
+ if `git remote -v` == ''
13
+ puts "You cannot run tests without setting a local git remote on this repo"
14
+ puts "It's a weird side-effect of Danger's internals."
15
+ exit(0)
16
+ end
17
+
18
+ # Use coloured output, it's the best.
19
+ RSpec.configure do |config|
20
+ config.filter_gems_from_backtrace "bundler"
21
+ config.color = true
22
+ config.tty = true
23
+ end
24
+
25
+ require "danger_plugin"
26
+
27
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
28
+ # If you are expanding these files, see if it's already been done ^.
29
+
30
+ # A silent version of the user interface,
31
+ # it comes with an extra function `.string` which will
32
+ # strip all ANSI colours from the string.
33
+
34
+ # rubocop:disable Lint/NestedMethodDefinition
35
+ def testing_ui
36
+ @output = StringIO.new
37
+ def @output.winsize
38
+ [20, 9999]
39
+ end
40
+
41
+ cork = Cork::Board.new(out: @output)
42
+ def cork.string
43
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
44
+ end
45
+ cork
46
+ end
47
+ # rubocop:enable Lint/NestedMethodDefinition
48
+
49
+ # Example environment (ENV)
50
+ def testing_env
51
+ {
52
+ "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
53
+ "DANGER_LOCAL_ONLY" => "true",
54
+ "FL_JIRA_SITE" => "https://redmadrobot.atlassian.net"
55
+ }
56
+ end
57
+
58
+ # A stubbed out Dangerfile for use in tests
59
+ def testing_dangerfile
60
+ env = Danger::EnvironmentManager.new(testing_env)
61
+ Danger::Dangerfile.new(env, testing_ui)
62
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-jira_issue_links
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anton Glezman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: danger-plugin-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '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.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jira-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
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: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.14'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.14'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: listen
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 3.0.7
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.7
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Collect issue mentions from git commit messages.
168
+ email:
169
+ - a.glezman@redmadrobot.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".rubocop.yml"
176
+ - ".travis.yml"
177
+ - Gemfile
178
+ - Gemfile.lock
179
+ - Guardfile
180
+ - LICENSE.txt
181
+ - README.md
182
+ - Rakefile
183
+ - danger-jira_issue_links.gemspec
184
+ - lib/danger_jira_issue_links.rb
185
+ - lib/danger_plugin.rb
186
+ - lib/jira_issue_links/gem_version.rb
187
+ - lib/jira_issue_links/plugin.rb
188
+ - resources/danger-screenshot.png
189
+ - spec/jira_issue_links_spec.rb
190
+ - spec/spec_helper.rb
191
+ homepage: https://github.com/RedMadRobot/danger-jira_issue_links
192
+ licenses:
193
+ - MIT
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.6.14
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: Collect issue mentions from git commit messages and obtain info from Jira
215
+ issue tracker. Commit message should starts with pattern `[TASK-123]`. Results
216
+ are passed out as a table in markdown.
217
+ test_files:
218
+ - spec/jira_issue_links_spec.rb
219
+ - spec/spec_helper.rb