socialcast-git-extensions 3.1.10 → 3.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,10 +36,12 @@ module Socialcast
36
36
  "Assigned to @#{buddy}"
37
37
  end
38
38
 
39
+ assignee = github_review_buddy(current_user)
40
+
39
41
  description = options[:description] || editor_input(PULL_REQUEST_DESCRIPTION)
40
42
  branch = current_branch
41
43
  repo = current_repo
42
- url = create_pull_request token, branch, repo, description
44
+ url = create_pull_request token, branch, repo, description, assignee
43
45
  say "Pull request created: #{url}"
44
46
 
45
47
  short_description = description.split("\n").first(5).join("\n")
@@ -32,7 +32,7 @@ module Socialcast
32
32
 
33
33
  # returns the url of the created pull request
34
34
  # @see http://developer.github.com/v3/pulls/
35
- def create_pull_request(token, branch, repo, body)
35
+ def create_pull_request(token, branch, repo, body, assignee)
36
36
  payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json
37
37
  say "Creating pull request for "
38
38
  say "#{branch} ", :green
@@ -42,6 +42,9 @@ module Socialcast
42
42
  say repo, :green
43
43
  response = RestClient::Request.new(:url => "https://api.github.com/repos/#{repo}/pulls", :method => "POST", :payload => payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => "token #{token}"}).execute
44
44
  data = JSON.parse response.body
45
+
46
+ assign_pull_request(token, branch, assignee, data) if assignee ## Unfortunately this needs to be done in a seperate request.
47
+
45
48
  url = data['html_url']
46
49
  url
47
50
  rescue RestClient::Exception => e
@@ -49,6 +52,14 @@ module Socialcast
49
52
  throw e
50
53
  end
51
54
 
55
+ def assign_pull_request(token, branch, assignee, data)
56
+ issue_payload = { :title => branch, :assignee => assignee }.to_json
57
+ RestClient::Request.new(:url => data['issue_url'], :method => "PATCH", :payload => issue_payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => "token #{token}"}).execute
58
+ rescue RestClient::Exception => e
59
+ data = JSON.parse e.http_body
60
+ say "Failed to assign pull request: #{data['message']}", :red
61
+ end
62
+
52
63
  def process_error(e)
53
64
  data = JSON.parse e.http_body
54
65
  say "Failed to create pull request: #{data['message']}", :red
@@ -63,6 +74,14 @@ module Socialcast
63
74
  review_buddies[review_requestor['buddy']]['socialcast_username']
64
75
  end
65
76
  end
77
+
78
+ def github_review_buddy(current_user)
79
+ review_requestor = review_buddies[current_user]
80
+ if review_requestor
81
+ review_requestor['buddy']
82
+ end
83
+ end
84
+
66
85
  end
67
86
  end
68
87
  end
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "3.1.10"
3
+ VERSION = "3.1.11"
4
4
  end
5
5
  end
@@ -0,0 +1 @@
1
+
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.10
4
+ version: 3.1.11
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ryan Sonnek
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-24 00:00:00.000000000 Z
12
+ date: 2014-02-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: grit
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: socialcast
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rest-client
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: json_pure
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: thor
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rake
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - '='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - '='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rspec
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ! '>='
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ! '>='
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: pry
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ! '>='
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ! '>='
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: webmock
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ! '>='
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ! '>='
137
156
  - !ruby/object:Gem::Version
@@ -181,30 +200,33 @@ files:
181
200
  - lib/socialcast-git-extensions/version.rb
182
201
  - socialcast-git-extensions.gemspec
183
202
  - spec/cli_spec.rb
203
+ - spec/github_spec.rb
184
204
  - spec/spec_helper.rb
185
205
  homepage: http://github.com/socialcast/socialcast-git-extensions
186
206
  licenses: []
187
- metadata: {}
188
207
  post_install_message:
189
208
  rdoc_options: []
190
209
  require_paths:
191
210
  - lib
192
211
  required_ruby_version: !ruby/object:Gem::Requirement
212
+ none: false
193
213
  requirements:
194
214
  - - ! '>='
195
215
  - !ruby/object:Gem::Version
196
216
  version: '0'
197
217
  required_rubygems_version: !ruby/object:Gem::Requirement
218
+ none: false
198
219
  requirements:
199
220
  - - ! '>='
200
221
  - !ruby/object:Gem::Version
201
222
  version: '0'
202
223
  requirements: []
203
224
  rubyforge_project: socialcast-git-extensions
204
- rubygems_version: 2.1.11
225
+ rubygems_version: 1.8.23
205
226
  signing_key:
206
- specification_version: 4
227
+ specification_version: 3
207
228
  summary: git extension scripts for socialcast workflow
208
229
  test_files:
209
230
  - spec/cli_spec.rb
231
+ - spec/github_spec.rb
210
232
  - spec/spec_helper.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTVhZGZmOTIzNzM1Zjg3OTYyN2M4YjQwY2ExNjY2ZjM2MWZlMDEyZQ==
5
- data.tar.gz: !binary |-
6
- NzFkYjk0ZDZmNTQxYjRkNTg3NTA1ZmNkMWQ1YWYxOGVhYzgwZDkyNw==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- MjY1OTlkOTQwYmZkMDA2NTQ0NTc0MzZlM2U1MzRkZjdhN2JlOTkwYWMyZGVm
10
- YTE4ZDFjMDczOTgwNGI3NmE1YzNhMTZjYWUyZGVkZmFmYTU3ZTUwOGFkZTIx
11
- ZDdlMWM1NzE2YjBmY2Q1NjNkNmY3ZmRhODU2YmI1MmQ2NTFlNzU=
12
- data.tar.gz: !binary |-
13
- NjYwNjM1MGEyZTM2MjI4NjgxMTE4MTlhNGNjYTgyOTg2ODYzMGIzMGEwZDhm
14
- NjQ4YTI2ZDljY2Q1NjM1YWQ3NTcxNTZiMTQ0MGVhYWNlNjExYTk1MDRlMjQ1
15
- NTM4NDA2NzM0YjM5NmEwZThhODgxMDczZTY1MDU3MDcwZjIwNTg=