relevance-github_hook 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README.txt +2 -2
- data/Rakefile +0 -1
- data/github_hook.gemspec +4 -7
- data/lib/github_hook.rb +4 -4
- data/spec/github_hook_functional_spec.rb +15 -0
- data/spec/github_hook_spec.rb +9 -6
- data/spec/payload.rb +19 -23
- metadata +4 -11
data/CHANGELOG
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
v0.7.0. Switch to using ActiveSupport JSON instead of the JSON gem. The JSON gem would not play nice with ActiveSupport's to_json within Rails projects, so the JSON gem had to go. This means timestamps are returned as real Time objects instead of strings.
|
2
|
+
|
1
3
|
v0.6.2. Capture private flag and parse it to boolean from string
|
2
4
|
|
3
5
|
v0.6.0. Update for latest Github json spec; maintain backwards compatibility to avoid breaking stuff
|
data/README.txt
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
== FEATURES/PROBLEMS:
|
8
8
|
|
9
|
-
* Provides a simple object wrapper around the post
|
9
|
+
* Provides a simple object wrapper around the post receive hook that Github provides. For more details on Github's post receive hooks, see http://github.com/guides/post-receive-hooks.
|
10
10
|
|
11
11
|
== SYNOPSIS:
|
12
12
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
== REQUIREMENTS:
|
16
16
|
|
17
|
-
*
|
17
|
+
* activesupport
|
18
18
|
|
19
19
|
== INSTALL:
|
20
20
|
|
data/Rakefile
CHANGED
data/github_hook.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{github_hook}
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.7.0"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new("= 1.2") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Rob Sanheim"]
|
7
|
-
s.date = %q{2008-09-
|
7
|
+
s.date = %q{2008-09-11}
|
8
8
|
s.description = %q{Wrapper around the github post receive JSON payload.}
|
9
9
|
s.email = %q{opensource@thinkrelevance.com}
|
10
10
|
s.extra_rdoc_files = ["CHANGELOG", "lib/github_hook.rb", "README.txt"]
|
11
|
-
s.files = ["CHANGELOG", "github_hook.gemspec", "lib/github_hook.rb", "Manifest", "Rakefile", "README.txt", "spec/github_hook_spec.rb", "spec/helper.rb", "spec/payload.rb", "spec/vendor/bacon-0.9.0/bin/bacon", "spec/vendor/bacon-0.9.0/COPYING", "spec/vendor/bacon-0.9.0/lib/bacon.rb", "spec/vendor/bacon-0.9.0/Rakefile", "spec/vendor/bacon-0.9.0/RDOX", "spec/vendor/bacon-0.9.0/README", "spec/vendor/bacon-0.9.0/test/spec_bacon.rb"]
|
11
|
+
s.files = ["CHANGELOG", "github_hook.gemspec", "lib/github_hook.rb", "Manifest", "Rakefile", "README.txt", "spec/github_hook_spec.rb", "spec/helper.rb", "spec/payload.rb", "spec/vendor/bacon-0.9.0/bin/bacon", "spec/vendor/bacon-0.9.0/COPYING", "spec/vendor/bacon-0.9.0/lib/bacon.rb", "spec/vendor/bacon-0.9.0/Rakefile", "spec/vendor/bacon-0.9.0/RDOX", "spec/vendor/bacon-0.9.0/README", "spec/vendor/bacon-0.9.0/test/spec_bacon.rb", "spec/github_hook_functional_spec.rb"]
|
12
12
|
s.has_rdoc = true
|
13
13
|
s.homepage = %q{http://opensource.thinkrelevance.com/wiki/github_hook}
|
14
14
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Github_hook", "--main", "README.txt"]
|
@@ -16,21 +16,18 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rubyforge_project = %q{thinkrelevance}
|
17
17
|
s.rubygems_version = %q{1.2.0}
|
18
18
|
s.summary = %q{Wrapper around the github post receive JSON payload.}
|
19
|
-
s.test_files = ["spec/github_hook_spec.rb"]
|
19
|
+
s.test_files = ["spec/github_hook_functional_spec.rb", "spec/github_hook_spec.rb"]
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
22
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
23
|
s.specification_version = 2
|
24
24
|
|
25
25
|
if current_version >= 3 then
|
26
|
-
s.add_runtime_dependency(%q<json>, [">= 0"])
|
27
26
|
s.add_development_dependency(%q<echoe>, [">= 0"])
|
28
27
|
else
|
29
|
-
s.add_dependency(%q<json>, [">= 0"])
|
30
28
|
s.add_dependency(%q<echoe>, [">= 0"])
|
31
29
|
end
|
32
30
|
else
|
33
|
-
s.add_dependency(%q<json>, [">= 0"])
|
34
31
|
s.add_dependency(%q<echoe>, [">= 0"])
|
35
32
|
end
|
36
33
|
end
|
data/lib/github_hook.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'activesupport'
|
3
3
|
require 'ostruct'
|
4
4
|
|
5
5
|
class GithubHook
|
6
|
-
VERSION = '0.
|
6
|
+
VERSION = '0.7.0'
|
7
7
|
attr_reader :before, :after, :ref, :repository, :owner, :commits
|
8
8
|
|
9
9
|
def initialize(json)
|
10
|
-
payload = JSON.
|
10
|
+
payload = ActiveSupport::JSON.decode(json)
|
11
11
|
@before, @after, @ref = payload["before"], payload["after"], payload["ref"]
|
12
12
|
@repository = OpenStruct.new(payload["repository"])
|
13
13
|
@repository.private = parse_private_flag(@repository.private)
|
@@ -16,7 +16,7 @@ class GithubHook
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def parse_private_flag(private_flag)
|
19
|
-
private_flag == "true" ? true : false
|
19
|
+
private_flag.to_s == "true" ? true : false
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_commits(payload)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[helper])
|
2
|
+
|
3
|
+
describe GithubHook do
|
4
|
+
|
5
|
+
before { @pc = GithubHook.new(FiveRunsPayLoad)}
|
6
|
+
|
7
|
+
it "has commits" do
|
8
|
+
@pc.commits.should.not.be.empty
|
9
|
+
@pc.commits[0].sha.should == "bb7aebb382539bbd3e7a6118fc37438730c9ade5"
|
10
|
+
@pc.commits[0].message.should == "Note that the echoe gem is required to use the Rakefile."
|
11
|
+
@pc.commits[1].sha.should == "093560ad918d58f3864507f19462fd7c04f34eac"
|
12
|
+
@pc.commits[1].message.should == "Ignore the generated packages."
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/spec/github_hook_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe GithubHook do
|
|
15
15
|
commit = @pc.commits.first
|
16
16
|
commit.url.should == "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0"
|
17
17
|
commit.message.should == "update pricing a tad"
|
18
|
-
commit.timestamp.should == "2008-02-15T14:36:34-08:00"
|
18
|
+
commit.timestamp.should == Time.parse("2008-02-15T14:36:34-08:00")
|
19
19
|
end
|
20
20
|
|
21
21
|
it "has commit author" do
|
@@ -67,7 +67,7 @@ describe GithubHook do
|
|
67
67
|
commit = @pc.commits.first
|
68
68
|
commit.url.should == "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59"
|
69
69
|
commit.message.should == "okay i give in"
|
70
|
-
commit.timestamp.should == "2008-02-15T14:57:17-08:00"
|
70
|
+
commit.timestamp.should == Time.parse("2008-02-15T14:57:17-08:00")
|
71
71
|
end
|
72
72
|
|
73
73
|
it "has commit author" do
|
@@ -83,15 +83,18 @@ describe GithubHook do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
describe "private project" do
|
86
|
-
before { @pc = GithubHook.new(PrivateProject)}
|
87
86
|
|
88
|
-
it "is private if private flag is
|
87
|
+
it "is private if private flag is string true" do
|
88
|
+
@pc = GithubHook.new(PrivateProjectWithStringTrue)
|
89
89
|
@pc.repository.private.should == true
|
90
90
|
end
|
91
91
|
|
92
|
+
it "is private if private flag is literal true" do
|
93
|
+
@pc = GithubHook.new(PrivateProjectWithLiteralTrue)
|
94
|
+
@pc.repository.private.should == true
|
95
|
+
end
|
96
|
+
|
92
97
|
end
|
93
|
-
|
94
|
-
|
95
98
|
|
96
99
|
end
|
97
100
|
|
data/spec/payload.rb
CHANGED
@@ -74,7 +74,7 @@ PayloadAfterJuly30 = <<-EOL
|
|
74
74
|
}
|
75
75
|
EOL
|
76
76
|
|
77
|
-
|
77
|
+
PrivateProjectWithStringTrue = <<-EOL
|
78
78
|
{
|
79
79
|
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
|
80
80
|
"repository": {
|
@@ -86,29 +86,25 @@ PrivateProject = <<-EOL
|
|
86
86
|
"name": "defunkt"
|
87
87
|
}
|
88
88
|
},
|
89
|
-
"commits": [
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
"
|
104
|
-
"
|
105
|
-
"email": "chris@ozmm.org",
|
106
|
-
"name": "Chris Wanstrath"
|
107
|
-
},
|
108
|
-
"message": "update pricing a tad",
|
109
|
-
"timestamp": "2008-02-15T14:36:34-08:00"
|
89
|
+
"commits": [],
|
90
|
+
"after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
|
91
|
+
"ref": "refs/heads/master"
|
92
|
+
}
|
93
|
+
EOL
|
94
|
+
|
95
|
+
PrivateProjectWithLiteralTrue = <<-EOL
|
96
|
+
{
|
97
|
+
"before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
|
98
|
+
"repository": {
|
99
|
+
"url": "http://github.com/defunkt/github",
|
100
|
+
"name": "github",
|
101
|
+
"private": true,
|
102
|
+
"owner": {
|
103
|
+
"email": "chris@ozmm.org",
|
104
|
+
"name": "defunkt"
|
110
105
|
}
|
111
|
-
|
106
|
+
},
|
107
|
+
"commits": [],
|
112
108
|
"after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
|
113
109
|
"ref": "refs/heads/master"
|
114
110
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevance-github_hook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -9,18 +9,9 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: json
|
17
|
-
version_requirement:
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: "0"
|
23
|
-
version:
|
24
15
|
- !ruby/object:Gem::Dependency
|
25
16
|
name: echoe
|
26
17
|
version_requirement:
|
@@ -57,6 +48,7 @@ files:
|
|
57
48
|
- spec/vendor/bacon-0.9.0/RDOX
|
58
49
|
- spec/vendor/bacon-0.9.0/README
|
59
50
|
- spec/vendor/bacon-0.9.0/test/spec_bacon.rb
|
51
|
+
- spec/github_hook_functional_spec.rb
|
60
52
|
has_rdoc: true
|
61
53
|
homepage: http://opensource.thinkrelevance.com/wiki/github_hook
|
62
54
|
post_install_message:
|
@@ -89,4 +81,5 @@ signing_key:
|
|
89
81
|
specification_version: 2
|
90
82
|
summary: Wrapper around the github post receive JSON payload.
|
91
83
|
test_files:
|
84
|
+
- spec/github_hook_functional_spec.rb
|
92
85
|
- spec/github_hook_spec.rb
|