Skip to content

Commit

Permalink
reviewed all files. updated name to le git. updated README to include…
Browse files Browse the repository at this point in the history
… laundry list of needed gems. got tests running (but failing).
  • Loading branch information
Dan Croak committed May 26, 2009
1 parent 0f4ea3c commit edbfb10
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 102 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
tags
pkg
*.swp
*.swo
.DS_Store
37 changes: 0 additions & 37 deletions README.markdown

This file was deleted.

25 changes: 25 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
h1. Le Git

bq. French for "Ruby wrapper around the Github API (v2)".

Le Git provides a Ruby wrapper around the "The GitHub API":http://github.com/guides/the-github-api using "rest-client":http://rdoc.info/projects/adamwiggins/rest-client and "happymapper":http://rdoc.info/projects/jnunemaker/happymapper.

h2. Example usage

require 'rubygems'
require 'le_git'

commits = GitHub::Commit.find "caged", "gitnub", :all

commit = GitHub::Commit.find "defunkt", "github-gem", "c26d4ce9807ecf57d3f9eefe19ae64e75bcaaa8b"

repositories = GitHub::Repository.search "merb"

user = GitHub::User.find "defunkt"

h2. Maintainers

Running the test suite requires:

sudo gem install happymapper fakeweb rcov jeremymcanally-context jeremymcanally-matchy jeremymcanally-pending thoughtbot-quietbacktrace redgreen

12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ require 'rcov/rcovtask'
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "github-party"
s.summary = "TODO"
s.email = "josh@technicalpickles.com"
s.homepage = "http://github.com/technicalpickles/github-party/tree"
s.name = "le-git"
s.summary = "TODO"
s.email = "josh@technicalpickles.com"
s.homepage = "http://github.com/dancroak/le-git"
s.description = "TODO"
s.authors = ["Josh Nichols"]
s.authors = ["Josh Nichols", "Dan Croak"]
s.add_dependency "rest-client"
s.add_dependency "happymapper"
end
Expand Down Expand Up @@ -40,4 +40,4 @@ Rcov::RcovTask.new do |t|
t.verbose = true
end

task :default => :rcov
task :default => :test
35 changes: 0 additions & 35 deletions github-party.gemspec

This file was deleted.

8 changes: 0 additions & 8 deletions lib/github_party.rb

This file was deleted.

8 changes: 8 additions & 0 deletions lib/le_git.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rubygems'

require 'happymapper'
require 'rest_client'

require 'le_git/repository'
require 'le_git/user'
require 'le_git/commit'
11 changes: 5 additions & 6 deletions lib/github_party/commit.rb → lib/le_git/commit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ class Commit

tag "commit"

element :url, String
element :tree, String
element :url, String
element :tree, String
element :message, String
element :id, String
element :id, String

# Find commit(s) for a particular username/repository
#
Expand Down Expand Up @@ -39,7 +39,7 @@ def self.find(username, repository, hash_or_all)
end

protected

def self.find_all(username, repository)
xml = RestClient.get("http://github.com/api/v1/xml/#{username}/#{repository}/commits/master")
parse(xml)
Expand All @@ -48,8 +48,7 @@ def self.find_all(username, repository)
def self.find_by_hash(username, repository, hash)
xml = RestClient.get("http://github.com/api/v1/xml/#{username}/#{repository}/commit/#{hash}")
commits = parse(xml)
commits.first # TODO assert size of commits
commits.first
end
end

end
File renamed without changes.
6 changes: 3 additions & 3 deletions lib/github_party/user.rb → lib/le_git/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ module GitHub
class User
include HappyMapper

tag "user" # TODO report that namespaced classes fail here
tag "user"

element :company, String
element :name, String
element :blog, String
element :email, String
element :location, String
element :location, String
element :login, String

has_many :repositories, Repository

def self.find(username)
xml = RestClient.get("http://github.com/api/v1/xml/#{username}")
users = parse(xml)
users.first
users.first
end
end
end
Binary file added test/.github_commit_test.rb.swp
Binary file not shown.
Binary file added test/.test_helper.rb.swp
Binary file not shown.
1 change: 0 additions & 1 deletion test/github_commit_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require File.join(File.dirname(__FILE__), '/test_helper.rb')

class GitHubCommitTest < Test::Unit::TestCase

context "A single commit" do
setup do
FakeWeb.register_uri("http://github.com/api/v1/xml/defunkt/github-gem/commit/c26d4ce9807ecf57d3f9eefe19ae64e75bcaaa8b", :response => File.join(File.dirname(__FILE__), 'fixtures', 'commit.xml'))
Expand Down
2 changes: 0 additions & 2 deletions test/github_user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class GitHubUserTest < Test::Unit::TestCase
@user.name.should == "Josh Nichols"
end


test "#blog" do
@user.blog.should == "http://technicalpickles.com"
end
Expand Down Expand Up @@ -69,7 +68,6 @@ class GitHubUserTest < Test::Unit::TestCase
test "#homepage" do
@repository.homepage == ""
end

end
end
end
17 changes: 13 additions & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
require 'test/unit'
require 'rubygems'
require 'context'
require 'matchy'
require 'pending'
require 'fake_web'
require 'quietbacktrace'
require 'redgreen'

FakeWeb.allow_net_connect = false

CONTEXT_NOISE = %w(context)

backtrace_cleaner = QuietBacktrace::BacktraceCleaner.new
backtrace_cleaner.add_silencer { |line| line.include?(CONTEXT_NOISE) }

require 'context'
require 'matchy'
require 'pending'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib') )
require 'github_party'
require 'le_git'

0 comments on commit edbfb10

Please sign in to comment.