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.
- checksums.yaml +4 -4
- data/.gemspec +3 -1
- data/lib/tutter/action/sppuppet.rb +11 -11
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c4746d2776652a1a3312a5c400938c2ada7e747
|
4
|
+
data.tar.gz: 9bb20eb13de1803246a25ab8cf19d122cf96ee9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
@
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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.
|
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:
|
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.
|
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:
|