git_reflow 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.3.3)
4
+ git_reflow (0.3.5)
5
5
  colorize (= 0.6.0)
6
6
  github_api (= 0.10.2)
7
7
  gli (= 2.8.1)
@@ -38,8 +38,8 @@ GEM
38
38
  json_pure (1.8.1)
39
39
  jwt (0.1.8)
40
40
  multi_json (>= 1.5)
41
- mini_portile (0.5.2)
42
- multi_json (1.8.2)
41
+ mini_portile (0.5.1)
42
+ multi_json (1.8.4)
43
43
  multi_xml (0.5.5)
44
44
  multipart-post (1.2.0)
45
45
  nokogiri (1.6.0)
data/README.rdoc CHANGED
@@ -7,7 +7,7 @@ If your workflow looks like this:
7
7
  2. Write great code
8
8
  3. Create a pull request against master
9
9
  4. Get 'lgtm' through a code review
10
- 5. Squash merge to master
10
+ 5. Squash merge to master (Why is squash merging our preferred workflow? https://github.com/reenhanced/gitreflow/issues/52)
11
11
  6. Delete the feature branch
12
12
 
13
13
  Reflow will make your life easier.
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
data/lib/git_reflow.rb CHANGED
@@ -45,8 +45,14 @@ module GitReflow
45
45
  config.ssl = {:verify => false}
46
46
  end
47
47
 
48
- authorization = github.oauth.create 'scopes' => ['repo']
49
- oauth_token = authorization[:token]
48
+ previous_authorizations = github.oauth.all.select {|auth| auth.note == "git-reflow (#{`hostname`.strip})" }
49
+ if previous_authorizations.any?
50
+ authorization = previous_authorizations.last
51
+ else
52
+ authorization = github.oauth.create scopes: ['repo'], note: "git-reflow (#{`hostname`.strip})"
53
+ end
54
+
55
+ oauth_token = authorization.token
50
56
 
51
57
  if project_only
52
58
  set_oauth_token(oauth_token, local: true)
@@ -116,9 +122,10 @@ module GitReflow
116
122
 
117
123
  open_comment_authors = find_authors_of_open_pull_request_comments(existing_pull_request)
118
124
  has_comments = has_pull_request_comments?(existing_pull_request)
125
+ status = get_build_status existing_pull_request.head.sha
119
126
 
120
127
  # if there any comment_authors left, then they haven't given a lgtm after the last commit
121
- if (has_comments and open_comment_authors.empty?) or options['skip_lgtm']
128
+ if ((status.nil? or status.state == "success") and has_comments and open_comment_authors.empty?) or options['skip_lgtm']
122
129
  lgtm_authors = comment_authors_for_pull_request(existing_pull_request, :with => LGTM)
123
130
  commit_message = "#{(existing_pull_request[:body] || get_first_commit_message)}"
124
131
  puts "Merging pull request ##{existing_pull_request.number}: '#{existing_pull_request.title}', from '#{existing_pull_request.head.label}' into '#{existing_pull_request.base.label}'"
@@ -144,6 +151,8 @@ module GitReflow
144
151
  else
145
152
  puts "There were problems commiting your feature... please check the errors above and try again."
146
153
  end
154
+ elsif status.state != "success"
155
+ puts "[#{ 'deliver halted'.colorize(:red) }] #{status.description}: #{status.target_url}"
147
156
  elsif open_comment_authors.count > 0
148
157
  puts "[deliver halted] You still need a LGTM from: #{open_comment_authors.join(', ')}"
149
158
  else
@@ -280,6 +289,19 @@ module GitReflow
280
289
  pull_request_comments(pull_request).count > 0
281
290
  end
282
291
 
292
+ def get_build_status sha
293
+ github.repos.statuses.all(remote_user, remote_repo_name, sha).first
294
+ end
295
+
296
+ def build_color status
297
+ colorized_statuses = { pending: :yellow, success: :green, error: :red, failure: :red }
298
+ colorized_statuses[status.state.to_sym]
299
+ end
300
+
301
+ def colorized_build_description status
302
+ status.description.colorize( build_color status )
303
+ end
304
+
283
305
  def find_authors_of_open_pull_request_comments(pull_request)
284
306
  # first we'll gather all the authors that have commented on the pull request
285
307
  pull_last_committed_at = get_commited_time(pull_request.head.sha)
@@ -314,6 +336,13 @@ module GitReflow
314
336
  notices = ""
315
337
  reviewed_by = comment_authors_for_pull_request(pull_request).map {|author| author.colorize(:red) }
316
338
 
339
+ # check for CI build status
340
+ status = get_build_status pull_request.head.sha
341
+ if status
342
+ notices << "[notice] Your build status is not successful: #{status.target_url}.\n" unless status.state == "success"
343
+ summary_data.merge!( "Build status" => colorized_build_description(status) )
344
+ end
345
+
317
346
  # check for needed lgtm's
318
347
  pull_comments = pull_request_comments(pull_request)
319
348
  if pull_comments.reject {|comment| comment.user.login == github_user}.any?
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_reflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Valentino Stoll
@@ -10,67 +11,76 @@ authors:
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2013-11-01 00:00:00.000000000 Z
14
+ date: 2014-03-05 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: bundler
17
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
18
20
  requirements:
19
- - - '>='
21
+ - - ! '>='
20
22
  - !ruby/object:Gem::Version
21
23
  version: '0'
22
24
  type: :development
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
- - - '>='
29
+ - - ! '>='
27
30
  - !ruby/object:Gem::Version
28
31
  version: '0'
29
32
  - !ruby/object:Gem::Dependency
30
33
  name: rake
31
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
32
36
  requirements:
33
- - - '>='
37
+ - - ! '>='
34
38
  - !ruby/object:Gem::Version
35
39
  version: '0'
36
40
  type: :development
37
41
  prerelease: false
38
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
39
44
  requirements:
40
- - - '>='
45
+ - - ! '>='
41
46
  - !ruby/object:Gem::Version
42
47
  version: '0'
43
48
  - !ruby/object:Gem::Dependency
44
49
  name: rdoc
45
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
46
52
  requirements:
47
- - - '>='
53
+ - - ! '>='
48
54
  - !ruby/object:Gem::Version
49
55
  version: '0'
50
56
  type: :development
51
57
  prerelease: false
52
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
53
60
  requirements:
54
- - - '>='
61
+ - - ! '>='
55
62
  - !ruby/object:Gem::Version
56
63
  version: '0'
57
64
  - !ruby/object:Gem::Dependency
58
65
  name: jeweler
59
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
- - - '>='
69
+ - - ! '>='
62
70
  - !ruby/object:Gem::Version
63
71
  version: '0'
64
72
  type: :development
65
73
  prerelease: false
66
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
67
76
  requirements:
68
- - - '>='
77
+ - - ! '>='
69
78
  - !ruby/object:Gem::Version
70
79
  version: '0'
71
80
  - !ruby/object:Gem::Dependency
72
81
  name: colorize
73
82
  requirement: !ruby/object:Gem::Requirement
83
+ none: false
74
84
  requirements:
75
85
  - - '='
76
86
  - !ruby/object:Gem::Version
@@ -78,6 +88,7 @@ dependencies:
78
88
  type: :runtime
79
89
  prerelease: false
80
90
  version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
81
92
  requirements:
82
93
  - - '='
83
94
  - !ruby/object:Gem::Version
@@ -85,6 +96,7 @@ dependencies:
85
96
  - !ruby/object:Gem::Dependency
86
97
  name: gli
87
98
  requirement: !ruby/object:Gem::Requirement
99
+ none: false
88
100
  requirements:
89
101
  - - '='
90
102
  - !ruby/object:Gem::Version
@@ -92,6 +104,7 @@ dependencies:
92
104
  type: :runtime
93
105
  prerelease: false
94
106
  version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
95
108
  requirements:
96
109
  - - '='
97
110
  - !ruby/object:Gem::Version
@@ -99,48 +112,55 @@ dependencies:
99
112
  - !ruby/object:Gem::Dependency
100
113
  name: highline
101
114
  requirement: !ruby/object:Gem::Requirement
115
+ none: false
102
116
  requirements:
103
- - - '>='
117
+ - - ! '>='
104
118
  - !ruby/object:Gem::Version
105
119
  version: '0'
106
120
  type: :runtime
107
121
  prerelease: false
108
122
  version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
109
124
  requirements:
110
- - - '>='
125
+ - - ! '>='
111
126
  - !ruby/object:Gem::Version
112
127
  version: '0'
113
128
  - !ruby/object:Gem::Dependency
114
129
  name: httpclient
115
130
  requirement: !ruby/object:Gem::Requirement
131
+ none: false
116
132
  requirements:
117
- - - '>='
133
+ - - ! '>='
118
134
  - !ruby/object:Gem::Version
119
135
  version: '0'
120
136
  type: :runtime
121
137
  prerelease: false
122
138
  version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
123
140
  requirements:
124
- - - '>='
141
+ - - ! '>='
125
142
  - !ruby/object:Gem::Version
126
143
  version: '0'
127
144
  - !ruby/object:Gem::Dependency
128
145
  name: json_pure
129
146
  requirement: !ruby/object:Gem::Requirement
147
+ none: false
130
148
  requirements:
131
- - - '>='
149
+ - - ! '>='
132
150
  - !ruby/object:Gem::Version
133
151
  version: '0'
134
152
  type: :runtime
135
153
  prerelease: false
136
154
  version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
137
156
  requirements:
138
- - - '>='
157
+ - - ! '>='
139
158
  - !ruby/object:Gem::Version
140
159
  version: '0'
141
160
  - !ruby/object:Gem::Dependency
142
161
  name: github_api
143
162
  requirement: !ruby/object:Gem::Requirement
163
+ none: false
144
164
  requirements:
145
165
  - - '='
146
166
  - !ruby/object:Gem::Version
@@ -148,6 +168,7 @@ dependencies:
148
168
  type: :runtime
149
169
  prerelease: false
150
170
  version_requirements: !ruby/object:Gem::Requirement
171
+ none: false
151
172
  requirements:
152
173
  - - '='
153
174
  - !ruby/object:Gem::Version
@@ -182,10 +203,9 @@ files:
182
203
  homepage: http://github.com/reenhanced/gitreflow
183
204
  licenses:
184
205
  - MIT
185
- metadata: {}
186
- post_install_message: |-
187
- You need to setup your GitHub OAuth token
188
- Please run 'git-reflow setup'
206
+ post_install_message: ! 'You need to setup your GitHub OAuth token
207
+
208
+ Please run ''git-reflow setup'''
189
209
  rdoc_options:
190
210
  - --title
191
211
  - git_reflow
@@ -196,19 +216,27 @@ require_paths:
196
216
  - lib
197
217
  - lib
198
218
  required_ruby_version: !ruby/object:Gem::Requirement
219
+ none: false
199
220
  requirements:
200
- - - '>='
221
+ - - ! '>='
201
222
  - !ruby/object:Gem::Version
202
223
  version: '0'
224
+ segments:
225
+ - 0
226
+ hash: 4495408522000953472
203
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
+ none: false
204
229
  requirements:
205
- - - '>='
230
+ - - ! '>='
206
231
  - !ruby/object:Gem::Version
207
232
  version: '0'
233
+ segments:
234
+ - 0
235
+ hash: 4495408522000953472
208
236
  requirements: []
209
237
  rubyforge_project:
210
- rubygems_version: 2.0.3
238
+ rubygems_version: 1.8.23
211
239
  signing_key:
212
- specification_version: 4
240
+ specification_version: 3
213
241
  summary: A better git process
214
242
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: e987226cc58b7748ddc8aeda4bb5cdf3e38df27c
4
- data.tar.gz: 6a0d8f7e352d6cca67d0dc3c452aa67bd588e465
5
- SHA512:
6
- metadata.gz: 9305b7550459a3885e87582e39243f43f0b1287e5124606e0dcbfbb39473034a33fecf91b91f986874ac167793910f2d4e4fd10ac587aa2b27832dab79e702a3
7
- data.tar.gz: 86210915b05736f6b14ee6a8c437abb877066a3166b486e231f22dc79f280372854e4de155a462640754a093157c49e2f54a4b2c2a66b3294a0c2aaf9afcd1e8