Permalink
Browse files

Rename to Octokit

Closes #8.
  • Loading branch information...
1 parent 879aee3 commit f46bf3344fd2888b7083349782a5ab113c91f2ee @sferik sferik committed Jan 6, 2011
View
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Wynn Netherland
+Copyright (c) 2011 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,68 +1,69 @@
-# octopussy
-
-<img src='http://upload.wikimedia.org/wikipedia/en/b/bb/007Octopussyposter.jpg' style='float: right; margin: 0 0 10px 10px'/>
-
+Octokit
+=======
Simple Ruby wrapper for the GitHub v2 API.
-## Installation
-
- sudo gem install octopussy
+Installation
+------------
+ gem install octokit
-## Some examples
+Some examples
+-------------
### Show a user
- Octopussy.user('pengwynn')
+ Octokit.user('pengwynn')
=> <#Hashie::Mash blog="http://wynnnetherland.com" company="Orrka" created_at="2008/02/25 10:24:19 -0800" email="wynn.netherland@gmail.com" followers_count=21 following_count=55 id=865 location="Dallas, TX" login="pengwynn" name="Wynn Netherland" public_gist_count=4 public_repo_count=16>
### Show who a user follows
- Octopussy.following('pengwynn')
+ Octokit.following('pengwynn')
=> ["cglee", "bryansray", "rails", "zachinglis", "wycats", "obie", "mully", "squeejee", "jderrett", "Shopify", "ReinH", "technoweenie", "errfree", "defunkt", "joshsusser", "hashrocket", "newbamboo", "bigtiger", "github", "jamis", "jeresig", "thoughtbot", "therealadam", "jnunemaker", "seaofclouds", "choan", "llimllib", "kwhinnery", "marshall", "handcrafted", "adamstac", "jashkenas", "dan", "remy", "hayesdavis", "documentcloud", "imathis", "mdeiters", "njonsson", "asenchi", "mattsa", "marclove", "webiest", "brogers", "polomasta", "stephp", "mchelen", "piyush", "davidnorth", "rmetzler", "jferris", "madrobby", "zh", "erikvold", "desandro"]
-## Working with repositories
-
+Working with repositories
+-------------------------
For convenience, methods that require a repo argument may be passed in any of the following forms
* "pengwynn/linked"
* {:username => 'pengwynn', :name => 'linkedin'}
* {:username => 'pengwynn', :repo => 'linkedin'}
-* instance of Repo
+* instance of Repository
### Show a repo
- Octopussy.repo("pengwynn/linkedin")
+ Octokit.repo("pengwynn/linkedin")
=> <#Hashie::Mash description="Ruby wrapper for the LinkedIn API" fork=false forks=1 homepage="http://bit.ly/ruby-linkedin" name="linkedin" open_issues=2 owner="pengwynn" private=false url="http://github.com/pengwynn/linkedin" watchers=36>
-## Authenticated requests
-
+Authenticated requests
+----------------------
Some methods require authentication so you'll need to pass a login and an api_token. You can find your GitHub API token on your [account page](https://github.com/account)
- client = Octopussy::Client.new(:login => 'pengwynn', :token => 'OU812')
+ client = Octokit::Client.new(:login => 'pengwynn', :token => 'OU812')
client.follow!('adamstac')
-Read the full [docs](http://rdoc.info/projects/pengwynn/octopussy) or check out the [examples](http://github.com/pengwynn/octopussy/tree/master/examples)
-
-## TODO
+Read the full [docs](http://rdoc.info/projects/pengwynn/octokit)
+TODO
+----
* Feed parsing
* More examples
-## Note on Patches/Pull Requests
-
-* Fork the project.
-* Make your feature addition or bug fix.
-* Add tests for it. This is important so I don't break it in a
- future version unintentionally.
-* Commit, do not mess with rakefile, version, or history.
- (if you want to have your own version, that is fine but
- bump version in a commit by itself I can ignore when I pull)
-* Send me a pull request. Bonus points for topic branches.
-
-## Credits
-
-Octopussy is inspired by [Octopi](http://github.com/fcoury/octopi) and aims to be a lightweight, less active-resourcey alternative.
-
-## Copyright
-
-Copyright (c) 2009 [Wynn Netherland](http://wynnnetherland.com), [Adam Stacoviak](http://adamstacoviak.com/). See LICENSE for details.
+Submitting a Pull Request
+-------------------------
+1. Fork the project.
+2. Create a topic branch.
+3. Implement your feature or bug fix.
+4. Add documentation for your feature or bug fix.
+5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
+6. Add specs for your feature or bug fix.
+7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
+8. Commit and push your changes.
+9. Submit a pull request. Please do not include changes to the version or gemspec. (If you want to create your own version for some reason, please do so in a separate commit.)
+
+Credits
+-------
+Octokit is inspired by [Octopi](http://github.com/fcoury/octopi) and aims to be a lightweight, less active-resourcey alternative.
+
+Copyright
+---------
+Copyright (c) 2011 [Wynn Netherland](http://wynnnetherland.com), [Adam Stacoviak](http://adamstacoviak.com/), [Erik Michaels-Ober](https://github.com/sferik).
+See [LICENSE](https://github.com/pengwynn/octokit/blob/master/LICENSE) for details.
View
@@ -7,23 +7,23 @@ def self.register_on_complete(env)
env[:response].on_complete do |response|
case response[:status].to_i
when 400
- raise Octopussy::BadRequest, error_message(response)
+ raise Octokit::BadRequest, error_message(response)
when 401
- raise Octopussy::Unauthorized, error_message(response)
+ raise Octokit::Unauthorized, error_message(response)
when 403
- raise Octopussy::Forbidden, error_message(response)
+ raise Octokit::Forbidden, error_message(response)
when 404
- raise Octopussy::NotFound, error_message(response)
+ raise Octokit::NotFound, error_message(response)
when 406
- raise Octopussy::NotAcceptable, error_message(response)
+ raise Octokit::NotAcceptable, error_message(response)
when 500
- raise Octopussy::InternalServerError, error_message(response)
+ raise Octokit::InternalServerError, error_message(response)
when 501
- raise Octopussy::NotImplemented, error_message(response)
+ raise Octokit::NotImplemented, error_message(response)
when 502
- raise Octopussy::BadGateway, error_message(response)
+ raise Octokit::BadGateway, error_message(response)
when 503
- raise Octopussy::ServiceUnavailable, error_message(response)
+ raise Octokit::ServiceUnavailable, error_message(response)
end
end
end
@@ -1,17 +1,17 @@
-require File.expand_path('../octopussy/configuration', __FILE__)
-require File.expand_path('../octopussy/client', __FILE__)
+require File.expand_path('../octokit/configuration', __FILE__)
+require File.expand_path('../octokit/client', __FILE__)
-module Octopussy
+module Octokit
extend Configuration
- # Alias for Octopussy::Client.new
+ # Alias for Octokit::Client.new
#
- # @return [Octopussy::Client]
+ # @return [Octokit::Client]
def self.client(options={})
- Octopussy::Client.new(options)
+ Octokit::Client.new(options)
end
- # Delegate to Octopussy::Client.new
+ # Delegate to Octokit::Client.new
def self.method_missing(method, *args, &block)
return super unless client.respond_to?(method)
client.send(method, *args, &block)
View
@@ -0,0 +1,30 @@
+require File.expand_path('../event', __FILE__)
+require File.expand_path('../repository', __FILE__)
+Dir[File.expand_path('../client/*.rb', __FILE__)].each{|file| require file}
+
+module Octokit
+ class Client
+ attr_accessor *Configuration::VALID_OPTIONS_KEYS
+
+ def initialize(options={})
+ options = Octokit.options.merge(options)
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
+ send("#{key}=", options[key])
+ end
+ end
+
+ include Octokit::Client::Authentication
+ include Octokit::Client::Connection
+ include Octokit::Client::Request
+
+ include Octokit::Client::Commits
+ include Octokit::Client::Issues
+ include Octokit::Client::Network
+ include Octokit::Client::Objects
+ include Octokit::Client::Organizations
+ include Octokit::Client::Pulls
+ include Octokit::Client::Repositories
+ include Octokit::Client::Timelines
+ include Octokit::Client::Users
+ end
+end
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Authentication
def authentication
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Commits
@@ -1,7 +1,7 @@
require 'faraday_middleware'
Dir[File.expand_path('../../../faraday/*.rb', __FILE__)].each{|file| require file}
-module Octopussy
+module Octokit
class Client
# @private
module Connection
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Issues
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Network
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Objects
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Organizations
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Pulls
def create_pull_request(repo, options={})
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Repositories
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Request
def get(path, options={}, raw=false, format_path=true)
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Timelines
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Client
module Users
EMAIL_RE = /[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/
@@ -1,7 +1,7 @@
require 'faraday'
require File.expand_path('../version', __FILE__)
-module Octopussy
+module Octokit
module Configuration
VALID_OPTIONS_KEYS = [:adapter, :endpoint, :format, :login, :password, :proxy, :token, :user_agent, :version].freeze
VALID_FORMATS = [:json, :xml, :yaml].freeze
@@ -13,7 +13,7 @@ module Configuration
DEFAULT_PASSWORD = nil.freeze
DEFAULT_PROXY = nil.freeze
DEFAULT_TOKEN = nil.freeze
- DEFAULT_USER_AGENT = "Octopussy Ruby Gem #{Octopussy::VERSION}".freeze
+ DEFAULT_USER_AGENT = "Octokit Ruby Gem #{Octokit::VERSION}".freeze
DEFAULT_VERSION = 2
attr_accessor *VALID_OPTIONS_KEYS
@@ -1,4 +1,4 @@
-module Octopussy
+module Octokit
class Event
def self.load_from_atom(entry)
@@ -1,6 +1,6 @@
require 'addressable/uri'
-module Octopussy
+module Octokit
class Repository
attr_accessor :username, :name
View
@@ -0,0 +1,3 @@
+module Octokit
+ VERSION = "0.3.0".freeze unless defined?(Octokit::VERSION)
+end
View
@@ -1,30 +0,0 @@
-require File.expand_path('../event', __FILE__)
-require File.expand_path('../repository', __FILE__)
-Dir[File.expand_path('../client/*.rb', __FILE__)].each{|file| require file}
-
-module Octopussy
- class Client
- attr_accessor *Configuration::VALID_OPTIONS_KEYS
-
- def initialize(options={})
- options = Octopussy.options.merge(options)
- Configuration::VALID_OPTIONS_KEYS.each do |key|
- send("#{key}=", options[key])
- end
- end
-
- include Octopussy::Client::Authentication
- include Octopussy::Client::Connection
- include Octopussy::Client::Request
-
- include Octopussy::Client::Commits
- include Octopussy::Client::Issues
- include Octopussy::Client::Network
- include Octopussy::Client::Objects
- include Octopussy::Client::Organizations
- include Octopussy::Client::Pulls
- include Octopussy::Client::Repositories
- include Octopussy::Client::Timelines
- include Octopussy::Client::Users
- end
-end
View
@@ -1,3 +0,0 @@
-module Octopussy
- VERSION = "0.3.0".freeze unless defined?(Octopussy::VERSION)
-end
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-require File.expand_path('../lib/octopussy/version', __FILE__)
+require File.expand_path('../lib/octokit/version', __FILE__)
Gem::Specification.new do |s|
s.add_development_dependency('fakeweb', '~> 1.3')
@@ -17,17 +17,17 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('faraday_middleware', '~> 0.3.1')
s.add_runtime_dependency('multi_json', '~> 0.0.5')
s.add_runtime_dependency('multi_xml', '~> 0.2.0')
- s.name = 'octopussy'
- s.authors = ["Wynn Netherland", "Adam Stacoviak"]
+ s.name = 'octokit'
+ s.authors = ["Wynn Netherland", "Adam Stacoviak", "Erik Michaels-Ober"]
s.description = %q{Simple wrapper for the GitHub API v2}
s.email = ['wynn.netherland@gmail.com']
s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
s.files = `git ls-files`.split("\n")
- s.homepage = 'http://wynnnetherland.com/projects/octopussy/'
+ s.homepage = 'http://wynnnetherland.com/projects/octokit/'
s.require_paths = ['lib']
s.summary = %q{Wrapper for the GitHub API}
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
- s.version = Octopussy::VERSION.dup
+ s.version = Octokit::VERSION.dup
s.platform = Gem::Platform::RUBY
s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version=
end
Oops, something went wrong.

0 comments on commit f46bf33

Please sign in to comment.