Commit 8412b230 authored by Fabio Pelosin's avatar Fabio Pelosin

[WIP] Remove Octokit dep

parent a1b61b06
...@@ -32,8 +32,6 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA ...@@ -32,8 +32,6 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.1.1' s.add_runtime_dependency 'cocoapods-downloader', '~> 0.1.1'
s.add_runtime_dependency 'xcodeproj', '~> 0.6.0' s.add_runtime_dependency 'xcodeproj', '~> 0.6.0'
s.add_runtime_dependency 'faraday', '~> 0.8.1'
s.add_runtime_dependency 'octokit', '~> 1.7'
s.add_runtime_dependency 'colored', '~> 1.2' s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4' s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'json', '~> 1.8.0' s.add_runtime_dependency 'json', '~> 1.8.0'
......
...@@ -21,7 +21,6 @@ module Pod ...@@ -21,7 +21,6 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "create subcommand" do describe "create subcommand" do
extend SpecHelper::Github
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "creates a new podspec stub file" do it "creates a new podspec stub file" do
...@@ -121,14 +120,13 @@ module Pod ...@@ -121,14 +120,13 @@ module Pod
end end
# @todo VCR is required in CocoaPods only for this test. # @todo VCR is required in CocoaPods only for this test.
# xit "lints a remote podspec" do
# it "lints a remote podspec" do Dir.chdir(fixture('spec-repos') + 'master/JSONKit/1.4/') do
# Dir.chdir(fixture('spec-repos') + 'master/JSONKit/1.4/') do cmd = command('spec', 'lint', '--quick', '--only-errors', '--silent', 'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec')
# cmd = command('spec', 'lint', '--quick', '--only-errors', '--silent', 'https://github.com/CocoaPods/Specs/raw/master/A2DynamicDelegate/2.0.1/A2DynamicDelegate.podspec') # VCR.use_cassette('linter', :record => :new_episodes) { }
# # VCR.use_cassette('linter', :record => :new_episodes) { } lambda { cmd.run }.should.not.raise
# lambda { cmd.run }.should.not.raise end
# end end
# end
before do before do
text = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read text = (fixture('spec-repos') + 'master/JSONKit/1.4/JSONKit.podspec').read
...@@ -152,13 +150,13 @@ module Pod ...@@ -152,13 +150,13 @@ module Pod
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "which subcommand" do describe "which subcommand" do
it "errors if a given podspec doesn't exist" do it "errors if a given podspec doesn't exist" do
e = lambda { command('spec', 'which', 'some_pod_that_doesnt_exist').run }.should.raise Informative e = lambda { command('spec', 'which', 'some_pod_that_doesnt_exist').run }.should.raise Informative
e.message.should.match /Unable to find a pod with/ e.message.should.match /Unable to find a pod with/
end end
it "prints the path of a given podspec" do it "prints the path of a given podspec" do
lambda { command('spec', 'which', 'AFNetworking').run }.should.not.raise lambda { command('spec', 'which', 'AFNetworking').run }.should.not.raise
text = "AFNetworking.podspec" text = "AFNetworking.podspec"
......
...@@ -22,8 +22,9 @@ module Pod ...@@ -22,8 +22,9 @@ module Pod
end end
it "presents the stats of a specification set" do it "presents the stats of a specification set" do
repo = { "forks"=>42, "watchers"=>318, "pushed_at"=>"2011-01-26T19:06:43Z" } Specification::Set::Presenter.any_instance.expects(:github_last_activity).returns('more than a year ago')
Octokit.expects(:repo).with("robbiehanson/CocoaLumberjack").returns(repo) Specification::Set::Presenter.any_instance.expects(:github_watchers).returns('318')
Specification::Set::Presenter.any_instance.expects(:github_forks).returns('42')
UI.pod(@set, :stats) UI.pod(@set, :stats)
output = UI.output output = UI.output
output.should.include? 'Author: Robbie Hanson' output.should.include? 'Author: Robbie Hanson'
......
require 'octokit' # # require 'octokit'
#
module SpecHelper # module SpecHelper
module Github # module Github
def expect_github_repo_request(data = nil) # def expect_github_repo_request(data = nil)
data ||= { # data ||= {
"clone_url" => "https://github.com/lukeredpath/libPusher.git", # "clone_url" => "https://github.com/lukeredpath/libPusher.git",
"created_at" => "2010-03-22T17:06:16Z", # "created_at" => "2010-03-22T17:06:16Z",
"description" => "An Objective-C interface to Pusher (pusherapp.com)", # "description" => "An Objective-C interface to Pusher (pusherapp.com)",
"fork" => false, # "fork" => false,
"forks" => 22, # "forks" => 22,
"git_url" => "git://github.com/lukeredpath/libPusher.git", # "git_url" => "git://github.com/lukeredpath/libPusher.git",
"has_downloads" => true, # "has_downloads" => true,
"has_issues" => true, # "has_issues" => true,
"has_wiki" => true, # "has_wiki" => true,
"homepage" => "", # "homepage" => "",
"html_url" => "https://github.com/lukeredpath/libPusher", # "html_url" => "https://github.com/lukeredpath/libPusher",
"id" => 574304, # "id" => 574304,
"language" => "C", # "language" => "C",
"mirror_url" => nil, # "mirror_url" => nil,
"name" => "libPusher", # "name" => "libPusher",
"open_issues" => 2, # "open_issues" => 2,
"owner" => { # "owner" => {
"avatar_url" => "https://secure.gravatar.com/avatar/bdd4d23d1a822b2d68b53e7c51d69a39?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", # "avatar_url" => "https://secure.gravatar.com/avatar/bdd4d23d1a822b2d68b53e7c51d69a39?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"gravatar_id" => "bdd4d23d1a822b2d68b53e7c51d69a39", # "gravatar_id" => "bdd4d23d1a822b2d68b53e7c51d69a39",
"id" => 613, # "id" => 613,
"login" => "lukeredpath", # "login" => "lukeredpath",
"url" => "https://api.github.com/users/lukeredpath" # "url" => "https://api.github.com/users/lukeredpath"
}, # },
"private" => false, # "private" => false,
"pushed_at" => "2012-04-10T13:16:49Z", # "pushed_at" => "2012-04-10T13:16:49Z",
"size" => 3654, # "size" => 3654,
"ssh_url" => "git@github.com:lukeredpath/libPusher.git", # "ssh_url" => "git@github.com:lukeredpath/libPusher.git",
"svn_url" => "https://github.com/lukeredpath/libPusher", # "svn_url" => "https://github.com/lukeredpath/libPusher",
"updated_at" => "2012-04-16T23:01:00Z", # "updated_at" => "2012-04-16T23:01:00Z",
"url" => "https://api.github.com/repos/lukeredpath/libPusher", # "url" => "https://api.github.com/repos/lukeredpath/libPusher",
"watchers" => 143 # "watchers" => 143
} # }
Octokit.expects(:repo).with('lukeredpath/libPusher').returns(data) # Octokit.expects(:repo).with('lukeredpath/libPusher').returns(data)
end # end
#
def expect_github_tags_request(data = nil) # def expect_github_tags_request(data = nil)
data ||= [ # data ||= [
{ # {
"commit" => { # "commit" => {
"sha" => "ea47899b65db8e9fd77b3a236f602771f15ca28f", # "sha" => "ea47899b65db8e9fd77b3a236f602771f15ca28f",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/ea47899b65db8e9fd77b3a236f602771f15ca28f" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/ea47899b65db8e9fd77b3a236f602771f15ca28f"
}, # },
"name" => "v1.2", # "name" => "v1.2",
"tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.2", # "tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.2",
"zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.2" # "zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.2"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "788468bc173e1bb57646a3ff8ace551df10a4249", # "sha" => "788468bc173e1bb57646a3ff8ace551df10a4249",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/788468bc173e1bb57646a3ff8ace551df10a4249" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/788468bc173e1bb57646a3ff8ace551df10a4249"
}, # },
"name" => "v1.0.1", # "name" => "v1.0.1",
"tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.0.1", # "tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.0.1",
"zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.0.1" # "zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.0.1"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "d4d51f86dc460c389b9d19c9453541f7daf7076b", # "sha" => "d4d51f86dc460c389b9d19c9453541f7daf7076b",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/d4d51f86dc460c389b9d19c9453541f7daf7076b" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/d4d51f86dc460c389b9d19c9453541f7daf7076b"
}, # },
"name" => "v1.3", # "name" => "v1.3",
"tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.3", # "tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.3",
"zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.3" # "zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.3"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "c4ed3712ad2bee5c9e754339f1860f15daf788f4", # "sha" => "c4ed3712ad2bee5c9e754339f1860f15daf788f4",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/c4ed3712ad2bee5c9e754339f1860f15daf788f4" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/c4ed3712ad2bee5c9e754339f1860f15daf788f4"
}, # },
"name" => "v1.0", # "name" => "v1.0",
"tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.0", # "tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.0",
"zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.0" # "zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.0"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "77523befd5509f91b8cbe03f45d30e6ce8ab96f4", # "sha" => "77523befd5509f91b8cbe03f45d30e6ce8ab96f4",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/77523befd5509f91b8cbe03f45d30e6ce8ab96f4" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/77523befd5509f91b8cbe03f45d30e6ce8ab96f4"
}, # },
"name" => "v1.1", # "name" => "v1.1",
"tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.1", # "tarball_url" => "https://github.com/lukeredpath/libPusher/tarball/v1.1",
"zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.1" # "zipball_url" => "https://github.com/lukeredpath/libPusher/zipball/v1.1"
} # }
] # ]
Octokit.expects(:tags).with(:username => 'lukeredpath', :repo => 'libPusher').returns(data) # Octokit.expects(:tags).with(:username => 'lukeredpath', :repo => 'libPusher').returns(data)
end # end
#
def expect_github_branches_request(data = nil) # def expect_github_branches_request(data = nil)
data ||= [ # data ||= [
{ # {
"commit" => { # "commit" => {
"sha" => "d7aac34e846e2fe9b9da54978abfada8f9aa69a8", # "sha" => "d7aac34e846e2fe9b9da54978abfada8f9aa69a8",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/d7aac34e846e2fe9b9da54978abfada8f9aa69a8" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/d7aac34e846e2fe9b9da54978abfada8f9aa69a8"
}, # },
"name" => "use-socketrocket-backend" # "name" => "use-socketrocket-backend"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "daa4ba9398af4b532bfbca610065057e709cc877", # "sha" => "daa4ba9398af4b532bfbca610065057e709cc877",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/daa4ba9398af4b532bfbca610065057e709cc877" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/daa4ba9398af4b532bfbca610065057e709cc877"
}, # },
"name" => "gh-pages" # "name" => "gh-pages"
}, # },
{ # {
"commit" => { # "commit" => {
"sha" => "5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7", # "sha" => "5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7",
"url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7" # "url" => "https://api.github.com/repos/lukeredpath/libPusher/commits/5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7"
}, # },
"name" => "master" # "name" => "master"
} # }
] # ]
Octokit.expects(:branches).with(:username => 'lukeredpath', :repo => 'libPusher').returns(data) # Octokit.expects(:branches).with(:username => 'lukeredpath', :repo => 'libPusher').returns(data)
end # end
#
def expect_github_user_request(data = nil) # def expect_github_user_request(data = nil)
data ||= { # data ||= {
"avatar_url" => "https://secure.gravatar.com/avatar/bdd4d23d1a822b2d68b53e7c51d69a39?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", # "avatar_url" => "https://secure.gravatar.com/avatar/bdd4d23d1a822b2d68b53e7c51d69a39?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"bio" => "I\342\200\231m a Ruby on Rails and iPhone developer based in London, UK. I\342\200\231ve been writing web apps for almost ten years and in late 2008, I released my first iPhone application.\r\n\r\nSince early 2009, I have worked on a freelance/contract basis, having previously worked at Reevoo as part of one of the best Rails development teams in the country.\r\n\r\nI\342\200\231m also a big fan of open-source software which I both use and contribute to whenever possible. I have contributed to many open-source projects over the years, including Rails, RSpec and more recently, Gemcutter, as well as starting many of my own, including Clickatell, a library for interfacing with the Clickatell SMS gateway and SimpleConfig, a declarative application configuration Rails plugin which was developed whilst working at Reevoo.\r\n\r\nI was the technical reviewer for the SitePoint book \342\200\234Build Your Own Ruby on Rails Applications\342\200\235 and also contributed a recipe to \342\200\234Rails Recipes\342\200\235 by Chad Fowler.", # "bio" => "I\342\200\231m a Ruby on Rails and iPhone developer based in London, UK. I\342\200\231ve been writing web apps for almost ten years and in late 2008, I released my first iPhone application.\r\n\r\nSince early 2009, I have worked on a freelance/contract basis, having previously worked at Reevoo as part of one of the best Rails development teams in the country.\r\n\r\nI\342\200\231m also a big fan of open-source software which I both use and contribute to whenever possible. I have contributed to many open-source projects over the years, including Rails, RSpec and more recently, Gemcutter, as well as starting many of my own, including Clickatell, a library for interfacing with the Clickatell SMS gateway and SimpleConfig, a declarative application configuration Rails plugin which was developed whilst working at Reevoo.\r\n\r\nI was the technical reviewer for the SitePoint book \342\200\234Build Your Own Ruby on Rails Applications\342\200\235 and also contributed a recipe to \342\200\234Rails Recipes\342\200\235 by Chad Fowler.",
"blog" => "http://lukeredpath.co.uk", # "blog" => "http://lukeredpath.co.uk",
"company" => "LJR Software Limited", # "company" => "LJR Software Limited",
"created_at" => "2008-02-22T14:36:59Z", # "created_at" => "2008-02-22T14:36:59Z",
"email" => "luke@lukeredpath.co.uk", # "email" => "luke@lukeredpath.co.uk",
"followers" => 195, # "followers" => 195,
"following" => 10, # "following" => 10,
"gravatar_id" => "bdd4d23d1a822b2d68b53e7c51d69a39", # "gravatar_id" => "bdd4d23d1a822b2d68b53e7c51d69a39",
"hireable" => true, # "hireable" => true,
"html_url" => "https://github.com/lukeredpath", # "html_url" => "https://github.com/lukeredpath",
"id" => 613, # "id" => 613,
"location" => "London, UK", # "location" => "London, UK",
"login" => "lukeredpath", # "login" => "lukeredpath",
"name" => "Luke Redpath", # "name" => "Luke Redpath",
"public_gists" => 122, # "public_gists" => 122,
"public_repos" => 68, # "public_repos" => 68,
"type" => "User", # "type" => "User",
"url" => "https://api.github.com/users/lukeredpath" # "url" => "https://api.github.com/users/lukeredpath"
} # }
Octokit.expects(:user).with('lukeredpath').returns(data) # Octokit.expects(:user).with('lukeredpath').returns(data)
end # end
end # end
end # end
#
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment