relevance-github_hook 0.5.0 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG ADDED
@@ -0,0 +1,7 @@
1
+ v0.0.6. Update for latest Github json spec
2
+
3
+ v0.5.8. Prep for release
4
+
5
+ v0.5.0. Initial public release
6
+
7
+ v0.0.1. Internal release
data/Manifest CHANGED
@@ -1,7 +1,8 @@
1
+ CHANGELOG
1
2
  github_hook.gemspec
2
- History.txt
3
3
  lib/github_hook.rb
4
4
  Manifest
5
+ Rakefile
5
6
  README.txt
6
7
  spec/github_hook_spec.rb
7
8
  spec/helper.rb
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'echoe'
3
+ require './lib/github_hook.rb'
4
+
5
+ Echoe.new('github_hook', GithubHook::VERSION) do |p|
6
+ p.rubyforge_name = 'thinkrelevance'
7
+ p.author = 'Rob Sanheim'
8
+ p.email = 'opensource@thinkrelevance.com'
9
+ p.summary = "Wrapper around the github post receive JSON payload."
10
+ p.url = "http://opensource.thinkrelevance.com/wiki/github_hook"
11
+ p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|CHANGELOG|MIT-LICENSE$/
12
+ rdoc_template = `allison --path`.strip << ".rb"
13
+ p.rdoc_template = rdoc_template
14
+ p.test_pattern = 'spec/**/*_spec.rb'
15
+ end
data/github_hook.gemspec CHANGED
@@ -1,45 +1,33 @@
1
-
2
- # Gem::Specification for Github_hook-0.5.0
3
- # Originally generated by Echoe
4
-
5
1
  Gem::Specification.new do |s|
6
2
  s.name = %q{github_hook}
7
- s.version = "0.5.0"
8
-
9
- s.specification_version = 2 if s.respond_to? :specification_version=
3
+ s.version = "0.5.8"
10
4
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ s.required_rubygems_version = Gem::Requirement.new("= 1.2") if s.respond_to? :required_rubygems_version=
12
6
  s.authors = ["Rob Sanheim"]
13
- s.date = %q{2008-05-09}
7
+ s.date = %q{2008-07-30}
14
8
  s.description = %q{Wrapper around the github post receive JSON payload.}
15
9
  s.email = %q{opensource@thinkrelevance.com}
16
- s.extra_rdoc_files = ["History.txt", "lib/github_hook.rb", "README.txt"]
17
- s.files = ["History.txt", "lib/github_hook.rb", "Manifest", "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", "github_hook.gemspec"]
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"]
18
12
  s.has_rdoc = true
19
13
  s.homepage = %q{http://opensource.thinkrelevance.com/wiki/github_hook}
20
14
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Github_hook", "--main", "README.txt"]
21
15
  s.require_paths = ["lib"]
22
16
  s.rubyforge_project = %q{thinkrelevance}
23
- s.rubygems_version = %q{1.1.1}
17
+ s.rubygems_version = %q{1.2.0}
24
18
  s.summary = %q{Wrapper around the github post receive JSON payload.}
25
19
  s.test_files = ["spec/github_hook_spec.rb"]
26
- end
27
20
 
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 2
28
24
 
29
- # # Original Rakefile source (requires the Echoe gem):
30
- #
31
- # require 'rubygems'
32
- # require 'echoe'
33
- # require './lib/github_hook.rb'
34
- #
35
- # Echoe.new('github_hook', GithubHook::VERSION) do |p|
36
- # p.rubyforge_name = 'thinkrelevance'
37
- # p.author = 'Rob Sanheim'
38
- # p.email = 'opensource@thinkrelevance.com'
39
- # p.summary = "Wrapper around the github post receive JSON payload."
40
- # p.url = "http://opensource.thinkrelevance.com/wiki/github_hook"
41
- # p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc|CHANGELOG|MIT-LICENSE$/
42
- # rdoc_template = `allison --path`.strip << ".rb"
43
- # p.rdoc_template = rdoc_template
44
- # p.test_pattern = 'spec/**/*_spec.rb'
45
- # end
25
+ if current_version >= 3 then
26
+ s.add_development_dependency(%q<echoe>, [">= 0"])
27
+ else
28
+ s.add_dependency(%q<echoe>, [">= 0"])
29
+ end
30
+ else
31
+ s.add_dependency(%q<echoe>, [">= 0"])
32
+ end
33
+ end
data/lib/github_hook.rb CHANGED
@@ -2,7 +2,7 @@ require 'json'
2
2
  require 'ostruct'
3
3
 
4
4
  class GithubHook
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.8'
6
6
  attr_reader :before, :after, :ref, :repository, :owner, :commits
7
7
 
8
8
  def initialize(json)
@@ -10,11 +10,17 @@ class GithubHook
10
10
  @before, @after, @ref = payload["before"], payload["after"], payload["ref"]
11
11
  @repository = OpenStruct.new(payload["repository"])
12
12
  @owner = OpenStruct.new(payload["repository"]["owner"])
13
- @commits = {}
14
- payload["commits"].each do |sha1, commit|
15
- commit = OpenStruct.new(commit)
16
- commit.author = OpenStruct.new(commit.author)
17
- commits[sha1] = commit
13
+ @commits = payload['commits'].map do |hash|
14
+ commit_ostruct = OpenStruct.new(hash)
15
+ commit_ostruct.sha = hash["id"]
16
+ commit_ostruct.author = OpenStruct.new(hash["author"])
17
+ commit_ostruct
18
18
  end
19
19
  end
20
+
21
+ # just the most recent commit
22
+ def last_commit
23
+ @commits.first
24
+ end
25
+
20
26
  end
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), *%w[helper])
2
2
 
3
3
  describe GithubHook do
4
- before { @pc = GithubHook.new(Payload)}
4
+ before { @pc = GithubHook.new(PayloadAfterJuly30)}
5
5
 
6
6
  it "should have repo" do
7
7
  repository = @pc.repository
@@ -17,31 +17,35 @@ describe GithubHook do
17
17
  @pc.before.should == "5aef35982fb2d34e9d9d4502f6ede1072793222d"
18
18
  @pc.after.should == "de8251ff97ee194a289832576287d6f8ad74e3d0"
19
19
  end
20
-
20
+
21
21
  it "has owner" do
22
22
  owner = @pc.owner
23
23
  owner.email.should == "chris@ozmm.org"
24
24
  owner.name.should == "defunkt"
25
25
  end
26
-
27
- it "has a hash for commits keyed on sha1" do
26
+
27
+ it "has an array of commit objects" do
28
28
  commits = @pc.commits
29
- commits.keys[0].should == "de8251ff97ee194a289832576287d6f8ad74e3d0"
30
- commits.keys[1].should == "41a212ee83ca127e3c8cf465891ab7216a705f59"
29
+ commits[0].sha.should == "41a212ee83ca127e3c8cf465891ab7216a705f59"
30
+ commits[1].sha.should == "de8251ff97ee194a289832576287d6f8ad74e3d0"
31
31
  end
32
-
32
+
33
33
  it "has commit values" do
34
- commit = @pc.commits["de8251ff97ee194a289832576287d6f8ad74e3d0"]
35
- commit.url.should == "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0"
36
- commit.message.should == "update pricing a tad"
37
- commit.timestamp.should == "2008-02-15T14:36:34-08:00"
34
+ commit = @pc.commits.first
35
+ commit.url.should == "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59"
36
+ commit.message.should == "okay i give in"
37
+ commit.timestamp.should == "2008-02-15T14:57:17-08:00"
38
38
  end
39
-
39
+
40
40
  it "has commit author" do
41
- author = @pc.commits["de8251ff97ee194a289832576287d6f8ad74e3d0"].author
41
+ author = @pc.commits.first.author
42
42
  author.name.should == "Chris Wanstrath"
43
43
  author.email.should == "chris@ozmm.org"
44
44
  end
45
-
45
+
46
+ it "has last commit" do
47
+ @pc.last_commit.should == @pc.commits.first
48
+ end
49
+
46
50
  end
47
51
 
data/spec/payload.rb CHANGED
@@ -1,4 +1,4 @@
1
- Payload = <<-EOL
1
+ PayloadBeforeJuly30 = <<-EOL
2
2
  {
3
3
  "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
4
4
  "repository": {
@@ -32,4 +32,43 @@ Payload = <<-EOL
32
32
  "after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
33
33
  "ref": "refs/heads/master"
34
34
  }
35
+ EOL
36
+
37
+ PayloadAfterJuly30 = <<-EOL
38
+ {
39
+ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
40
+ "repository": {
41
+ "url": "http://github.com/defunkt/github",
42
+ "name": "github",
43
+ "owner": {
44
+ "email": "chris@ozmm.org",
45
+ "name": "defunkt"
46
+ }
47
+ },
48
+ "commits": [
49
+ {
50
+ "id": "41a212ee83ca127e3c8cf465891ab7216a705f59",
51
+ "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
52
+ "author": {
53
+ "email": "chris@ozmm.org",
54
+ "name": "Chris Wanstrath"
55
+ },
56
+ "message": "okay i give in",
57
+ "timestamp": "2008-02-15T14:57:17-08:00",
58
+ "added": ["filepath.rb"]
59
+ },
60
+ {
61
+ "id": "de8251ff97ee194a289832576287d6f8ad74e3d0",
62
+ "url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
63
+ "author": {
64
+ "email": "chris@ozmm.org",
65
+ "name": "Chris Wanstrath"
66
+ },
67
+ "message": "update pricing a tad",
68
+ "timestamp": "2008-02-15T14:36:34-08:00"
69
+ }
70
+ ],
71
+ "after": "de8251ff97ee194a289832576287d6f8ad74e3d0",
72
+ "ref": "refs/heads/master"
73
+ }
35
74
  EOL
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.5.0
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim
@@ -9,10 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-09 00:00:00 -07:00
12
+ date: 2008-07-30 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: echoe
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
16
24
  description: Wrapper around the github post receive JSON payload.
17
25
  email: opensource@thinkrelevance.com
18
26
  executables: []
@@ -20,13 +28,15 @@ executables: []
20
28
  extensions: []
21
29
 
22
30
  extra_rdoc_files:
23
- - History.txt
31
+ - CHANGELOG
24
32
  - lib/github_hook.rb
25
33
  - README.txt
26
34
  files:
27
- - History.txt
35
+ - CHANGELOG
36
+ - github_hook.gemspec
28
37
  - lib/github_hook.rb
29
38
  - Manifest
39
+ - Rakefile
30
40
  - README.txt
31
41
  - spec/github_hook_spec.rb
32
42
  - spec/helper.rb
@@ -38,7 +48,6 @@ files:
38
48
  - spec/vendor/bacon-0.9.0/RDOX
39
49
  - spec/vendor/bacon-0.9.0/README
40
50
  - spec/vendor/bacon-0.9.0/test/spec_bacon.rb
41
- - github_hook.gemspec
42
51
  has_rdoc: true
43
52
  homepage: http://opensource.thinkrelevance.com/wiki/github_hook
44
53
  post_install_message:
@@ -59,14 +68,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
68
  version:
60
69
  required_rubygems_version: !ruby/object:Gem::Requirement
61
70
  requirements:
62
- - - ">="
71
+ - - "="
63
72
  - !ruby/object:Gem::Version
64
- version: "0"
73
+ version: "1.2"
65
74
  version:
66
75
  requirements: []
67
76
 
68
77
  rubyforge_project: thinkrelevance
69
- rubygems_version: 1.0.1
78
+ rubygems_version: 1.2.0
70
79
  signing_key:
71
80
  specification_version: 2
72
81
  summary: Wrapper around the github post receive JSON payload.
data/History.txt DELETED
@@ -1,3 +0,0 @@
1
- === 1.0.0 / 2008-04-25
2
-
3
- * Initial release