socialcast-git-extensions 3.1.11 → 3.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDY0NDg0NzYzOGFlZWU0YTczNjMxZDQxM2ZhYzU1ZDMzYTJkNzFlYw==
5
+ data.tar.gz: !binary |-
6
+ M2YzYjEwMGMxYzFjMGI2OTU4NGUyNDVkZDNhOWZhYzNlMTQ4OTQzMg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NGIwOGM1NmExNGE0M2Y5NGRhZTVhODkxNGJkOWM3ODg3YWY2OTc5YWU1Mzc4
10
+ MTY1YTFkYjcyZGUwYTg5MTJiZTgyNDMxNjFkMTM2MDQ3YzIwMzM5ZjBiZTc0
11
+ ODAyM2JhODg2MmY1OGZhNzZkNGE1N2FlMmUwOTkyOTA0YWI2YWI=
12
+ data.tar.gz: !binary |-
13
+ ODQwMzdhZGQ1MjgyMjViMDBiZjkzYzY5ZThlMTBiNzc2YmNkOWM5MjM3NDA0
14
+ NDNlMzVmMDEwY2Y2ZDA4ZjAzM2JiNzdlYWZjODUwZDI5MTdhOGYwMzFlMjI1
15
+ NzgxYmZiYzAyNzM1ZmE3ODkyNThiYjAzZTE3YjQyYzFkYmIyNTE=
@@ -20,6 +20,10 @@ update the local feature branch with latest remote changes plus upstream release
20
20
 
21
21
  integrate the current feature branch into an aggregate branch (ex: prototype, staging)
22
22
 
23
+ == git findpr <commit_hash>
24
+
25
+ Find pull requests on github including a given commit
26
+
23
27
  == git reviewrequest
24
28
 
25
29
  create a pull request on github for peer review of the current branch.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions', 'cli.rb')
4
+ Socialcast::Gitx::CLI.start (['findpr'] + ARGV)
@@ -49,6 +49,22 @@ module Socialcast
49
49
  post review_message, :url => url, :message_type => 'review_request'
50
50
  end
51
51
 
52
+ desc "findpr", "Find pull requests including a given commit"
53
+ def findpr(commit_hash)
54
+ token = authorization_token
55
+ repo = current_repo
56
+ data = pull_requests_for_commit(token, repo, commit_hash)
57
+
58
+ if data['items']
59
+ data['items'].each do |entry|
60
+ say "\n" << [entry['html_url'], entry['title'], "#{entry['user'] && entry['user']['login']} #{entry['created_at']}"].join("\n\t")
61
+ end
62
+ else
63
+ say "No results found", :yellow
64
+ end
65
+
66
+ end
67
+
52
68
  # TODO: use --no-edit to skip merge messages
53
69
  # TODO: use pull --rebase to skip merge commit
54
70
  desc 'update', 'Update the current branch with latest changes from the remote feature branch and master'
@@ -52,6 +52,18 @@ module Socialcast
52
52
  throw e
53
53
  end
54
54
 
55
+ # find the PRs matching the given commit hash
56
+ # https://developer.github.com/v3/search/#search-issues
57
+ def pull_requests_for_commit(token, repo, commit_hash)
58
+ query = "#{commit_hash}+type:pr+repo:#{repo}"
59
+ say "Searching github pull requests for #{commit_hash}"
60
+ response = RestClient::Request.new(:url => "https://api.github.com/search/issues?q=#{query}", :method => "GET", :headers => {:accept => :json, :content_type => :json, 'Authorization' => "token #{token}"}).execute
61
+ JSON.parse response.body
62
+ rescue RestClient::Exception => e
63
+ process_error e
64
+ throw e
65
+ end
66
+
55
67
  def assign_pull_request(token, branch, assignee, data)
56
68
  issue_payload = { :title => branch, :assignee => assignee }.to_json
57
69
  RestClient::Request.new(:url => data['issue_url'], :method => "PATCH", :payload => issue_payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => "token #{token}"}).execute
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "3.1.11"
3
+ VERSION = "3.1.12"
4
4
  end
5
5
  end
@@ -410,6 +410,76 @@ describe Socialcast::Gitx::CLI do
410
410
  end
411
411
  end
412
412
 
413
+ describe '#findpr' do
414
+ before do
415
+ # https://developer.github.com/v3/search/#search-issues
416
+ stub_response = {
417
+ "total_count"=> 280,
418
+ "items"=> [{
419
+ "url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132",
420
+ "labels_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}",
421
+ "comments_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments",
422
+ "events_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events",
423
+ "html_url" => "https://github.com/batterseapower/pinyin-toolkit/issues/132",
424
+ "id" => 35802,
425
+ "number" => 132,
426
+ "title" => "Line Number Indexes Beyond 20 Not Displayed",
427
+ "user" => {
428
+ "login" => "Nick3C",
429
+ "id" => 90254,
430
+ "avatar_url" => "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
431
+ "gravatar_id" => "934442aadfe3b2f4630510de416c5718",
432
+ "url" => "https://api.github.com/users/Nick3C",
433
+ "html_url" => "https://github.com/Nick3C",
434
+ "followers_url" => "https://api.github.com/users/Nick3C/followers",
435
+ "following_url" => "https://api.github.com/users/Nick3C/following{/other_user}",
436
+ "gists_url" => "https://api.github.com/users/Nick3C/gists{/gist_id}",
437
+ "starred_url" => "https://api.github.com/users/Nick3C/starred{/owner}{/repo}",
438
+ "subscriptions_url" => "https://api.github.com/users/Nick3C/subscriptions",
439
+ "organizations_url" => "https://api.github.com/users/Nick3C/orgs",
440
+ "repos_url" => "https://api.github.com/users/Nick3C/repos",
441
+ "events_url" => "https://api.github.com/users/Nick3C/events{/privacy}",
442
+ "received_events_url" => "https://api.github.com/users/Nick3C/received_events",
443
+ "type" => "User"
444
+ },
445
+ "labels" => [{
446
+ "url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug",
447
+ "name" => "bug",
448
+ "color" => "ff0000"
449
+ }],
450
+ "state" => "open",
451
+ "assignee" => nil,
452
+ "milestone" => nil,
453
+ "comments" => 15,
454
+ "created_at" => "2009-07-12T20:10:41Z",
455
+ "updated_at" => "2009-07-19T09:23:43Z",
456
+ "closed_at" => nil,
457
+ "pull_request" => {
458
+ "html_url" => nil,
459
+ "diff_url" => nil,
460
+ "patch_url" => nil
461
+ },
462
+ "body" => "...",
463
+ "score" => 1.3859273
464
+ }]
465
+ }
466
+
467
+ stub_request(:get, "https://api.github.com/search/issues?q=abc123%20type:pr%20repo:socialcast/socialcast-git-extensions").
468
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip, deflate', 'Authorization'=>'token 8e1936680681828863c314e955acefcb6c25b887', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'}).
469
+ to_return(:status => 200, :body => stub_response.to_json, :headers => {})
470
+ Socialcast::Gitx::CLI.any_instance.should_receive(:findpr).and_call_original
471
+ Socialcast::Gitx::CLI.any_instance.stub(:say).with do |message|
472
+ @said_text = @said_text.to_s + message
473
+ end
474
+ Socialcast::Gitx::CLI.start ['findpr', 'abc123']
475
+ end
476
+ it 'fetches the data from github and prints it out' do
477
+ @said_text.should include "https://github.com/batterseapower/pinyin-toolkit/issues/132"
478
+ @said_text.should include "Nick3C"
479
+ @said_text.should include "Line Number Indexes Beyond 20 Not Displayed"
480
+ end
481
+ end
482
+
413
483
  describe '#reviewrequest' do
414
484
  context 'when there are no review_buddies specified' do
415
485
  before do
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.11
5
- prerelease:
4
+ version: 3.1.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Sonnek
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: grit
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: socialcast
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rest-client
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: json_pure
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: thor
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - '='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - '='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: rspec
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: pry
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: webmock
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ! '>='
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ! '>='
156
137
  - !ruby/object:Gem::Version
@@ -160,6 +141,7 @@ email:
160
141
  - ryan@socialcast.com
161
142
  executables:
162
143
  - git-cleanup
144
+ - git-findpr
163
145
  - git-integrate
164
146
  - git-nuke
165
147
  - git-promote
@@ -181,6 +163,7 @@ files:
181
163
  - README.rdoc
182
164
  - Rakefile
183
165
  - bin/git-cleanup
166
+ - bin/git-findpr
184
167
  - bin/git-integrate
185
168
  - bin/git-nuke
186
169
  - bin/git-promote
@@ -204,27 +187,26 @@ files:
204
187
  - spec/spec_helper.rb
205
188
  homepage: http://github.com/socialcast/socialcast-git-extensions
206
189
  licenses: []
190
+ metadata: {}
207
191
  post_install_message:
208
192
  rdoc_options: []
209
193
  require_paths:
210
194
  - lib
211
195
  required_ruby_version: !ruby/object:Gem::Requirement
212
- none: false
213
196
  requirements:
214
197
  - - ! '>='
215
198
  - !ruby/object:Gem::Version
216
199
  version: '0'
217
200
  required_rubygems_version: !ruby/object:Gem::Requirement
218
- none: false
219
201
  requirements:
220
202
  - - ! '>='
221
203
  - !ruby/object:Gem::Version
222
204
  version: '0'
223
205
  requirements: []
224
206
  rubyforge_project: socialcast-git-extensions
225
- rubygems_version: 1.8.23
207
+ rubygems_version: 2.2.1
226
208
  signing_key:
227
- specification_version: 3
209
+ specification_version: 4
228
210
  summary: git extension scripts for socialcast workflow
229
211
  test_files:
230
212
  - spec/cli_spec.rb