Skip to content

Commit

Permalink
use active support JSON instead of JSON gem; version 0.7.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rsanheim committed Sep 11, 2008
1 parent 3be8a6a commit f692016
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.txt
Expand Up @@ -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:

Expand Down
1 change: 0 additions & 1 deletion Rakefile
Expand Up @@ -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
6 changes: 3 additions & 3 deletions lib/github_hook.rb
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions spec/github_hook_spec.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f692016

Please sign in to comment.