Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: octokit/octokit.rb
base: v0.5.2
...
head fork: octokit/octokit.rb
compare: v0.6.0
Checking mergeability… Don't worry, you can still create the pull request.
  • 10 commits
  • 23 files changed
  • 0 commit comments
  • 2 contributors
View
8 lib/octokit.rb
@@ -1,5 +1,5 @@
-require File.expand_path('../octokit/configuration', __FILE__)
-require File.expand_path('../octokit/client', __FILE__)
+require 'octokit/configuration'
+require 'octokit/client'
module Octokit
extend Configuration
@@ -17,6 +17,10 @@ def self.method_missing(method, *args, &block)
client.send(method, *args, &block)
end
+ def self.respond_to?(method)
+ client.respond_to?(method) || super
+ end
+
# Custom error class for rescuing from all GitHub errors
class Error < StandardError; end
View
17 lib/octokit/client.rb
@@ -1,5 +1,16 @@
-require File.expand_path('../repository', __FILE__)
-Dir[File.expand_path('../client/*.rb', __FILE__)].each{|file| require file}
+require 'octokit/repository'
+require 'octokit/client/authentication'
+require 'octokit/client/connection'
+require 'octokit/client/request'
+require 'octokit/client/commits'
+require 'octokit/client/issues'
+require 'octokit/client/network'
+require 'octokit/client/objects'
+require 'octokit/client/organizations'
+require 'octokit/client/pulls'
+require 'octokit/client/repositories'
+require 'octokit/client/timelines'
+require 'octokit/client/users'
module Octokit
class Client
@@ -26,4 +37,4 @@ def initialize(options={})
include Octokit::Client::Timelines
include Octokit::Client::Users
end
-end
+end
View
2  lib/octokit/client/connection.rb
@@ -1,5 +1,5 @@
require 'faraday_middleware'
-Dir[File.expand_path('../../../faraday/*.rb', __FILE__)].each{|file| require file}
+require 'faraday/raise_error'
module Octokit
class Client
View
2  lib/octokit/client/objects.rb
@@ -25,7 +25,7 @@ def tree_metadata(repo, tree_sha, options={})
alias :tree_meta :tree_metadata
def raw(repo, sha, options={})
- get("blob/show/#{Repository.new(repo)}/#{sha}", options)
+ get("blob/show/#{Repository.new(repo)}/#{sha}", options, true).body
end
end
View
15 lib/octokit/client/repositories.rb
@@ -24,20 +24,17 @@ def repositories(username=login, options={})
alias :list_repos :repositories
alias :repos :repositories
- def watch!(repo, options={})
+ def watch(repo, options={})
post("repos/watch/#{Repository.new(repo)}", options)['repository']
end
- alias :watch :watch!
- def unwatch!(repo, options={})
+ def unwatch(repo, options={})
post("repos/unwatch/#{Repository.new(repo)}", options)['repository']
end
- alias :unwatch :unwatch!
- def fork!(repo, options={})
+ def fork(repo, options={})
post("repos/fork/#{Repository.new(repo)}", options)['repository']
end
- alias :fork :fork!
def create_repository(name, options={})
post("repos/create", options.merge(:name => name))['repository']
@@ -61,15 +58,13 @@ def delete_repository!(repo, options={})
end
alias :delete_repo! :delete_repository!
- def set_private!(repo, options={})
+ def set_private(repo, options={})
post("repos/set/private/#{Repository.new(repo)}", options)['repository']
end
- alias :set_private :set_private!
- def set_public!(repo, options={})
+ def set_public(repo, options={})
post("repos/set/public/#{Repository.new(repo)}", options)['repository']
end
- alias :set_public :set_public!
def deploy_keys(repo, options={})
get("repos/keys/#{Repository.new(repo)}", options)['public_keys']
View
6 lib/octokit/client/users.rb
@@ -35,15 +35,13 @@ def follows?(*args)
following(user).include?(target)
end
- def follow!(user, options={})
+ def follow(user, options={})
post("user/follow/#{user}", options)['users']
end
- alias :follow :follow!
- def unfollow!(user, options={})
+ def unfollow(user, options={})
post("user/unfollow/#{user}", options)['users']
end
- alias :unfollow :unfollow!
def watched(user=login, options={})
get("repos/watched/#{user}", options)['repositories']
View
2  lib/octokit/configuration.rb
@@ -1,5 +1,5 @@
require 'faraday'
-require File.expand_path('../version', __FILE__)
+require 'octokit/version'
module Octokit
module Configuration
View
2  lib/octokit/version.rb
@@ -1,3 +1,3 @@
module Octokit
- VERSION = "0.5.2".freeze unless defined?(Octokit::VERSION)
+ VERSION = "0.6.0".freeze unless defined?(Octokit::VERSION)
end
View
4 octokit.gemspec
@@ -6,9 +6,9 @@ Gem::Specification.new do |s|
s.add_development_dependency('nokogiri', '~> 1.4')
s.add_development_dependency('rake', '~> 0.8')
s.add_development_dependency('rspec', '~> 2.5')
- s.add_development_dependency('simplecov', '~> 0.3')
+ s.add_development_dependency('simplecov', '~> 0.4')
s.add_development_dependency('webmock', '~> 1.6')
- s.add_development_dependency('ZenTest', '~> 4.4')
+ s.add_development_dependency('ZenTest', '~> 4.5')
s.add_runtime_dependency('addressable', '~> 2.2.4')
s.add_runtime_dependency('hashie', '~> 1.0.0')
s.add_runtime_dependency('faraday', '~> 0.5.4')
View
2  spec/faraday/response_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../helper', __FILE__)
+require 'helper'
describe Faraday::Response do
before do
View
4 spec/helper.rb
@@ -4,9 +4,7 @@
add_group 'Faraday Middleware', 'lib/faraday'
add_group 'Specs', 'spec'
end
-
-require File.expand_path('../../lib/octokit', __FILE__)
-
+require 'octokit'
require 'rspec'
require 'webmock/rspec'
RSpec.configure do |config|
View
2  spec/octokit/client/commits_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Pulls do
View
2  spec/octokit/client/issues_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Issues do
View
2  spec/octokit/client/network_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Network do
View
11 spec/octokit/client/objects_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Objects do
@@ -34,7 +34,7 @@
stub_get("blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
to_return(:body => fixture("blobs.json"))
blobs = @client.blobs("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
- blobs.first.first.should == "spec/dummy_app/public"
+ blobs[".gitignore"].should == "5efe0eb47a773fa6ea84a0bf190ee218b6a31ead"
end
end
@@ -64,10 +64,15 @@
describe ".raw" do
it "should return raw data" do
- pending "TODO: This shouldn't get parsed as JSON"
stub_get("blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
to_return(:body => fixture("raw.txt"))
raw = @client.raw("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
+ lambda {
+ ::MultiJson.decode(raw)
+ }.should raise_error
+ lambda {
+ ::MultiXml.decode(raw)
+ }.should raise_error
end
end
View
2  spec/octokit/client/organizations_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Organizations do
View
2  spec/octokit/client/pulls_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Pulls do
View
32 spec/octokit/client/repositories_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Repositories do
@@ -67,34 +67,34 @@
end
- describe ".watch!" do
+ describe ".watch" do
it "should watch a repository" do
stub_post("repos/watch/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.watch!("sferik/rails_admin")
+ repository = @client.watch("sferik/rails_admin")
repository.name.should == "rails_admin"
end
end
- describe ".unwatch!" do
+ describe ".unwatch" do
it "should unwatch a repository" do
stub_post("repos/unwatch/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.unwatch!("sferik/rails_admin")
+ repository = @client.unwatch("sferik/rails_admin")
repository.name.should == "rails_admin"
end
end
- describe ".fork!" do
+ describe ".fork" do
it "should fork a repository" do
stub_post("repos/fork/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.fork!("sferik/rails_admin")
+ repository = @client.fork("sferik/rails_admin")
repository.name.should == "rails_admin"
end
@@ -123,34 +123,34 @@
end
- describe ".delete_repository!" do
+ describe ".delete_repository" do
it "should delete a repository" do
stub_post("repos/delete/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.delete_repository!("sferik/rails_admin")
+ repository = @client.delete_repository("sferik/rails_admin")
repository.name.should == "rails_admin"
end
end
- describe ".set_private!" do
+ describe ".set_private" do
it "should set a repository private" do
stub_post("repos/set/private/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.set_private!("sferik/rails_admin")
+ repository = @client.set_private("sferik/rails_admin")
repository.name.should == "rails_admin"
end
end
- describe ".set_public!" do
+ describe ".set_public" do
it "should set a repository public" do
stub_post("repos/set/public/sferik/rails_admin").
to_return(:body => fixture("repository.json"))
- repository = @client.set_public!("sferik/rails_admin")
+ repository = @client.set_public("sferik/rails_admin")
repository.name.should == "rails_admin"
end
@@ -300,7 +300,7 @@
stub_get("repos/show/sferik/rails_admin/languages").
to_return(:body => fixture("languages.json"))
languages = @client.languages("sferik/rails_admin")
- languages.first.first.should == "Ruby"
+ languages["Ruby"].should == 205046
end
end
@@ -311,7 +311,7 @@
stub_get("repos/show/pengwynn/octokit/tags").
to_return(:body => fixture("tags.json"))
tags = @client.tags("pengwynn/octokit")
- tags.first.first.should == "v0.1.0"
+ tags["v0.0.1"].should == "0d7a03f2035ecd74e4d6eb9be58865c2a688ee55"
end
end
@@ -322,7 +322,7 @@
stub_get("repos/show/pengwynn/octokit/branches").
to_return(:body => fixture("branches.json"))
branches = @client.branches("pengwynn/octokit")
- branches.first.first.should == "rspec"
+ branches["master"].should == "4d9a9e9ca183bab1c3d0accf1d53edd85bd6200f"
end
end
View
2  spec/octokit/client/timelines_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Users do
View
10 spec/octokit/client/users_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../helper', __FILE__)
+require 'helper'
describe Octokit::Client::Users do
@@ -152,23 +152,23 @@
end
- describe ".follow!" do
+ describe ".follow" do
it "should follow a user" do
stub_post("user/follow/dianakimball").
to_return(:body => fixture("following.json"))
- following = @client.follow!("dianakimball")
+ following = @client.follow("dianakimball")
following.should include("dianakimball")
end
end
- describe ".unfollow!" do
+ describe ".unfollow" do
it "should unfollow a user" do
stub_post("user/unfollow/dogbrainz").
to_return(:body => fixture("following.json"))
- following = @client.unfollow!("dogbrainz")
+ following = @client.unfollow("dogbrainz")
following.should_not include("dogbrainz")
end
View
2  spec/octokit/client_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../helper', __FILE__)
+require 'helper'
describe Octokit::Client do
View
2  spec/octokit_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../helper', __FILE__)
+require 'helper'
describe Octokit do
after do
View
2  spec/repository_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../helper', __FILE__)
+require 'helper'
describe Octokit::Repository do
context "when passed a string containg a slash" do

No commit comments for this range

Something went wrong with that request. Please try again.