Commit 859b4552 authored by Fabio Pelosin's avatar Fabio Pelosin

[UserInterface] Print warnings at the end of the execution

- This also fixes and issue where the order of the warnings was not in
  sync with STDOUT.
parent 108111fa
......@@ -34,6 +34,7 @@ module Pod
exit!(0)
end
super(argv)
UI.print_warnings
end
def self.report_error(error)
......
......@@ -84,7 +84,6 @@ module Pod
resolve_dependencies
download_dependencies
generate_pods_project
integrate_user_project if config.integrate_targets?
end
......
......@@ -13,12 +13,15 @@ module Pod
@title_level = 0
@indentation_level = 2
@treat_titles_as_messages = false
@warnings = []
class << self
include Config::Mixin
attr_accessor :indentation_level, :title_level
attr_accessor :indentation_level
attr_accessor :title_level
attr_accessor :warnings
# Prints a title taking an optional verbose prefix and
# a relative indentation valid for the UI action in the passed
......@@ -133,8 +136,8 @@ module Pod
puts("\n[!] #{message}".green)
end
# Prints an important warning to the user optionally followed by actions
# that the user should take.
# Stores important warning to the user optionally followed by actions
# that the user should take. To print them use #{print_warnings}
#
# @param [String] message The message to print.
# @param [Array] actions The actions that the user should take.
......@@ -142,11 +145,23 @@ module Pod
# return [void]
#
def warn(message, actions = [], verbose_only = false)
warnings << { :message => message, :actions => actions }
end
# Prints the stored warnings. This method is intended to be called at the
# end of the execution of the binary.
#
# @return [void]
#
def print_warnings
return if config.silent? && verbose_only
STDERR.puts("\n[!] #{message}".yellow)
actions.each do |action|
indented = wrap_string(action, " - ")
puts(indented)
STDOUT.flush
warnings.each do |warning|
STDERR.puts("\n[!] #{warning[:message]}".yellow)
warning[:actions].each do |action|
indented = wrap_string(action, " - ")
puts(indented)
end
end
end
......
......@@ -32,8 +32,6 @@ Downloading dependencies
Generating Pods project
- Creating Pods project
[!] Podfile#config is deprecated. The config is accessible from the parameter passed to the hooks
- Running pre install hooks
- Podfile
- Adding source files to Pods project
......@@ -60,3 +58,5 @@ Integrating client projects
[!] From now on use `SampleApp.xcworkspace`.
Integrating `libPods.a` into target `SampleApp` of project `SampleApp.xcodeproj`.
[!] Podfile#config is deprecated. The config is accessible from the parameter passed to the hooks
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