Permalink
Browse files

use active support JSON instead of JSON gem; version 0.7.0 release

  • Loading branch information...
1 parent 3be8a6a commit f6920163898d4a988adc5c4d0928a5f0c3271125 @rsanheim rsanheim committed Sep 11, 2008
Showing with 9 additions and 8 deletions.
  1. +2 −0 CHANGELOG
  2. +2 −2 README.txt
  3. +0 −1 Rakefile
  4. +3 −3 lib/github_hook.rb
  5. +2 −2 spec/github_hook_spec.rb
View
@@ -1,3 +1,5 @@
+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.
+
v0.6.2. Capture private flag and parse it to boolean from string
v0.6.0. Update for latest Github json spec; maintain backwards compatibility to avoid breaking stuff
View
@@ -6,15 +6,15 @@
== FEATURES/PROBLEMS:
-* Provides a simple object wrapper around the post recieve hook that Github provides. For more details on Github's post recieve hooks, see http://github.com/guides/post-receive-hooks.
+* 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.
== SYNOPSIS:
FIX (code sample of usage)
== REQUIREMENTS:
-* json rubygem
+* activesupport
== INSTALL:
View
@@ -12,5 +12,4 @@ Echoe.new('github_hook', GithubHook::VERSION) do |p|
rdoc_template = `allison --path`.strip << ".rb"
p.rdoc_template = rdoc_template
p.test_pattern = 'spec/**/*_spec.rb'
- p.dependencies = "json"
end
View
@@ -1,13 +1,13 @@
require 'rubygems'
-require 'json'
+require 'activesupport'
require 'ostruct'
class GithubHook
- VERSION = '0.6.4'
+ VERSION = '0.7.0'
attr_reader :before, :after, :ref, :repository, :owner, :commits
def initialize(json)
- payload = JSON.parse(json)
+ payload = ActiveSupport::JSON.decode(json)
@before, @after, @ref = payload["before"], payload["after"], payload["ref"]
@repository = OpenStruct.new(payload["repository"])
@repository.private = parse_private_flag(@repository.private)
View
@@ -15,7 +15,7 @@
commit = @pc.commits.first
commit.url.should == "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0"
commit.message.should == "update pricing a tad"
- commit.timestamp.should == "2008-02-15T14:36:34-08:00"
+ commit.timestamp.should == Time.parse("2008-02-15T14:36:34-08:00")
end
it "has commit author" do
@@ -67,7 +67,7 @@
commit = @pc.commits.first
commit.url.should == "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59"
commit.message.should == "okay i give in"
- commit.timestamp.should == "2008-02-15T14:57:17-08:00"
+ commit.timestamp.should == Time.parse("2008-02-15T14:57:17-08:00")
end
it "has commit author" do

0 comments on commit f692016

Please sign in to comment.