tutter-sppuppet 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6d1ab8e26a1410be66395110033e1fbb11747d82
4
- data.tar.gz: 30bfe37515d891861ab8b6d4003cc53c3ce47696
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGM2NDBhOGZmNWI4NTgzZTk5ZDY2MDY2N2UxYTM3Njc1NDA2NTFkYQ==
5
+ data.tar.gz: !binary |-
6
+ NjBjMjBmNWE5ZmJjMDJjZTRlYTE3NjVhMDBlYzc3NTZhOTI2MDhlMw==
5
7
  SHA512:
6
- metadata.gz: 21ffd61b8c3c054cb9152b3f1f525b7369524db635d07f5eae6c1ace9a47e491dab6de7fd89e29efa2ddc92315e2fb09c47b7f2a578f56de782246321471bfd2
7
- data.tar.gz: 48a6176522bbadb736e957fbed09a1f040748da6e4c820d96bbd0d2b033ae070ffe3f6eb6b467a5846c7f80c48c62245cbe63eb7655b696a9b150eeec5ff1727
8
+ metadata.gz: !binary |-
9
+ NzFhZmFmZTYxMmYwMmZiNjQ1MDJkOGUzZjc5MTUyNzdiNDBiZmJlNzE4MTE0
10
+ MTExMzVlMjQyYjg1OThmMzFjOTY5NTJkZWM0MGUzYWVjN2EzOGQ3YzUyMjRm
11
+ MDgxYjk1ZDNiMGQwNWQ0MjE5YzUyMDYzZjEzYjcxMjlkMDBlNmY=
12
+ data.tar.gz: !binary |-
13
+ MzllYzE0MDU5MGFlNjI2NjIxZmJlNTY3ZTE2YTRmNDdlYTAzZDI1MjFkZDQz
14
+ OTczYTc5Y2ZiNWVkMjgxYzk1ZTE3N2YxODMxZGY5MjExOTQ5NzhmYWI4Yjcy
15
+ ZmY2YmI4NTI1MmUxN2M1YmJlZTM1YjY3MmEzMTIwNGJhMmYxMGI=
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ deploy:
2
+ provider: rubygems
3
+ api_key:
4
+ secure: lyrstQ+LJHg2zic7oD1xl/7nDAZIXthKh5l9CEhq1gIBCRMxf/lfsQusKNbWuImy+Mk0ovOeLaMPDRDdK9VRpgW3tReuY3hlJIURioHrZbXDks09Ul/B4dk2mpR3ax67/+5kSeEESMOKU31g6YFfVx8TrUioorqLpmKppwqrGFo=
5
+ gem: tutter-sppuppet
6
+ on:
7
+ tags: true
8
+ repo: jhaals/tutter-sppuppet
9
+ all_branches: true
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'tutter'
4
+
5
+ group :development do
6
+ gem 'sinatra-reloader'
7
+ end
8
+
9
+ group :test do
10
+ gem 'rake'
11
+ gem 'rspec'
12
+ gem 'json'
13
+ end
data/README.md CHANGED
@@ -20,7 +20,8 @@ sppuppet specific settings (goes into tutter.yaml)
20
20
  action: 'sppuppet'
21
21
  action_settings:
22
22
  plus_ones_required: 3
23
- debug: false
23
+ post_instructions: true
24
+ instructions: 'To merge, post 3 +1s and then !merge'
24
25
 
25
26
  ### TODO
26
27
  * whitelist
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task :default => [:spec]
@@ -14,6 +14,22 @@ class Sppuppet
14
14
  end
15
15
 
16
16
  def run
17
+ # If a new pull request is opened, comment with instructions
18
+ if @data['action'] == 'opened' && @settings['post_instructions']
19
+ issue = @data['issue']['number']
20
+ comment = @settings['instructions'] || "To merge at least #{@settings['plus_ones_required']} person other than the submitter needs to write a comment with saying _+1_ or _:+1:_. Then write _!merge_ to trigger the merging."
21
+ begin
22
+ @client.add_comment(@project, issue, comment)
23
+ return 200, "Commented!"
24
+ rescue Octokit::NotFound
25
+ return 404, "Octokit returned 404, this could be an issue with your access token"
26
+ rescue Octokit::Unauthorized
27
+ return 401, "Authorization to #{@project} failed, please verify your access token"
28
+ rescue Octokit::TooManyLoginAttempts
29
+ return 429, "Account for #{@project} has been temporary locked down due to to many failed login attempts"
30
+ end
31
+ end
32
+
17
33
  pull_request_id = @data['issue']['number']
18
34
  pr = @client.pull_request @project, pull_request_id
19
35
  plus_one = {}
@@ -0,0 +1,154 @@
1
+ {
2
+ "action": "opened",
3
+ "issue": {
4
+ "url": "https://api.github.com/repos/JHaals/testing/issues/9",
5
+ "labels_url": "https://api.github.com/repos/JHaals/testing/issues/9/labels{/name}",
6
+ "comments_url": "https://api.github.com/repos/JHaals/testing/issues/9/comments",
7
+ "events_url": "https://api.github.com/repos/JHaals/testing/issues/9/events",
8
+ "html_url": "https://github.com/JHaals/testing/issues/9",
9
+ "id": 28705860,
10
+ "number": 9,
11
+ "title": "the internet is broken",
12
+ "user": {
13
+ "login": "JHaals",
14
+ "id": 68980,
15
+ "avatar_url": "https://avatars.githubusercontent.com/u/68980",
16
+ "gravatar_id": "4e51de553ebfe258f038e040c8b25892",
17
+ "url": "https://api.github.com/users/JHaals",
18
+ "html_url": "https://github.com/JHaals",
19
+ "followers_url": "https://api.github.com/users/JHaals/followers",
20
+ "following_url": "https://api.github.com/users/JHaals/following{/other_user}",
21
+ "gists_url": "https://api.github.com/users/JHaals/gists{/gist_id}",
22
+ "starred_url": "https://api.github.com/users/JHaals/starred{/owner}{/repo}",
23
+ "subscriptions_url": "https://api.github.com/users/JHaals/subscriptions",
24
+ "organizations_url": "https://api.github.com/users/JHaals/orgs",
25
+ "repos_url": "https://api.github.com/users/JHaals/repos",
26
+ "events_url": "https://api.github.com/users/JHaals/events{/privacy}",
27
+ "received_events_url": "https://api.github.com/users/JHaals/received_events",
28
+ "type": "User",
29
+ "site_admin": false
30
+ },
31
+ "labels": [
32
+
33
+ ],
34
+ "state": "open",
35
+ "assignee": null,
36
+ "milestone": null,
37
+ "comments": 0,
38
+ "created_at": "2014-03-04T13:46:06Z",
39
+ "updated_at": "2014-03-04T13:46:06Z",
40
+ "closed_at": null,
41
+ "pull_request": {
42
+ "html_url": null,
43
+ "diff_url": null,
44
+ "patch_url": null
45
+ },
46
+ "body": "what to do?"
47
+ },
48
+ "repository": {
49
+ "id": 16474769,
50
+ "name": "testing",
51
+ "full_name": "JHaals/testing",
52
+ "owner": {
53
+ "login": "JHaals",
54
+ "id": 68980,
55
+ "avatar_url": "https://avatars.githubusercontent.com/u/68980",
56
+ "gravatar_id": "4e51de553ebfe258f038e040c8b25892",
57
+ "url": "https://api.github.com/users/JHaals",
58
+ "html_url": "https://github.com/JHaals",
59
+ "followers_url": "https://api.github.com/users/JHaals/followers",
60
+ "following_url": "https://api.github.com/users/JHaals/following{/other_user}",
61
+ "gists_url": "https://api.github.com/users/JHaals/gists{/gist_id}",
62
+ "starred_url": "https://api.github.com/users/JHaals/starred{/owner}{/repo}",
63
+ "subscriptions_url": "https://api.github.com/users/JHaals/subscriptions",
64
+ "organizations_url": "https://api.github.com/users/JHaals/orgs",
65
+ "repos_url": "https://api.github.com/users/JHaals/repos",
66
+ "events_url": "https://api.github.com/users/JHaals/events{/privacy}",
67
+ "received_events_url": "https://api.github.com/users/JHaals/received_events",
68
+ "type": "User",
69
+ "site_admin": false
70
+ },
71
+ "private": false,
72
+ "html_url": "https://github.com/JHaals/testing",
73
+ "description": "this is just for personal tests",
74
+ "fork": false,
75
+ "url": "https://api.github.com/repos/JHaals/testing",
76
+ "forks_url": "https://api.github.com/repos/JHaals/testing/forks",
77
+ "keys_url": "https://api.github.com/repos/JHaals/testing/keys{/key_id}",
78
+ "collaborators_url": "https://api.github.com/repos/JHaals/testing/collaborators{/collaborator}",
79
+ "teams_url": "https://api.github.com/repos/JHaals/testing/teams",
80
+ "hooks_url": "https://api.github.com/repos/JHaals/testing/hooks",
81
+ "issue_events_url": "https://api.github.com/repos/JHaals/testing/issues/events{/number}",
82
+ "events_url": "https://api.github.com/repos/JHaals/testing/events",
83
+ "assignees_url": "https://api.github.com/repos/JHaals/testing/assignees{/user}",
84
+ "branches_url": "https://api.github.com/repos/JHaals/testing/branches{/branch}",
85
+ "tags_url": "https://api.github.com/repos/JHaals/testing/tags",
86
+ "blobs_url": "https://api.github.com/repos/JHaals/testing/git/blobs{/sha}",
87
+ "git_tags_url": "https://api.github.com/repos/JHaals/testing/git/tags{/sha}",
88
+ "git_refs_url": "https://api.github.com/repos/JHaals/testing/git/refs{/sha}",
89
+ "trees_url": "https://api.github.com/repos/JHaals/testing/git/trees{/sha}",
90
+ "statuses_url": "https://api.github.com/repos/JHaals/testing/statuses/{sha}",
91
+ "languages_url": "https://api.github.com/repos/JHaals/testing/languages",
92
+ "stargazers_url": "https://api.github.com/repos/JHaals/testing/stargazers",
93
+ "contributors_url": "https://api.github.com/repos/JHaals/testing/contributors",
94
+ "subscribers_url": "https://api.github.com/repos/JHaals/testing/subscribers",
95
+ "subscription_url": "https://api.github.com/repos/JHaals/testing/subscription",
96
+ "commits_url": "https://api.github.com/repos/JHaals/testing/commits{/sha}",
97
+ "git_commits_url": "https://api.github.com/repos/JHaals/testing/git/commits{/sha}",
98
+ "comments_url": "https://api.github.com/repos/JHaals/testing/comments{/number}",
99
+ "issue_comment_url": "https://api.github.com/repos/JHaals/testing/issues/comments/{number}",
100
+ "contents_url": "https://api.github.com/repos/JHaals/testing/contents/{+path}",
101
+ "compare_url": "https://api.github.com/repos/JHaals/testing/compare/{base}...{head}",
102
+ "merges_url": "https://api.github.com/repos/JHaals/testing/merges",
103
+ "archive_url": "https://api.github.com/repos/JHaals/testing/{archive_format}{/ref}",
104
+ "downloads_url": "https://api.github.com/repos/JHaals/testing/downloads",
105
+ "issues_url": "https://api.github.com/repos/JHaals/testing/issues{/number}",
106
+ "pulls_url": "https://api.github.com/repos/JHaals/testing/pulls{/number}",
107
+ "milestones_url": "https://api.github.com/repos/JHaals/testing/milestones{/number}",
108
+ "notifications_url": "https://api.github.com/repos/JHaals/testing/notifications{?since,all,participating}",
109
+ "labels_url": "https://api.github.com/repos/JHaals/testing/labels{/name}",
110
+ "releases_url": "https://api.github.com/repos/JHaals/testing/releases{/id}",
111
+ "created_at": "2014-02-03T09:25:47Z",
112
+ "updated_at": "2014-02-16T20:25:07Z",
113
+ "pushed_at": "2014-02-16T20:25:06Z",
114
+ "git_url": "git://github.com/JHaals/testing.git",
115
+ "ssh_url": "git@github.com:JHaals/testing.git",
116
+ "clone_url": "https://github.com/JHaals/testing.git",
117
+ "svn_url": "https://github.com/JHaals/testing",
118
+ "homepage": null,
119
+ "size": 312,
120
+ "stargazers_count": 0,
121
+ "watchers_count": 0,
122
+ "language": null,
123
+ "has_issues": true,
124
+ "has_downloads": true,
125
+ "has_wiki": true,
126
+ "forks_count": 0,
127
+ "mirror_url": null,
128
+ "open_issues_count": 5,
129
+ "forks": 0,
130
+ "open_issues": 5,
131
+ "watchers": 0,
132
+ "default_branch": "master",
133
+ "master_branch": "master"
134
+ },
135
+ "sender": {
136
+ "login": "JHaals",
137
+ "id": 68980,
138
+ "avatar_url": "https://avatars.githubusercontent.com/u/68980",
139
+ "gravatar_id": "4e51de553ebfe258f038e040c8b25892",
140
+ "url": "https://api.github.com/users/JHaals",
141
+ "html_url": "https://github.com/JHaals",
142
+ "followers_url": "https://api.github.com/users/JHaals/followers",
143
+ "following_url": "https://api.github.com/users/JHaals/following{/other_user}",
144
+ "gists_url": "https://api.github.com/users/JHaals/gists{/gist_id}",
145
+ "starred_url": "https://api.github.com/users/JHaals/starred{/owner}{/repo}",
146
+ "subscriptions_url": "https://api.github.com/users/JHaals/subscriptions",
147
+ "organizations_url": "https://api.github.com/users/JHaals/orgs",
148
+ "repos_url": "https://api.github.com/users/JHaals/repos",
149
+ "events_url": "https://api.github.com/users/JHaals/events{/privacy}",
150
+ "received_events_url": "https://api.github.com/users/JHaals/received_events",
151
+ "type": "User",
152
+ "site_admin": false
153
+ }
154
+ }
@@ -0,0 +1,10 @@
1
+ projects:
2
+ - name: 'JHaals/testing'
3
+ access_token: ''
4
+ github_site: 'https://github.com'
5
+ github_api_endpoint: 'https://api.github.com'
6
+
7
+ action: 'sppuppet'
8
+ action_settings:
9
+ post_instructions: true
10
+ plus_ones_required: 3
@@ -0,0 +1,16 @@
1
+ ENV['TUTTER_CONFIG_PATH'] = 'spec/fixtures/tutter.yaml'
2
+ require 'tutter'
3
+ require 'sinatra'
4
+ require 'rack/test'
5
+ Tutter.environment = :development
6
+ set :run, false
7
+ set :raise_errors, true
8
+ set :logging, true
9
+
10
+ def app
11
+ Tutter
12
+ end
13
+
14
+ RSpec.configure do |config|
15
+ config.include Rack::Test::Methods
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ describe 'tutter Sppuppet action' do
5
+ it 'should post a comment with instructions' do
6
+ data = IO.read('spec/fixtures/new_issue.json')
7
+ post '/', data, 'HTTP_X_GITHUB_EVENT' => 'opened'
8
+ expect { last_response.body match(/To merge at least/) }
9
+ expect { last_response.status == 200 }
10
+ end
11
+ end
@@ -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'
4
+ s.version = '0.0.6'
5
5
  s.author = 'Johan Haals'
6
6
  s.email = ['johan.haals@gmail.com']
7
7
  s.homepage = 'https://github.com/jhaals/tutter-sppuppet'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tutter-sppuppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Haals
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tutter
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description: This tutter action let non collaborators review and merge code without
@@ -32,9 +32,16 @@ executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - ".gemspec"
35
+ - .travis.yml
36
+ - Gemfile
36
37
  - README.md
38
+ - Rakefile
37
39
  - lib/tutter/action/sppuppet.rb
40
+ - spec/fixtures/new_issue.json
41
+ - spec/fixtures/tutter.yaml
42
+ - spec/spec_helper.rb
43
+ - spec/unit/tutter/action/sppuppet_spec.rb
44
+ - tutter-sppuppet.gemspec
38
45
  homepage: https://github.com/jhaals/tutter-sppuppet
39
46
  licenses:
40
47
  - Apache 2.0
@@ -45,17 +52,17 @@ require_paths:
45
52
  - lib
46
53
  required_ruby_version: !ruby/object:Gem::Requirement
47
54
  requirements:
48
- - - ">="
55
+ - - ! '>='
49
56
  - !ruby/object:Gem::Version
50
57
  version: 1.8.7
51
58
  required_rubygems_version: !ruby/object:Gem::Requirement
52
59
  requirements:
53
- - - ">="
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  requirements: []
57
64
  rubyforge_project:
58
- rubygems_version: 2.2.2
65
+ rubygems_version: 2.4.5
59
66
  signing_key:
60
67
  specification_version: 4
61
68
  summary: Github code review without collaborator access