Commit b255de76 authored by Eloy Durán's avatar Eloy Durán

Make specs green.

parent 054fe5c8
...@@ -8,7 +8,7 @@ GIT ...@@ -8,7 +8,7 @@ GIT
GIT GIT
remote: git://github.com/alloy/CLAide.git remote: git://github.com/alloy/CLAide.git
revision: fdcc73837ff0c67b440fa9a20dc6366c78f06f09 revision: 324ceaf81365eb6e5936c010037887a2c8d44f3e
specs: specs:
claide (0.0.1) claide (0.0.1)
......
...@@ -89,7 +89,7 @@ module Pod ...@@ -89,7 +89,7 @@ module Pod
lint_argv << "--silent" if config.silent lint_argv << "--silent" if config.silent
all_valid = true all_valid = true
podspec_files.each do |podspec| podspec_files.each do |podspec|
Spec.new(ARGV.new(lint_argv + [podspec.to_s])).run Spec.parse(lint_argv + [podspec.to_s]).run
end end
end end
......
...@@ -149,17 +149,10 @@ module Pod ...@@ -149,17 +149,10 @@ module Pod
# TODO some of the following methods can probably move to one of the subclasses. # TODO some of the following methods can probably move to one of the subclasses.
protected
def dir def dir
config.repos_dir + @name config.repos_dir + @name
end end
def print_messages(type, messages)
return if config.silent?
messages.each {|msg| UI.puts " - #{type.ljust(5)} | #{msg}"}
end
def check_versions(dir) def check_versions(dir)
versions = versions(dir) versions = versions(dir)
unless is_compatilbe(versions) unless is_compatilbe(versions)
...@@ -172,6 +165,13 @@ module Pod ...@@ -172,6 +165,13 @@ module Pod
UI.puts "\nCocoapods #{versions['last']} is available.\n".green if has_update(versions) && config.new_version_message? UI.puts "\nCocoapods #{versions['last']} is available.\n".green if has_update(versions) && config.new_version_message?
end end
protected
def print_messages(type, messages)
return if config.silent?
messages.each {|msg| UI.puts " - #{type.ljust(5)} | #{msg}"}
end
def self.compatible?(name) def self.compatible?(name)
dir = Config.instance.repos_dir + name dir = Config.instance.repos_dir + name
versions = versions(dir) versions = versions(dir)
......
...@@ -69,7 +69,7 @@ module Pod ...@@ -69,7 +69,7 @@ module Pod
end end
def add_master_repo def add_master_repo
@command ||= Repo.new(ARGV.new(['add', 'master', url, 'master'])).run @command ||= Repo::Add.parse(['master', url, 'master']).run
end end
def update_master_repo def update_master_repo
......
...@@ -5,6 +5,8 @@ require 'active_support/core_ext/string/inflections' ...@@ -5,6 +5,8 @@ require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Command class Command
class Spec < Command class Spec < Command
self.abstract_command = true
self.summary = 'Manage pod specs' self.summary = 'Manage pod specs'
class Create < Spec class Create < Spec
...@@ -18,7 +20,7 @@ module Pod ...@@ -18,7 +20,7 @@ module Pod
self.arguments = '[ NAME | https://github.com/USER/REPO ]' self.arguments = '[ NAME | https://github.com/USER/REPO ]'
def initialize(argv) def initialize(argv)
@url, @name_or_url = argv.shift_argument, argv.shift_argument @name_or_url, @url = argv.shift_argument, argv.shift_argument
super super
end end
......
...@@ -82,7 +82,7 @@ module Pod ...@@ -82,7 +82,7 @@ module Pod
unless config.skip_repo_update? unless config.skip_repo_update?
UI.section 'Updating spec repositories' do UI.section 'Updating spec repositories' do
Command::Repo.new(Command::ARGV.new(["update"])).run Command::Repo::Update.parse([]).run
end if !@lockfile || !(@pods_by_state[:added] + @pods_by_state[:changed]).empty? || update_mode end if !@lockfile || !(@pods_by_state[:added] + @pods_by_state[:changed]).empty? || update_mode
end end
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Command::Install" do module Pod
extend SpecHelper::Command describe Command::Install do
extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos
it "should include instructions on how to reference the xcode project" do
Pod::Command::Install.banner.should.match %r{xcodeproj 'path/to/XcodeProject'}
end
it "tells the user that no Podfile or podspec was found in the current working dir" do it "tells the user that no Podfile or podspec was found in the current working dir" do
exception = lambda { run_command('install','--no-update') }.should.raise Pod::Informative exception = lambda { run_command('install', '--no-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory." exception.message.should.include "No `Podfile' found in the current working directory."
end end
end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Command::List" do module Pod
describe Command::List do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
def command(arguments = argv) it "lists the known pods" do
command = Pod::Command::List.new(arguments) out = run_command('list')
end
it "complains for wrong parameters" do
lambda { command(argv('wrong')).run }.should.raise Pod::Command::Help
lambda { command(argv('--wrong')).run }.should.raise Pod::Command::Help
end
it "presents the known pods" do
list = command()
list.run
[ /ZBarSDK/, [ /ZBarSDK/,
/TouchJSON/, /TouchJSON/,
/SDURLCache/, /SDURLCache/,
/MagicalRecord/, /MagicalRecord/,
/A2DynamicDelegate/, /A2DynamicDelegate/,
/\d+ pods were found/ /\d+ pods were found/
].each { |regex| Pod::UI.output.should =~ regex } ].each { |regex| out.should =~ regex }
end end
it "returns the new pods" do it "lists the new pods" do
Time.stubs(:now).returns(Time.mktime(2012,2,3)) Time.stubs(:now).returns(Time.mktime(2012,2,3))
list = command(argv('new')) out = run_command('list', 'new')
list.run
[ 'iCarousel', [ 'iCarousel',
'libPusher', 'libPusher',
'SSCheckBoxView', 'SSCheckBoxView',
...@@ -36,8 +26,8 @@ describe "Pod::Command::List" do ...@@ -36,8 +26,8 @@ describe "Pod::Command::List" do
'FileMD5Hash', 'FileMD5Hash',
'cocoa-oauth', 'cocoa-oauth',
'iRate' 'iRate'
].each {|s| Pod::UI.output.should.include s } ].each {|s| out.should.include s }
end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Command::Outdated do module Pod
extend SpecHelper::Command describe Command::Outdated do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do it "tells the user that no Podfile was found in the current working dir" do
exception = lambda { run_command('outdated','--no-update') }.should.raise Pod::Informative exception = lambda { run_command('outdated', '--no-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory." exception.message.should.include "No `Podfile' found in the current working directory."
end end
...@@ -14,9 +14,10 @@ describe Pod::Command::Outdated do ...@@ -14,9 +14,10 @@ describe Pod::Command::Outdated do
file = temporary_directory + 'Podfile' file = temporary_directory + 'Podfile'
File.open(file, 'w') {|f| f.write('platform :ios') } File.open(file, 'w') {|f| f.write('platform :ios') }
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
exception = lambda { run_command('outdated','--no-update') }.should.raise Pod::Informative exception = lambda { run_command('outdated', '--no-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the current working directory" exception.message.should.include "No `Podfile.lock' found in the current working directory"
end end
end end
end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Command::Push do module Pod
describe Command::Push do
extend SpecHelper::Command extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -13,22 +14,20 @@ describe Pod::Command::Push do ...@@ -13,22 +14,20 @@ describe Pod::Command::Push do
fixture('spec-repos/master') fixture('spec-repos/master')
end end
it "complains for wrong parameters" do it "requires a spec-repo name" do
lambda { run_command('push') }.should.raise Pod::Command::Help lambda { command('push').validate! }.should.raise Command::Help
lambda { run_command('push', '--allow-warnings') }.should.raise Pod::Command::Help
lambda { run_command('push', '--wrong-option') }.should.raise Pod::Command::Help
end end
it "complains if it can't find the repo" do it "complains if it can't find the repo" do
repo1 = add_repo('repo1', master_repo) repo1 = add_repo('repo1', master_repo)
Dir.chdir(fixture('banana-lib')) do Dir.chdir(fixture('banana-lib')) do
lambda { run_command('push', 'repo2') }.should.raise Pod::Informative lambda { run_command('push', 'repo2') }.should.raise Informative
end end
end end
it "complains if it can't find a spec" do it "complains if it can't find a spec" do
repo1 = add_repo('repo1', master_repo) repo1 = add_repo('repo1', master_repo)
lambda { run_command('push', 'repo1') }.should.raise Pod::Informative lambda { run_command('push', 'repo1') }.should.raise Informative
end end
it "it raises if the pod is not validated" do it "it raises if the pod is not validated" do
...@@ -36,7 +35,7 @@ describe Pod::Command::Push do ...@@ -36,7 +35,7 @@ describe Pod::Command::Push do
repo2 = add_repo('repo2', repo1.dir) repo2 = add_repo('repo2', repo1.dir)
git_config('repo2', 'remote.origin.url').should == (tmp_repos_path + 'repo1').to_s git_config('repo2', 'remote.origin.url').should == (tmp_repos_path + 'repo1').to_s
Dir.chdir(fixture('banana-lib')) do Dir.chdir(fixture('banana-lib')) do
lambda { command('push', 'repo2', '--silent').run }.should.raise Pod::Informative lambda { run_command('push', 'repo2', '--silent') }.should.raise Informative
end end
# (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!' # (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!'
end end
...@@ -60,7 +59,7 @@ describe Pod::Command::Push do ...@@ -60,7 +59,7 @@ describe Pod::Command::Push do
(@local_repo.dir + 'README').read.should.include 'Added!' (@local_repo.dir + 'README').read.should.include 'Added!'
cmd = command('push', 'local_repo') cmd = command('push', 'local_repo')
cmd.expects(:validate_podspec_files).returns(true) cmd.expects(:validate_podspec_files).returns(true)
Dir.chdir(temporary_directory) { lambda { cmd.run }.should.raise Pod::Informative } Dir.chdir(temporary_directory) { lambda { cmd.run }.should.raise Informative }
(@upstream.dir + 'PushTest/1.4/PushTest.podspec').should.not.exist? (@upstream.dir + 'PushTest/1.4/PushTest.podspec').should.not.exist?
end end
...@@ -71,10 +70,11 @@ describe Pod::Command::Push do ...@@ -71,10 +70,11 @@ describe Pod::Command::Push do
cmd.expects(:validate_podspec_files).returns(true) cmd.expects(:validate_podspec_files).returns(true)
Dir.chdir(temporary_directory) { cmd.run } Dir.chdir(temporary_directory) { cmd.run }
Pod::UI.output.should.include('[Add] PushTest (1.4)') UI.output.should.include('[Add] PushTest (1.4)')
Pod::UI.output.should.include('[Fix] JSONKit (1.4)') UI.output.should.include('[Fix] JSONKit (1.4)')
git('upstream', 'checkout test') # checkout because test because is it the branch used in the specs. git('upstream', 'checkout test') # checkout because test because is it the branch used in the specs.
(@upstream.dir + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest') (@upstream.dir + 'PushTest/1.4/PushTest.podspec').read.should.include('PushTest')
end end
end
end end
...@@ -7,20 +7,9 @@ describe "Pod::Command::Repo" do ...@@ -7,20 +7,9 @@ describe "Pod::Command::Repo" do
end end
describe "In general" do describe "In general" do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "runs with correct parameters" do
lambda { run_command('repo', 'update') }.should.not.raise
lambda { run_command('repo', 'lint', temporary_directory.to_s) }.should.not.raise
end
it "complains for wrong parameters" do
lambda { run_command('repo', 'add') }.should.raise Pod::Informative
lambda { run_command('repo', 'add', 'NAME') }.should.raise Pod::Informative
end
it "adds a spec-repo" do it "adds a spec-repo" do
run_command('repo', 'add', 'private', fixture('spec-repos/master')) run_command('repo', 'add', 'private', fixture('spec-repos/master'))
git_config('private', 'remote.origin.url').should == fixture('spec-repos/master').to_s git_config('private', 'remote.origin.url').should == fixture('spec-repos/master').to_s
...@@ -67,7 +56,6 @@ describe "Pod::Command::Repo" do ...@@ -67,7 +56,6 @@ describe "Pod::Command::Repo" do
end end
describe "Concerning a repo support" do describe "Concerning a repo support" do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Command::Search" do module Pod
extend SpecHelper::Command describe Command::Search do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -15,10 +15,10 @@ describe "Pod::Command::Search" do ...@@ -15,10 +15,10 @@ describe "Pod::Command::Search" do
end end
it "complains for wrong parameters" do it "complains for wrong parameters" do
lambda { run_command('search') }.should.raise Pod::Command::Help lambda { run_command('search') }.should.raise Command::Help
lambda { run_command('search', 'too', 'many') }.should.raise Pod::Command::Help lambda { run_command('search', 'too', 'many') }.should.raise Command::Help
lambda { run_command('search', 'too', '--wrong') }.should.raise Pod::Command::Help lambda { run_command('search', 'too', '--wrong') }.should.raise Command::Help
lambda { run_command('search', '--wrong') }.should.raise Pod::Command::Help lambda { run_command('search', '--wrong') }.should.raise Command::Help
end end
it "presents the search results" do it "presents the search results" do
...@@ -42,11 +42,9 @@ describe "Pod::Command::Search" do ...@@ -42,11 +42,9 @@ describe "Pod::Command::Search" do
['is', %w{ ASIHTTPRequest SSZipArchive }], ['is', %w{ ASIHTTPRequest SSZipArchive }],
['luke redpath', %w{ Kiwi libPusher LRMocky LRResty LRTableModel}], ['luke redpath', %w{ Kiwi libPusher LRMocky LRResty LRTableModel}],
].each do |query, results| ].each do |query, results|
output = run_command('search', '--full', query) output = run_command('search', query, '--full')
results.each { |pod| output.should.include? pod } results.each { |pod| output.should.include? pod }
end end
end end
end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe "Pod::Command::Setup" do describe Command::Setup do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -15,22 +14,22 @@ describe "Pod::Command::Setup" do ...@@ -15,22 +14,22 @@ describe "Pod::Command::Setup" do
end end
it "complains for wrong parameters" do it "complains for wrong parameters" do
lambda { run_command('setup', 'wrong') }.should.raise Pod::Command::Help lambda { run_command('setup', 'wrong') }.should.raise Command::Help
lambda { run_command('setup', '--wrong') }.should.raise Pod::Command::Help lambda { run_command('setup', '--wrong') }.should.raise Command::Help
end end
it "returns the read only URL of the `master' spec-repo" do it "returns the read only URL of the `master' spec-repo" do
cmd = Pod::Command::Setup.new(argv) cmd = Command::Setup.new(argv)
cmd.url.should == 'https://github.com/CocoaPods/Specs.git' cmd.url.should == 'https://github.com/CocoaPods/Specs.git'
end end
it "returns the push URL of the `master' spec-repo" do it "returns the push URL of the `master' spec-repo" do
config.silent = true config.silent = true
cmd = Pod::Command::Setup.new(argv('--push')) cmd = Command::Setup.new(argv('--push'))
cmd.url.should == 'git@github.com:CocoaPods/Specs.git' cmd.url.should == 'git@github.com:CocoaPods/Specs.git'
end end
class Pod::Command::Setup class Command::Setup
def read_only_url; SpecHelper.fixture('spec-repos/master'); end def read_only_url; SpecHelper.fixture('spec-repos/master'); end
end end
...@@ -51,8 +50,9 @@ describe "Pod::Command::Setup" do ...@@ -51,8 +50,9 @@ describe "Pod::Command::Setup" do
it "can run if needed" do it "can run if needed" do
output = run_command('setup') output = run_command('setup')
output.should.include "Setup completed" output.should.include "Setup completed"
Pod::UI.output = '' UI.output = ''
command('setup').run_if_needed command('setup').run_if_needed
Pod::UI.output.should == '' UI.output.should == ''
end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Command::Spec do module Pod
extend SpecHelper::Command describe Command::Spec do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
it "complains for wrong parameters" do it "complains for wrong parameters" do
lambda { run_command('spec') }.should.raise Pod::Command::Help lambda { run_command('spec') }.should.raise Command::Help
lambda { run_command('spec', 'create') }.should.raise Pod::Command::Help lambda { run_command('spec', 'create') }.should.raise Command::Help
lambda { run_command('spec', '--create') }.should.raise Pod::Command::Help lambda { run_command('spec', '--create') }.should.raise Command::Help
lambda { run_command('spec', 'NAME') }.should.raise Pod::Command::Help lambda { run_command('spec', 'NAME') }.should.raise Command::Help
lambda { run_command('spec', 'createa') }.should.raise Pod::Command::Help lambda { run_command('spec', 'createa') }.should.raise Command::Help
lambda { run_command('lint', 'agument1', '2') }.should.raise Pod::Command::Help lambda { run_command('lint', 'agument1', '2') }.should.raise Command::Help
end
end end
end
describe "Pod::Command::Spec#create" do describe "Command::Spec#create" do
extend SpecHelper::Command
extend SpecHelper::Github extend SpecHelper::Github
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
...@@ -23,11 +22,11 @@ describe "Pod::Command::Spec#create" do ...@@ -23,11 +22,11 @@ describe "Pod::Command::Spec#create" do
it "creates a new podspec stub file" do it "creates a new podspec stub file" do
run_command('spec', 'create', 'Bananas') run_command('spec', 'create', 'Bananas')
path = temporary_directory + 'Bananas.podspec' path = temporary_directory + 'Bananas.podspec'
spec = Pod::Specification.from_file(path).activate_platform(:ios) spec = Specification.from_file(path).activate_platform(:ios)
spec.name.should == 'Bananas' spec.name.should == 'Bananas'
spec.license.should == { :type => "MIT (example)" } spec.license.should == { :type => "MIT (example)" }
spec.version.should == Pod::Version.new('0.0.1') spec.version.should == Version.new('0.0.1')
spec.summary.should == 'A short description of Bananas.' spec.summary.should == 'A short description of Bananas.'
spec.homepage.should == 'http://EXAMPLE/Bananas' spec.homepage.should == 'http://EXAMPLE/Bananas'
spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip} spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip}
...@@ -43,10 +42,10 @@ describe "Pod::Command::Spec#create" do ...@@ -43,10 +42,10 @@ describe "Pod::Command::Spec#create" do
expect_github_tags_request expect_github_tags_request
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git') run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec' path = temporary_directory + 'libPusher.podspec'
spec = Pod::Specification.from_file(path) spec = Specification.from_file(path)
spec.name.should == 'libPusher' spec.name.should == 'libPusher'
spec.license.should == { :type => "MIT (example)" } spec.license.should == { :type => "MIT (example)" }
spec.version.should == Pod::Version.new('1.3') spec.version.should == Version.new('1.3')
spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)' spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher' spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
spec.authors.should == {"Luke Redpath"=>"luke@lukeredpath.co.uk"} spec.authors.should == {"Luke Redpath"=>"luke@lukeredpath.co.uk"}
...@@ -59,10 +58,10 @@ describe "Pod::Command::Spec#create" do ...@@ -59,10 +58,10 @@ describe "Pod::Command::Spec#create" do
expect_github_tags_request expect_github_tags_request
run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git') run_command('spec', 'create', 'other_name', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'other_name.podspec' path = temporary_directory + 'other_name.podspec'
spec = Pod::Specification.from_file(path) spec = Specification.from_file(path)
spec.name.should == 'other_name' spec.name.should == 'other_name'
spec.license.should == { :type => "MIT (example)" } spec.license.should == { :type => "MIT (example)" }
spec.version.should == Pod::Version.new('1.3') spec.version.should == Version.new('1.3')
spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)' spec.summary.should == 'An Objective-C interface to Pusher (pusherapp.com)'
spec.homepage.should == 'https://github.com/lukeredpath/libPusher' spec.homepage.should == 'https://github.com/lukeredpath/libPusher'
spec.authors.should == {"Luke Redpath"=>"luke@lukeredpath.co.uk"} spec.authors.should == {"Luke Redpath"=>"luke@lukeredpath.co.uk"}
...@@ -76,8 +75,8 @@ describe "Pod::Command::Spec#create" do ...@@ -76,8 +75,8 @@ describe "Pod::Command::Spec#create" do
expect_github_branches_request expect_github_branches_request
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git') run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec' path = temporary_directory + 'libPusher.podspec'
spec = Pod::Specification.from_file(path) spec = Specification.from_file(path)
spec.version.should == Pod::Version.new('0.0.1') spec.version.should == Version.new('0.0.1')
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' } spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' }
end end
...@@ -90,16 +89,15 @@ describe "Pod::Command::Spec#create" do ...@@ -90,16 +89,15 @@ describe "Pod::Command::Spec#create" do
output.should.include 'MARKDOWN TEMPLATE' output.should.include 'MARKDOWN TEMPLATE'
output.should.include 'Please add semantic version tags' output.should.include 'Please add semantic version tags'
end end
end end
describe "Pod::Command::Spec#lint" do describe "Command::Spec#lint" do
extend SpecHelper::Command
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "complains if it can't find any spec to lint" do it "complains if it can't find any spec to lint" do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
lambda { command('spec', 'lint').run }.should.raise Pod::Informative lambda { command('spec', 'lint').run }.should.raise Informative
end end
end end
...@@ -107,7 +105,7 @@ describe "Pod::Command::Spec#lint" do ...@@ -107,7 +105,7 @@ describe "Pod::Command::Spec#lint" 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') cmd = command('spec', 'lint', '--quick', '--only-errors')
cmd.run cmd.run
Pod::UI.output.should.include "passed validation" UI.output.should.include "passed validation"
end end
end end
...@@ -126,15 +124,16 @@ describe "Pod::Command::Spec#lint" do ...@@ -126,15 +124,16 @@ describe "Pod::Command::Spec#lint" do
@spec_path = file.to_s @spec_path = file.to_s
end end
it "lints a givent podspec" do it "lints a given podspec" do
cmd = command('spec', 'lint', '--quick', @spec_path) cmd = command('spec', 'lint', '--quick', @spec_path)
lambda { cmd.run }.should.raise Pod::Informative lambda { cmd.run }.should.raise Informative
Pod::UI.output.should.include "Missing license type" UI.output.should.include "Missing license type"
end end
it "respects the -only--errors option" do it "respects the -only--errors option" do
cmd = command('spec', 'lint', '--quick', '--only-errors', @spec_path) cmd = command('spec', 'lint', '--quick', '--only-errors', @spec_path)
lambda { cmd.run }.should.not.raise lambda { cmd.run }.should.not.raise
Pod::UI.output.should.include "Missing license type" UI.output.should.include "Missing license type"
end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe Pod::Command::Update do module Pod
extend SpecHelper::Command describe Command::Update do
extend SpecHelper::TemporaryDirectory extend SpecHelper::TemporaryDirectory
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "tells the user that no Podfile was found in the current working dir" do it "tells the user that no Podfile was found in the current working dir" do
exception = lambda { run_command('update','--no-update') }.should.raise Pod::Informative exception = lambda { run_command('update','--no-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the current working directory." exception.message.should.include "No `Podfile' found in the current working directory."
end end
...@@ -14,9 +14,10 @@ describe Pod::Command::Update do ...@@ -14,9 +14,10 @@ describe Pod::Command::Update do
file = temporary_directory + 'Podfile' file = temporary_directory + 'Podfile'
File.open(file, 'w') {|f| f.write('platform :ios') } File.open(file, 'w') {|f| f.write('platform :ios') }
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
exception = lambda { run_command('update','--no-update') }.should.raise Pod::Informative exception = lambda { run_command('update','--no-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the current working directory" exception.message.should.include "No `Podfile.lock' found in the current working directory"
end end
end end
end
end end
require File.expand_path('../../spec_helper', __FILE__)
# describe "Pod::Command" do
# extend SpecHelper::Command
# extend SpecHelper::TemporaryDirectory
# extend SpecHelper::TemporaryRepos
#
# TODO:
# it "raises help informative if an unknown parameter is passed"
# it "performs setup if needed"
# end
...@@ -21,13 +21,18 @@ require 'spec_helper/temporary_repos' ...@@ -21,13 +21,18 @@ require 'spec_helper/temporary_repos'
require 'spec_helper/user_interface' require 'spec_helper/user_interface'
require 'spec_helper/pre_flight' require 'spec_helper/pre_flight'
ENV['SKIP_SETUP'] = 'true'
require 'claide'
module Bacon module Bacon
class Context class Context
include Pod::Config::Mixin include Pod::Config::Mixin
include SpecHelper::Fixture include SpecHelper::Fixture
include SpecHelper::Command
def argv(*argv) def argv(*argv)
Pod::Command::ARGV.new(argv) CLAide::ARGV.new(argv)
end end
end end
end end
......
...@@ -4,7 +4,7 @@ module SpecHelper ...@@ -4,7 +4,7 @@ module SpecHelper
module Command module Command
def command(*argv) def command(*argv)
argv << '--no-color' argv << '--no-color'
Pod::Command.parse(*argv) Pod::Command.parse(argv)
end end
def run_command(*args) def run_command(*args)
...@@ -14,7 +14,9 @@ module SpecHelper ...@@ -14,7 +14,9 @@ module SpecHelper
# been converted to use the UI.puts # been converted to use the UI.puts
config_silent = config.silent? config_silent = config.silent?
config.silent = false config.silent = false
command(*args).run cmd = command(*args)
cmd.validate!
cmd.run
config.silent = config_silent config.silent = config_silent
Pod::UI.output Pod::UI.output
end end
......
...@@ -28,7 +28,7 @@ module SpecHelper ...@@ -28,7 +28,7 @@ module SpecHelper
end end
def add_repo(name, from) def add_repo(name, from)
command = command('repo', 'add', name, from) command = Pod::Command.parse(['repo', 'add', name, from])
command.run command.run
# The test branch is used by the push specs # The test branch is used by the push specs
Dir.chdir(command.dir) do Dir.chdir(command.dir) do
......
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Command" do module Pod
describe Command do
it "returns the proper command class" do it "returns the proper command class" do
Pod::Command.parse('setup').should.be.instance_of Pod::Command::Setup Command.parse(%w{ install }).should.be.instance_of Command::Install
Pod::Command.parse('spec', 'create', 'name').should.be.instance_of Pod::Command::Spec Command.parse(%w{ list }).should.be.instance_of Command::List
Pod::Command.parse('repo', 'update').should.be.instance_of Pod::Command::Repo Command.parse(%w{ outdated }).should.be.instance_of Command::Outdated
Command.parse(%w{ push }).should.be.instance_of Command::Push
Command.parse(%w{ repo }).should.be.instance_of Command::Repo
Command.parse(%w{ repo add }).should.be.instance_of Command::Repo::Add
Command.parse(%w{ repo lint }).should.be.instance_of Command::Repo::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
Command.parse(%w{ search }).should.be.instance_of Command::Search
Command.parse(%w{ setup }).should.be.instance_of Command::Setup
Command.parse(%w{ spec create }).should.be.instance_of Command::Spec::Create
Command.parse(%w{ spec lint }).should.be.instance_of Command::Spec::Lint
Command.parse(%w{ repo update }).should.be.instance_of Command::Repo::Update
end end
end
describe "Pod::Command::Repo" do
it "complains about unknown arguments" do
lambda { Pod::Command::Repo.new(argv('something')) }.should.raise Pod::Command::Help
end end
end end
...@@ -14,9 +14,9 @@ module Pod ...@@ -14,9 +14,9 @@ module Pod
it "holds the context state, such as cached specification sets" do it "holds the context state, such as cached specification sets" do
@resolver.resolve @resolver.resolve
@resolver.cached_sets.values.sort_by(&:name).should == [ @resolver.cached_sets.values.sort_by(&:name).should == [
Pod::Source.search_by_name('A2DynamicDelegate').first, Source.search_by_name('A2DynamicDelegate').first,
Pod::Source.search_by_name('BlocksKit').first, Source.search_by_name('BlocksKit').first,
Pod::Source.search_by_name('libffi').first Source.search_by_name('libffi').first
].sort_by(&:name) ].sort_by(&:name)
end end
...@@ -34,7 +34,7 @@ module Pod ...@@ -34,7 +34,7 @@ module Pod
end end
it "raises once any of the dependencies does not match the platform of its podfile target" do it "raises once any of the dependencies does not match the platform of its podfile target" do
set = Pod::Source.search_by_name('BlocksKit').first set = Source.search_by_name('BlocksKit').first
@resolver.cached_sets['BlocksKit'] = set @resolver.cached_sets['BlocksKit'] = set
def set.stub_platform=(platform); @stubbed_platform = platform; end def set.stub_platform=(platform); @stubbed_platform = platform; end
...@@ -54,7 +54,7 @@ module Pod ...@@ -54,7 +54,7 @@ module Pod
end end
it "raises once any of the dependencies does not have a deployment_target compatible with its podfile target" do it "raises once any of the dependencies does not have a deployment_target compatible with its podfile target" do
set = Pod::Source.search_by_name('BlocksKit').first set = Source.search_by_name('BlocksKit').first
@resolver.cached_sets['BlocksKit'] = set @resolver.cached_sets['BlocksKit'] = set
@podfile.platform :ios, "4.0" @podfile.platform :ios, "4.0"
...@@ -200,7 +200,7 @@ module Pod ...@@ -200,7 +200,7 @@ module Pod
pod 'JSONKit', "1.5pre" pod 'JSONKit', "1.5pre"
end end
resolver = Resolver.new(podfile, nil, stub('sandbox')) resolver = Resolver.new(podfile, nil, stub('sandbox'))
lambda {resolver.resolve}.should.raise Pod::Informative lambda {resolver.resolve}.should.raise Informative
end end
describe "Concerning Installation mode" do describe "Concerning Installation mode" do
...@@ -212,11 +212,11 @@ module Pod ...@@ -212,11 +212,11 @@ module Pod
pod 'JSONKit' pod 'JSONKit'
end end
@specs = [ @specs = [
Pod::Specification.new do |s| Specification.new do |s|
s.name = "BlocksKit" s.name = "BlocksKit"
s.version = "1.0.0" s.version = "1.0.0"
end, end,
Pod::Specification.new do |s| Specification.new do |s|
s.name = "JSONKit" s.name = "JSONKit"
s.version = "1.4" s.version = "1.4"
end ] end ]
...@@ -300,7 +300,7 @@ module Pod ...@@ -300,7 +300,7 @@ module Pod
pod 'JSONKit' pod 'JSONKit'
end end
config.skip_repo_update = false config.skip_repo_update = false
Pod::Command::Repo.any_instance.expects(:run).never Command::Repo.any_instance.expects(:run).never
@resolver = Resolver.new(podfile, @lockfile, stub('sandbox')) @resolver = Resolver.new(podfile, @lockfile, stub('sandbox'))
@resolver.resolve @resolver.resolve
end end
...@@ -313,7 +313,7 @@ module Pod ...@@ -313,7 +313,7 @@ module Pod
pod 'libPusher' # New pod pod 'libPusher' # New pod
end end
config.skip_repo_update = false config.skip_repo_update = false
Pod::Command::Repo.any_instance.expects(:run).once Command::Repo::Update.any_instance.expects(:run).once
@resolver = Resolver.new(podfile, @lockfile, stub('sandbox')) @resolver = Resolver.new(podfile, @lockfile, stub('sandbox'))
@resolver.resolve @resolver.resolve
end end
...@@ -326,7 +326,7 @@ module Pod ...@@ -326,7 +326,7 @@ module Pod
pod 'libPusher' # New pod pod 'libPusher' # New pod
end end
config.skip_repo_update = true config.skip_repo_update = true
Pod::Command::Repo.any_instance.expects(:run).never Command::Repo::Update.any_instance.expects(:run).never
@resolver = Resolver.new(podfile, @lockfile, stub('sandbox')) @resolver = Resolver.new(podfile, @lockfile, stub('sandbox'))
@resolver.resolve @resolver.resolve
end end
...@@ -338,7 +338,7 @@ module Pod ...@@ -338,7 +338,7 @@ module Pod
pod 'JSONKit', :head #changed to head pod 'JSONKit', :head #changed to head
end end
config.skip_repo_update = false config.skip_repo_update = false
Pod::Command::Repo.any_instance.expects(:run).once Command::Repo::Update.any_instance.expects(:run).once
@resolver = Resolver.new(podfile, @lockfile, stub('sandbox')) @resolver = Resolver.new(podfile, @lockfile, stub('sandbox'))
@resolver.resolve @resolver.resolve
end end
...@@ -354,11 +354,11 @@ module Pod ...@@ -354,11 +354,11 @@ module Pod
pod 'libPusher' pod 'libPusher'
end end
@specs = [ @specs = [
Pod::Specification.new do |s| Specification.new do |s|
s.name = "libPusher" s.name = "libPusher"
s.version = "1.3" s.version = "1.3"
end, end,
Pod::Specification.new do |s| Specification.new do |s|
s.name = "JSONKit" s.name = "JSONKit"
s.version = "1.4" s.version = "1.4"
end ] end ]
...@@ -411,7 +411,7 @@ module Pod ...@@ -411,7 +411,7 @@ module Pod
pod 'libPusher' pod 'libPusher'
end end
config.skip_repo_update = false config.skip_repo_update = false
Pod::Command::Repo.any_instance.expects(:run).once Command::Repo::Update.any_instance.expects(:run).once
@resolver = Resolver.new(podfile, @lockfile, stub('sandbox')) @resolver = Resolver.new(podfile, @lockfile, stub('sandbox'))
@resolver.update_mode = true @resolver.update_mode = true
@resolver.resolve @resolver.resolve
......
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