Commit 3b83f2a6 authored by Fabio Pelosin's avatar Fabio Pelosin

[colors] Added colors to install

parent a8717ff2
require 'colored'
module Pod
class Command
autoload :ErrorReport, 'cocoapods/command/error_report'
......
......@@ -40,6 +40,7 @@ module Pod
raise Informative, "The specified project `#{@projpath}' does not exist."
end
if @update_repo
puts "\nUpdating Spec Repositories\n".yellow if config.verbose?
Repo.new(ARGV.new(["update"])).run
end
Installer.new(podfile, @projpath).install!
......
......@@ -45,10 +45,11 @@ module Pod
def install_dependencies!
activated_specifications.map do |spec|
LocalPod.new(spec, sandbox).tap do |pod|
marker = config.verbose ? "\n-> ".green : ''
if pod.exists? || spec.local?
puts "Using #{pod}" unless config.silent?
puts marker + "Using #{pod}" unless config.silent?
else
puts "Installing #{spec}" unless config.silent?
puts marker + "Installing #{spec}".green unless config.silent?
downloader = Downloader.for_pod(pod)
downloader.download
......@@ -59,7 +60,7 @@ module Pod
end
if config.doc?
puts "Installing Documentation for #{spec}" if config.verbose?
puts "Installing Documentation for #{spec}".green if config.verbose?
Generator::Documentation.new(pod).generate(config.doc_install?)
end
end
......@@ -70,10 +71,13 @@ module Pod
def install!
@sandbox.prepare_for_install
puts "Installing dependencies of: #{@podfile.defined_in_file}" if config.verbose?
puts_title "Resolving dependencies of: #{@podfile.defined_in_file}"
self.dependency_specifications_for_each_target_definition= @resolver.resolve
puts_title "Installing dependencies"
pods = install_dependencies!
puts "Generating support files" unless config.silent?
puts_title("Generating support files\n", false)
target_installers.each do |target_installer|
target_specs = activated_specifications_for_target(target_installer.target_definition)
pods_for_target = pods.select { |pod| target_specs.include?(pod.specification) }
......@@ -86,7 +90,7 @@ module Pod
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
run_post_install_hooks
puts "* Writing Xcode project file to `#{@sandbox.project_path}'" if config.verbose?
puts "* Writing Xcode project file to `#{@sandbox.project_path}'\n\n" if config.verbose?
project.save_as(@sandbox.project_path)
UserProjectIntegrator.new(@user_project_path, @podfile).integrate! if @user_project_path
......@@ -134,9 +138,7 @@ module Pod
end
end
def dependency_specifications_for_each_target_definition
@dependency_specifications_for_each_target_definition ||= @resolver.resolve
end
attr_accessor :dependency_specifications_for_each_target_definition
def dependency_specifications
dependency_specifications_for_each_target_definition.values.flatten
......@@ -157,5 +159,15 @@ module Pod
def download_only_specifications
dependency_specifications - activated_specifications
end
private
def puts_title(title, only_verbose = true)
if(config.verbose?)
puts "\n" + title.yellow
elsif(!config.silent? && !only_verbose)
puts title
end
end
end
end
......@@ -10,20 +10,19 @@ module Pod
@sandbox = sandbox
@cached_sets = {}
@cached_sources = Source::Aggregate.new
@log_indent = 1;
@log_indent = 0;
end
def resolve
@specs = {}
result = @podfile.target_definitions.values.inject({}) do |result, target_definition|
puts "\n--> Finding dependencies for target `#{target_definition.name}'" if config.verbose?
puts "\nFinding dependencies for target `#{target_definition.name}'".green if config.verbose?
@loaded_specs = []
find_dependency_sets(@podfile, target_definition.dependencies)
result[target_definition] = @specs.values_at(*@loaded_specs).sort_by(&:name)
result
end
puts if config.verbose?
# Specification doesn't need to know more about the context, so we assign
# the other specification, of which this pod is a part, to the spec.
......
......@@ -14,7 +14,7 @@ module Pod
def search(dependency)
all.map { |s| s.search(dependency) }.compact.first ||
raise(Informative, "Unable to find a pod named `#{dependency.name}'")
raise(Informative, "Unable to find a pod named `#{dependency.name}'".red)
end
def search_by_name(query, full_text_search)
......
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