Commit aa887ea0 authored by Fabio Pelosin's avatar Fabio Pelosin

[Command] Output cosmetics.

parent a30fcb67
...@@ -114,6 +114,24 @@ module Pod ...@@ -114,6 +114,24 @@ module Pod
def initialize(argv) def initialize(argv)
raise Help.new(self.class, argv) raise Help.new(self.class, argv)
end end
private
def print_title(title, only_verbose = true)
if config.verbose?
puts "\n" + title.yellow
elsif !config.silent? && !only_verbose
puts title
end
end
def print_subtitle(title, only_verbose = false)
if config.verbose?
puts "\n" + title.green
elsif !config.silent? && !only_verbose
puts title
end
end
end end
end end
...@@ -46,7 +46,7 @@ module Pod ...@@ -46,7 +46,7 @@ module Pod
end end
if @update_repo if @update_repo
puts "\nUpdating Spec Repositories\n".yellow if config.verbose? print_title 'Updating Spec Repositories', true
Repo.new(ARGV.new(["update"])).run Repo.new(ARGV.new(["update"])).run
end end
......
...@@ -43,7 +43,7 @@ module Pod ...@@ -43,7 +43,7 @@ module Pod
end end
def add def add
puts "Cloning spec repo `#{@name}' from `#{@url}'" unless config.silent? print_subtitle "Cloning spec repo `#{@name}' from `#{@url}'#{" (branch `#{@branch}')" if @branch}"
config.repos_dir.mkpath config.repos_dir.mkpath
Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") } Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") }
Dir.chdir(dir) { git("checkout #{@branch}") } if @branch Dir.chdir(dir) { git("checkout #{@branch}") } if @branch
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
def update def update
dirs = @name ? [dir] : config.repos_dir.children.select {|c| c.directory?} dirs = @name ? [dir] : config.repos_dir.children.select {|c| c.directory?}
dirs.each do |dir| dirs.each do |dir|
puts "Updating spec repo `#{dir.basename}'" unless config.silent? print_subtitle "Updating spec repo `#{dir.basename}'"
Dir.chdir(dir) { git("pull") } Dir.chdir(dir) { git("pull") }
check_versions(dir) check_versions(dir)
end end
......
...@@ -2,7 +2,7 @@ module Pod ...@@ -2,7 +2,7 @@ module Pod
class Command class Command
class Setup < Command class Setup < Command
def self.banner def self.banner
%{Setup CocoaPods environment: %{Setup CocoaPods environment:
$ pod setup $ pod setup
...@@ -90,6 +90,7 @@ module Pod ...@@ -90,6 +90,7 @@ module Pod
end end
def run def run
print_title "Setting up CocoaPods master repo"
if dir.exist? if dir.exist?
set_master_repo_url set_master_repo_url
set_master_repo_branch set_master_repo_branch
...@@ -103,7 +104,7 @@ module Pod ...@@ -103,7 +104,7 @@ module Pod
hook.open('w') { |f| f << "#!/bin/sh\nrake lint" } hook.open('w') { |f| f << "#!/bin/sh\nrake lint" }
`chmod +x '#{hook}'` `chmod +x '#{hook}'`
end end
puts "\nSetup completed (#{push? ? "push" : "read-only"} access)" unless config.silent print_subtitle "Setup completed (#{push? ? "push" : "read-only"} access)"
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