danger-yajp 0.1.1 → 0.1.2

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: 28f5c1b87c4924673bd6bfe7d00ec01bf94b4ea9520b43fd3002eb5944141e7c
4
- data.tar.gz: a13caf1147682bdd71e048c848be6cb53cc7a5f5cd489310883d0ab797d76913
3
+ metadata.gz: 1f67dc7849b79110482c02fa779ac8e3622a7e9c82d7ff1ae84fb1a898bcb022
4
+ data.tar.gz: f9faa4baac94dd08416a34c783708334a502e15e48a5cff6fc3db98a35131bfd
5
5
  SHA512:
6
- metadata.gz: 2007d092a1f920d1ca505de0695b26680629dbc082314e9ba9531894df830822383a372d3bd3b606917242ff30f161bb7d83164feaef43f6d01784908738eaf6
7
- data.tar.gz: 4b37f4e6098bb8bb594da8bcf3f433500cf53107fc510169ec75760b7fb0c3137e0150fb8f64f2f53880cf0db55c618602db2e038edd22fa1c2292c0bae12452
6
+ metadata.gz: f580d3fc39375dfd017c6824b6900c667abd73304346f86bfc4f8b43c841b23a0c2a12806c621b0ad54b9a925f73b66223202117851e7f9cfdaee578e13b327e
7
+ data.tar.gz: 12cf1174e25d554a0058aecf3261c2c87104d0f30fb351f38ea902519a34aa9f8d920320db9500fb1bafdc231c126754628efbe568262b2edc77eefee4532d81
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-yajp (0.1.1)
4
+ danger-yajp (0.1.2)
5
5
  danger-plugin-api
6
6
  jira-ruby
7
7
 
@@ -30,7 +30,7 @@ GEM
30
30
  cork (0.3.0)
31
31
  colored2 (~> 3.1)
32
32
  crack (0.4.4)
33
- danger (8.2.0)
33
+ danger (8.2.1)
34
34
  claide (~> 1.0)
35
35
  claide-plugins (>= 0.9.2)
36
36
  colored2 (~> 3.1)
@@ -82,7 +82,7 @@ GEM
82
82
  rexml
83
83
  kramdown-parser-gfm (1.1.0)
84
84
  kramdown (~> 2.0)
85
- listen (3.2.1)
85
+ listen (3.3.0)
86
86
  rb-fsevent (~> 0.10, >= 0.10.3)
87
87
  rb-inotify (~> 0.9, >= 0.9.10)
88
88
  lumberjack (1.2.8)
@@ -100,7 +100,7 @@ GEM
100
100
  faraday (>= 0.9)
101
101
  sawyer (~> 0.8.0, >= 0.5.3)
102
102
  open4 (1.3.4)
103
- parallel (1.19.2)
103
+ parallel (1.20.0)
104
104
  parser (2.7.2.0)
105
105
  ast (~> 2.4.1)
106
106
  pry (0.13.1)
@@ -128,13 +128,13 @@ GEM
128
128
  diff-lcs (>= 1.2.0, < 2.0)
129
129
  rspec-support (~> 3.10.0)
130
130
  rspec-support (3.10.0)
131
- rubocop (1.2.0)
131
+ rubocop (1.3.0)
132
132
  parallel (~> 1.10)
133
133
  parser (>= 2.7.1.5)
134
134
  rainbow (>= 2.2.2, < 4.0)
135
135
  regexp_parser (>= 1.8)
136
136
  rexml
137
- rubocop-ast (>= 1.0.1)
137
+ rubocop-ast (>= 1.1.1)
138
138
  ruby-progressbar (~> 1.7)
139
139
  unicode-display_width (>= 1.4.0, < 2.0)
140
140
  rubocop-ast (1.1.1)
@@ -149,10 +149,10 @@ GEM
149
149
  unicode-display_width (~> 1.1, >= 1.1.1)
150
150
  thor (1.0.1)
151
151
  thread_safe (0.3.6)
152
- tzinfo (1.2.7)
152
+ tzinfo (1.2.8)
153
153
  thread_safe (~> 0.1)
154
154
  unicode-display_width (1.7.0)
155
- webmock (3.9.4)
155
+ webmock (3.10.0)
156
156
  addressable (>= 2.3.6)
157
157
  crack (>= 0.3.2)
158
158
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -18,12 +18,12 @@ gem 'danger-yajp'
18
18
 
19
19
  ## Usage
20
20
 
21
- You first need to define the environment variables `DANGER_JIRA_URL`, `DANGER_JIRA_USER` and `DANGER_JIRA_PASSWORD` in your CI environment, for example:
21
+ You first need to define the environment variables `DANGER_JIRA_URL`, `DANGER_JIRA_USER` and `DANGER_JIRA_API_TOKEN` in your CI environment, for example:
22
22
 
23
23
  ```
24
24
  DANGER_JIRA_URL: https://jira.company.com/jira
25
25
  DANGER_JIRA_USER: username
26
- DANGER_JIRA_PASSWORD: abcd12345
26
+ DANGER_JIRA_API_TOKEN: abcd12345
27
27
  ```
28
28
 
29
29
  ### Find issues
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yajp
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'jira-ruby'
4
- require 'json'
5
4
 
6
5
  module Danger
7
6
  # Yet Another Jira Plugin (in short: yajp) provides methods to easily find and manipulate issues from within the Dangerfile.
@@ -85,7 +84,7 @@ module Danger
85
84
  jira_issues.concat(search_branch(regexp)) if search_branch
86
85
  jira_issues.concat(search_pr_body(regexp)) if jira_issues.empty?
87
86
 
88
- jira_issues.uniq.map { |issue_key| @api.Issue.find(issue_key) }
87
+ jira_issues.uniq(&:downcase).map { |issue_key| @api.Issue.find(issue_key) }
89
88
  end
90
89
 
91
90
  # Transition the given Jira issue(s) using the ID of the transition. Transition IDs can be found in Jira under Project Workflow > Edit Workflow in Text Mode.
@@ -247,7 +246,7 @@ module Danger
247
246
 
248
247
  def build_regexp_from_key(key)
249
248
  keys = key.kind_of?(Array) ? key.join('|') : key
250
- return /((?:#{keys})-[0-9]+)/
249
+ return /((?:#{keys})-[0-9]+)/i
251
250
  end
252
251
 
253
252
  def search_title(regexp)
@@ -47,9 +47,9 @@ module Danger
47
47
  end
48
48
 
49
49
  it 'can find jira issues via branch name' do
50
- allow(plugin).to receive_message_chain('github.branch_for_head').and_return('bugfix/WEB-126')
50
+ allow(plugin).to receive_message_chain('github.branch_for_head').and_return('bugfix/web-126')
51
51
  issues = plugin.search_branch(plugin.build_regexp_from_key('WEB'))
52
- expect(issues).to eq(['WEB-126'])
52
+ expect(issues).to eq(['web-126'])
53
53
  end
54
54
 
55
55
  it 'can find jira issues in pr body' do
@@ -62,13 +62,14 @@ module Danger
62
62
  issue = Object.new
63
63
 
64
64
  def issue.find(key)
65
- return key
65
+ # The find method in jira-ruby plugin is not case sensitive, hence the upcase.
66
+ return key.upcase
66
67
  end
67
68
 
68
69
  allow_any_instance_of(JIRA::Client).to receive(:Issue).and_return(issue)
69
70
 
70
71
  allow(plugin).to receive_message_chain('github.pr_title').and_return('Fix for WEB-128 and WEB-129')
71
- allow(plugin).to receive_message_chain('github.branch_for_head').and_return('bugfix/WEB-128')
72
+ allow(plugin).to receive_message_chain('github.branch_for_head').and_return('bugfix/web-128')
72
73
  issues = plugin.find_issues('WEB', search_branch: true)
73
74
  expect(issues).to eq(['WEB-128', 'WEB-129'])
74
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-yajp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliendms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-06 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger-plugin-api