lita-github 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: a74bbd8ca959d937503c0d0f676aafa83d8f4fe8
4
- data.tar.gz: 8df94bb7c74863c82c66b436c60350f1d25b9a86
3
+ metadata.gz: ece12c721d1b5311529352629acae15998e6d487
4
+ data.tar.gz: 32877ccdac63d11a2ce09a1afe9368ad6a3000a4
5
5
  SHA512:
6
- metadata.gz: 4db4682a4c9fd305c4685887d1241476270bbad98df0a5c381dd3e8c1562cfa8699c5767396fd5fa1ebda1a0a20e3c853bb99eca8f7adfbad5a62ee2cf5ec6e0
7
- data.tar.gz: 8125f027de492262b1a5068afcc39471cd001478e0bfe6a4afee4157b22fadb60f6bd40f9155838ad338605b028d219bde80c7f2ea74d1d26482a1cf00e4134e
6
+ metadata.gz: d1baca6ba8a93e75740a0923e2e80947c01c175ca49acff466475247dae4d11357e4f2a21eab3cc24492b823ff394265a8de33e09aeaebe038c9d9de50ea2b4a
7
+ data.tar.gz: 5c1a9c8fa5d8edfe12c17f082211e7de4db1a36705fad6a0247c3807d586aa549ab3eb027385ac15ebe6617a59643ac795a9194c4d512de0c6034f6c287a363b
data/README.md CHANGED
@@ -59,9 +59,9 @@ Here is the current functionality:
59
59
  * **Note:** This method is disabled by default, you need to enable it by setting `config.handlers.github.repo_delete_enabled = true` in your configuration file
60
60
 
61
61
  ### Github PR Handler
62
- * `!gh pr info #42 PagerDuty/lita-github`
62
+ * `!gh pr info PagerDuty/lita-github #42`
63
63
  * output some information about the PR. Such as: state (open|closed|merged), build status, user who opened, user who merged, amongst others...
64
- * `!gh pr merge #42 PagerDuty/lita-github` or `!shipit #42 PagerDuty/lita-github`
64
+ * `!gh pr merge PagerDuty/lita-github #42` or `!shipit PagerDuty/lita-github #42`
65
65
  * This merges the specified pull request
66
66
  * This method can be disabled by setting `config.handlers.github.pr_merge_enabled = false` in your configuration file
67
67
  * `!gh pr list PagerDuty/lita-github`
@@ -16,6 +16,6 @@
16
16
 
17
17
  # Administer your Hub of Gits with Lita!
18
18
  module LitaGithub
19
- VERSION = '0.0.7'
19
+ VERSION = '0.0.8'
20
20
  MAJ, MIN, REV = VERSION.split('.').map(&:to_i)
21
21
  end
@@ -36,19 +36,19 @@ module Lita
36
36
  on :loaded, :setup_octo # from LitaGithub::Octo
37
37
 
38
38
  route(
39
- /#{LitaGithub::R::A_REG}pr\s+?info\s+?#(?<pr>\d+?)\s+?#{LitaGithub::R::REPO_REGEX}/,
39
+ /#{LitaGithub::R::A_REG}pr\s+?info\s+?#{LitaGithub::R::REPO_REGEX}\s+?#(?<pr>\d+?)$/,
40
40
  :pr_info,
41
41
  command: true,
42
- help: { 'gh pr info #42 PagerDuty/lita-github' => 'show some information about the pull request' }
42
+ help: { 'gh pr info PagerDuty/lita-github #42' => 'show some information about the pull request' }
43
43
  )
44
44
 
45
45
  route(
46
- /(?:#{LitaGithub::R::A_REG}(?:pr merge|shipit)|shipit)\s+?#(?<pr>\d+?)\s+?#{LitaGithub::R::REPO_REGEX}/,
46
+ /(?:#{LitaGithub::R::A_REG}(?:pr merge|shipit)|shipit)\s+?#{LitaGithub::R::REPO_REGEX}\s+?#(?<pr>\d+?)$/,
47
47
  :pr_merge, command: true, confirmation: true,
48
48
  help: {
49
- 'gh shipit #42 PagerDuty/lita-github' => 'ship it!',
50
- 'gh pr merge #42 PagerDuty/lita-github' => 'ship it!',
51
- 'shipit #42 PagerDuty/lita-github' => 'ship it!'
49
+ 'gh shipit PagerDuty/lita-github #42' => 'ship it!',
50
+ 'gh pr merge PagerDuty/lita-github #42' => 'ship it!',
51
+ 'shipit PagerDuty/lita-github #42' => 'ship it!'
52
52
  }
53
53
  )
54
54
 
@@ -127,6 +127,9 @@ module Lita
127
127
  t_id = default_team(org)
128
128
  opts[:team_id] = t_id unless t_id.nil?
129
129
  end unless opts.key?(:team_id)
130
+
131
+ opts[:private] = should_repo_be_private?(opts[:private])
132
+
130
133
  opts
131
134
  end
132
135
 
data/lita-github.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
 
38
38
  s.add_development_dependency 'bundler', '~> 1.5'
39
39
  s.add_development_dependency 'rake', '~> 10.2'
40
- s.add_development_dependency 'rubocop', '~> 0.25.0'
40
+ s.add_development_dependency 'rubocop', '~> 0.26.0'
41
41
  s.add_development_dependency 'rspec', '~> 3.0'
42
42
  s.add_development_dependency 'fuubar', '~> 2.0'
43
43
  s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4', '>= 0.4.0'
@@ -3,9 +3,21 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Lita::Handlers::GithubPR, lita_handler: true do
6
- it { routes_command('gh shipit #42 GrapeDuty/lita-test').to(:pr_merge) }
7
- it { routes_command('gh pr merge #42 GrapeDuty/lita-test').to(:pr_merge) }
8
- it { routes_command('shipit #42 GrapeDuty/lita-test').to(:pr_merge) }
6
+ # pr_merge command routing
7
+ it { routes_command('gh shipit GrapeDuty/lita-test #42').to(:pr_merge) }
8
+ it { routes_command('gh shipit lita-test #42').to(:pr_merge) }
9
+ it { routes_command('gh pr merge lita-test #42').to(:pr_merge) }
10
+ it { routes_command('gh pr merge GrapeDuty/lita-test #42').to(:pr_merge) }
11
+ it { routes_command('shipit GrapeDuty/lita-test #42').to(:pr_merge) }
12
+ it { routes_command('shipit lita-test #42').to(:pr_merge) }
13
+
14
+ # pr_info command routing
15
+ it { routes_command('gh pr info GrapeDuty/lita-test #42').to(:pr_info) }
16
+ it { routes_command('gh pr info lita-test #42').to(:pr_info) }
17
+
18
+ # pr_list command routing
19
+ it { routes_command('gh pr list GrapeDuty/lita-test').to(:pr_list) }
20
+ it { routes_command('gh pr list lita-test').to(:pr_list) }
9
21
 
10
22
  let(:github_pr) { Lita::Handlers::GithubPR.new('robot') }
11
23
  let(:github_org) { 'GrapeDuty' }
@@ -431,7 +443,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
431
443
  'Head: 1234567 | Commits: 1 (+42/-0) :: ' \
432
444
  "https://github.com/GrapeDuty/lita-test/compare/0987654321...1234567890\n" \
433
445
  "PR Comments: 1 | Code Comments: 2\n"
434
- send_command("gh pr info #42 #{github_org}/#{github_repo}")
446
+ send_command("gh pr info #{github_org}/#{github_repo} #42")
435
447
  expect(replies.last).to eql r
436
448
  end
437
449
  end
@@ -459,7 +471,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
459
471
  'Head: 1234567 | Commits: 1 (+42/-0) :: ' \
460
472
  "https://github.com/GrapeDuty/lita-test/compare/0987654321...1234567890\n" \
461
473
  "PR Comments: 1 | Code Comments: 2\n"
462
- send_command("gh pr info #42 #{github_org}/#{github_repo}")
474
+ send_command("gh pr info #{github_org}/#{github_repo} #42")
463
475
  expect(replies.last).to eql r
464
476
  end
465
477
  end
@@ -471,7 +483,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
471
483
  end
472
484
 
473
485
  it 'should reply with the not found error' do
474
- send_command("gh pr info #42 #{github_org}/#{github_repo}")
486
+ send_command("gh pr info #{github_org}/#{github_repo} #42")
475
487
  expect(replies.last).to eql 'Pull request #42 on GrapeDuty/lita-test not found'
476
488
  end
477
489
  end
@@ -495,7 +507,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
495
507
  end
496
508
 
497
509
  it 'should no-op and say such' do
498
- send_command("shipit #42 #{github_org}/#{github_repo}")
510
+ send_command("shipit #{github_org}/#{github_repo} #42")
499
511
  expect(replies.last).to eql disabled_reply
500
512
  end
501
513
  end
@@ -506,7 +518,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
506
518
  end
507
519
 
508
520
  it 'should reply indicating it was invalid' do
509
- send_command("shipit #42 #{github_org}/#{github_repo}")
521
+ send_command("shipit #{github_org}/#{github_repo} #42")
510
522
  expect(replies.last).to eql 'Pull request #42 on GrapeDuty/lita-test not found'
511
523
  end
512
524
  end
@@ -516,11 +528,11 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
516
528
  expect(github_pr).to receive(:merge_pr).with(
517
529
  'GrapeDuty', 'lita-test', '42', "Merge pull request #42 from GrapeDuty/fix-some-bugs\n\nfix bug"
518
530
  )
519
- send_command('shipit #42 GrapeDuty/lita-test')
531
+ send_command('shipit GrapeDuty/lita-test #42')
520
532
  end
521
533
 
522
534
  it 'should confirm merging of PR' do
523
- send_command("shipit #42 #{github_org}/#{github_repo}")
535
+ send_command("shipit #{github_org}/#{github_repo} #42")
524
536
  expect(replies.last)
525
537
  .to eql "Merged pull request #42 from GrapeDuty/fix-some-bugs\nfix bug"
526
538
  end
@@ -533,7 +545,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
533
545
  end
534
546
 
535
547
  it 'should confirm the failure' do
536
- send_command("shipit #42 #{github_org}/#{github_repo}")
548
+ send_command("shipit #{github_org}/#{github_repo} #42")
537
549
  expect(replies.last)
538
550
  .to eql(
539
551
  "Failed trying to merge PR #42 (fix bug) :: https://github.com/GrapeDuty/lita-test/pull/42\n"\
@@ -550,7 +562,7 @@ describe Lita::Handlers::GithubPR, lita_handler: true do
550
562
  end
551
563
 
552
564
  it 'should confirm the failure' do
553
- send_command("shipit #42 #{github_org}/#{github_repo}")
565
+ send_command("shipit #{github_org}/#{github_repo} #42")
554
566
  expect(replies.last)
555
567
  .to eql(
556
568
  'An unexpected exception was hit during the GitHub API operation. Please make sure all ' \
@@ -143,17 +143,25 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
143
143
  @c_obj = double('Lita::Configuration', default_team_slug: 'h3ckman')
144
144
  allow(github_repo).to receive(:config).and_return(@c_obj)
145
145
  allow(github_repo).to receive(:team_id_by_slug).and_return(42)
146
+ allow(github_repo).to receive(:should_repo_be_private?).and_return(true)
146
147
  end
147
148
 
148
- it 'should set the :organization key and :team_id key' do
149
- h = { organization: github_org, team_id: 42 }
149
+ it 'should set the :organization key, :team_id key, and :private key' do
150
+ h = { organization: github_org, team_id: 42, private: true }
150
151
  expect(github_repo.send(:extrapolate_create_opts, @eco_opts, github_org)).to eql h
151
152
  end
152
153
 
154
+ it 'should set the private key to the return of should_repo_be_private?' do
155
+ opts = { private: 'test', team_id: 42 }
156
+ expect(github_repo).to receive(:should_repo_be_private?).with('test').and_return :ohai
157
+ r = github_repo.send(:extrapolate_create_opts, opts, github_org)
158
+ expect(r[:private]).to eql :ohai
159
+ end
160
+
153
161
  context 'when there is no :team set' do
154
162
  context 'when default_team returns a team id' do
155
163
  it 'should get the default team_id' do
156
- h = { organization: github_org, team_id: 44 }
164
+ h = { organization: github_org, team_id: 44, private: true }
157
165
  expect(github_repo).to receive(:default_team).with(github_org).and_return(44)
158
166
  expect(github_repo.send(:extrapolate_create_opts, @eco_opts, github_org)).to eql h
159
167
  end
@@ -166,7 +174,7 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
166
174
  end
167
175
 
168
176
  it 'should not set the :team_id key' do
169
- h = { organization: github_org }
177
+ h = { organization: github_org, private: true }
170
178
  expect(github_repo).to receive(:default_team).with(github_org).and_return(nil)
171
179
  expect(github_repo.send(:extrapolate_create_opts, @eco_opts, github_org)).to eql h
172
180
  end
@@ -178,7 +186,7 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
178
186
  before { @eco_opts = { team: 'heckman' } }
179
187
 
180
188
  it 'should set the :team_id key' do
181
- h = { organization: github_org, team_id: 84 }.merge!(@eco_opts)
189
+ h = { organization: github_org, team_id: 84, private: true }.merge!(@eco_opts)
182
190
  expect(github_repo).to receive(:team_id_by_slug).with('heckman', github_org).and_return(84)
183
191
  expect(github_repo.send(:extrapolate_create_opts, @eco_opts, github_org)).to eql h
184
192
  end
@@ -187,7 +195,7 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
187
195
  context 'when given an invalid slug' do
188
196
  context 'when there is a default slug set' do
189
197
  it 'should set the team to the default' do
190
- h = { organization: github_org, team_id: 42 }.merge!(@eco_opts)
198
+ h = { organization: github_org, team_id: 42, private: true }.merge!(@eco_opts)
191
199
  expect(github_repo).to receive(:team_id_by_slug).with('h3ckman', github_org).and_return(42)
192
200
  expect(github_repo.send(:extrapolate_create_opts, @eco_opts, github_org)).to eql h
193
201
  end
@@ -195,7 +203,7 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
195
203
 
196
204
  context 'when there is no default slug set' do
197
205
  before do
198
- @eco_opts = { team: 'h3ckman' }
206
+ @eco_opts = { team: 'h3ckman', private: true }
199
207
  c_obj = double('Lita::Configuration', default_team_slug: nil)
200
208
  allow(github_repo).to receive(:config).and_return(c_obj)
201
209
  end
@@ -212,7 +220,7 @@ describe Lita::Handlers::GithubRepo, lita_handler: true do
212
220
  end
213
221
 
214
222
  context 'when there is a :team_id key' do
215
- before { @eco_opts = { team_id: 44 } }
223
+ before { @eco_opts = { team_id: 44, private: true } }
216
224
 
217
225
  it 'should just leave it alone...' do
218
226
  h = { organization: github_org }.merge!(@eco_opts)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Heckman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.25.0
47
+ version: 0.26.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.25.0
54
+ version: 0.26.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement