Commit dcd537a5 authored by Eloy Duran's avatar Eloy Duran

Fix command unit specs.

parent b64c0c1f
......@@ -48,7 +48,7 @@ module Pod
end
def add
puts "==> Cloning spec repo `#{@name}' from `#{@url}'"
puts "==> Cloning spec repo `#{@name}' from `#{@url}'" unless config.silent?
config.repos_dir.mkpath
Dir.chdir(config.repos_dir) { git("clone #{@url} #{@name}") }
end
......@@ -56,7 +56,7 @@ module Pod
def update
dirs = @name ? [dir] : config.repos_dir.children
dirs.each do |dir|
puts "==> Updating spec repo `#{dir.basename}'"
puts "==> Updating spec repo `#{dir.basename}'" unless config.silent?
Dir.chdir(dir) { git("pull") }
end
end
......
......@@ -10,12 +10,16 @@ module Pod
@instance = instance
end
attr_accessor :repos_dir, :clean, :verbose
attr_accessor :repos_dir, :clean, :verbose, :silent
alias_method :clean?, :clean
alias_method :verbose?, :verbose
alias_method :silent?, :silent
def initialize
@repos_dir = Pathname.new(File.expand_path("~/.cocoa-pods"))
@clean = true
@verbose = false
@silent = false
end
def project_root
......
......@@ -24,7 +24,9 @@ module Pod
end
def install!
unless config.silent?
puts "Installing dependencies defined in: #{@top_level_specification.defined_in_file}"
end
install_dependent_specifications!
generate_project
write_files!
......@@ -40,7 +42,7 @@ module Pod
end
def generate_project
puts "==> Creating Pods project files"
puts "==> Creating Pods project files" unless config.silent?
dependent_specification_sets.each do |set|
# In case the set is only part of other pods we don't need to build
# the pod itself.
......
......@@ -145,7 +145,7 @@ module Pod
# end
# end
def install!
puts "==> Installing: #{self}"
puts "==> Installing: #{self}" unless config.silent?
config.project_pods_root.mkpath
require 'fileutils'
FileUtils.cp(@defined_in_file, config.project_pods_root)
......@@ -157,9 +157,9 @@ module Pod
def download_if_necessary!
if pod_destroot.exist?
puts " * Skipping download of #{self}, pod already downloaded"
puts " * Skipping download of #{self}, pod already downloaded" unless config.silent?
else
puts " * Downloading: #{self}"
puts " * Downloading: #{self}" unless config.silent?
download!
end
end
......
......@@ -20,6 +20,12 @@ class Bacon::Context
include Pod::Config::Mixin
include SpecHelper::Fixture
def argv(*argv)
Pod::Command::ARGV.new(argv)
end
end
Pod::Config.instance.repos_dir = SpecHelper.tmp_repos_path
config = Pod::Config.instance
config.silent = true
config.repos_dir = SpecHelper.tmp_repos_path
......@@ -2,34 +2,25 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Command" do
it "returns the proper command class" do
Pod::Command.parse("help").should.be.instance_of Pod::Command::Help
Pod::Command.parse("setup").should.be.instance_of Pod::Command::Setup
Pod::Command.parse("spec").should.be.instance_of Pod::Command::Spec
Pod::Command.parse("repo").should.be.instance_of Pod::Command::Repo
Pod::Command.parse('setup').should.be.instance_of Pod::Command::Setup
#Pod::Command.parse('spec').should.be.instance_of Pod::Command::Spec
Pod::Command.parse('repo', 'update').should.be.instance_of Pod::Command::Repo
end
end
describe "Pod::Command::Setup" do
it "complains about unknown arguments" do
lambda { Pod::Command::Setup.new('something') }.should.raise ArgumentError
end
before do
@command = Pod::Command::Setup.new
lambda { Pod::Command::Setup.new(argv('something')) }.should.raise Pod::Command::Help
end
it "returns the URL of the `master' spec-repo" do
@command.master_repo_url.should == 'git://github.com/alloy/cocoa-pod-specs.git'
command = Pod::Command::Setup.new(argv)
command.master_repo_url.should == 'git://github.com/alloy/cocoa-pod-specs.git'
end
end
describe "Pod::Command::Repo" do
it "complains about unknown arguments" do
lambda { Pod::Command::Repo.new('something') }.should.raise ArgumentError
end
it "returns the path of the spec-repo directory" do
repo = Pod::Command::Repo.new('cd', 'private')
repo.dir.should == File.join(config.repos_dir, 'private')
lambda { Pod::Command::Repo.new(argv('something')) }.should.raise Pod::Command::Help
end
end
......@@ -33,12 +33,16 @@ describe "Pod::Config" do
end
describe "concerning default settings" do
it "prints out normal information" do
config.should.not.be.silent
end
it "does not print vebose information" do
config.verbose.should == false
config.should.not.be.verbose
end
it "cleans SCM dirs in dependency checkouts" do
config.clean.should == true
config.should.clean
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