tutter-sppuppet 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +3 -1
  3. data/lib/tutter/action/sppuppet.rb +11 -11
  4. metadata +21 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c82c8f1b531c0e1577d3d18c117f8ebda785b4c
4
- data.tar.gz: c8995bccc8a4f0d9a4a27477ca13bfb7243ddd66
3
+ metadata.gz: 3c4746d2776652a1a3312a5c400938c2ada7e747
4
+ data.tar.gz: 9bb20eb13de1803246a25ab8cf19d122cf96ee9b
5
5
  SHA512:
6
- metadata.gz: 3a416fb995a3bebf146e3dc6b174e644d38830d664be2f41aa75eb740829dfd62583cd2cf386bd0c2788773f3e2e7cfe8efa7c6508ff0fd47c16a680c7544fbd
7
- data.tar.gz: 2575109d71bbc07c5f82a85f44a60e3a9a04c8c4617fcfe4416fb4aaa68c90b717119c50283b1ab4aaa6cf771d467c2f861fc5823afd9cf22c6ff55c12eef177
6
+ metadata.gz: 1bf0a7d8d0b52e04a8df8b8b6930d7980747975b2765a0d93e7bcb3d37d863675f278424a98dfea6e5f91522caba2fcf8838d66afb83accfeaf4db1699788622
7
+ data.tar.gz: 71e4e8f8a8007b208c7354a5e0e27940a28190f0bb9f7eb630d8a9e36ff28cc83f9168ab1c4661513ca40eefa05a84d2a7bb7d6085e87d12e1119b9c55094f23
data/.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'tutter-sppuppet'
4
- s.version = '0.0.2'
4
+ s.version = '0.0.3'
5
5
  s.author = 'Johan Haals'
6
6
  s.email = ['johan.haals@gmail.com']
7
7
  s.homepage = 'https://github.com/jhaals/tutter-sppuppet'
@@ -13,4 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = ['lib']
14
14
 
15
15
  s.required_ruby_version = '>= 1.8.7'
16
+
17
+ s.add_runtime_dependency 'tutter'
16
18
  end
@@ -1,11 +1,11 @@
1
1
  class Sppuppet
2
2
 
3
- def initialize(settings, client, project, data)
3
+ def initialize(settings, client, project, data, event)
4
4
  @settings = settings
5
5
  @client = client
6
6
  @project = project
7
7
  @data = data
8
- @debug = settings['debug'] unless settings['debug'].nil?
8
+ @event = event
9
9
  end
10
10
 
11
11
  def debug(message)
@@ -14,24 +14,21 @@ class Sppuppet
14
14
 
15
15
  def run
16
16
  pull_request_id = @data['issue']['number']
17
- debug "pull request id: #{pull_request_id}"
18
17
  pr = @client.pull_request @project, pull_request_id
19
18
  plus_one = {}
20
19
  merge = false
21
20
 
22
21
  if pr.mergeable_state != 'clean'
23
- debug "merge state for #{@project} #{pull_request_id} is not clean. Current state: #{pr.mergeable_state}"
24
- return false
22
+ return 200, "merge state for #{@project} #{pull_request_id} is not clean. Current state: #{pr.mergeable_state}"
25
23
  end
26
24
 
27
25
  # No comments, no need to go further.
28
26
  if pr.comments == 0
29
- debug 'no comments, skipping'
30
- return false
27
+ return 200, 'no comments, skipping'
31
28
  end
32
29
 
33
30
  # Don't care about code we can't merge
34
- return false unless pr.mergeable
31
+ return 200, 'merge state not clean' unless pr.mergeable
35
32
 
36
33
  # We fetch the latest commit and it's date.
37
34
  last_commit = @client.pull_request_commits(@project, pull_request_id).last
@@ -55,16 +52,19 @@ class Sppuppet
55
52
  # TODO it should calculate the +1's - the -1's
56
53
  # Never merge if someone says -1
57
54
  if /^(\-1|:\-1:)/.match i.body
58
- debug "#{@project} #{pull_request_id} has a -1. I will not take the blame"
59
- return false
55
+ return 200, "#{@project} #{pull_request_id} has a -1. I will not take the blame"
60
56
  end
61
57
  end
62
58
 
63
59
  merge = true if comments.last.body == '!merge'
64
60
 
65
61
  if plus_one.count >= @settings['plus_ones_required'] and merge
66
- debug "merging #{pull_request_id} #{@project}"
67
62
  @client.merge_pull_request(@project, pull_request_id, 'SHIPPING!!')
63
+ return 200, "merging #{pull_request_id} #{@project}"
64
+ elsif plus_one.count >= @settings['plus_ones_required']
65
+ return 200, "have enough +1, but no merge command"
66
+ else
67
+ return 200, "not enough +1, have #{plus_one.count} but need #{@settings['plus_ones_required']}"
68
68
  end
69
69
  end
70
70
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tutter-sppuppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Haals
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tutter
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: This tutter action let non collaborators review and merge code without
14
28
  having more then read access to the project
15
29
  email:
@@ -18,7 +32,7 @@ executables: []
18
32
  extensions: []
19
33
  extra_rdoc_files: []
20
34
  files:
21
- - .gemspec
35
+ - ".gemspec"
22
36
  - README.md
23
37
  - lib/tutter/action/sppuppet.rb
24
38
  homepage: https://github.com/jhaals/tutter-sppuppet
@@ -31,19 +45,18 @@ require_paths:
31
45
  - lib
32
46
  required_ruby_version: !ruby/object:Gem::Requirement
33
47
  requirements:
34
- - - '>='
48
+ - - ">="
35
49
  - !ruby/object:Gem::Version
36
50
  version: 1.8.7
37
51
  required_rubygems_version: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - '>='
53
+ - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
42
56
  requirements: []
43
57
  rubyforge_project:
44
- rubygems_version: 2.0.3
58
+ rubygems_version: 2.2.2
45
59
  signing_key:
46
60
  specification_version: 4
47
61
  summary: Github code review without collaborator access
48
62
  test_files: []
49
- has_rdoc: