Permalink
Browse files

[Command] Output cosmetics.

  • Loading branch information...
1 parent a30fcb6 commit aa887ea0cada13081fc8292b9934202358a039d6 @fabiopelosin fabiopelosin committed May 29, 2012
Showing with 25 additions and 6 deletions.
  1. +18 −0 lib/cocoapods/command.rb
  2. +1 −1 lib/cocoapods/command/install.rb
  3. +2 −2 lib/cocoapods/command/repo.rb
  4. +4 −3 lib/cocoapods/command/setup.rb
View
@@ -114,6 +114,24 @@ def self.parse(*argv)
def initialize(argv)
raise Help.new(self.class, argv)
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
@@ -46,7 +46,7 @@ def run
end
if @update_repo
- puts "\nUpdating Spec Repositories\n".yellow if config.verbose?
+ print_title 'Updating Spec Repositories', true
Repo.new(ARGV.new(["update"])).run
end
@@ -43,7 +43,7 @@ def run
end
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
Dir.chdir(config.repos_dir) { git("clone '#{@url}' #{@name}") }
Dir.chdir(dir) { git("checkout #{@branch}") } if @branch
@@ -53,7 +53,7 @@ def add
def update
dirs = @name ? [dir] : config.repos_dir.children.select {|c| c.directory?}
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") }
check_versions(dir)
end
@@ -2,7 +2,7 @@ module Pod
class Command
class Setup < Command
def self.banner
-%{Setup CocoaPods environment:
+ %{Setup CocoaPods environment:
$ pod setup
@@ -55,7 +55,7 @@ def origin_url_push?
end
def push?
- @push_option || (dir.exist? && origin_url_push?)
+ @push_option || (dir.exist? && origin_url_push?)
end
def read_master_repo_url
@@ -90,6 +90,7 @@ def run_if_needed
end
def run
+ print_title "Setting up CocoaPods master repo"
if dir.exist?
set_master_repo_url
set_master_repo_branch
@@ -103,7 +104,7 @@ def run
hook.open('w') { |f| f << "#!/bin/sh\nrake lint" }
`chmod +x '#{hook}'`
end
- puts "\nSetup completed (#{push? ? "push" : "read-only"} access)" unless config.silent
+ print_subtitle "Setup completed (#{push? ? "push" : "read-only"} access)"
end
end
end

0 comments on commit aa887ea

Please sign in to comment.