Class: XcodeBuild::Formatters::ProgressFormatter

Inherits:
Object
  • Object
show all
Includes:
Utilities::Colorize
Defined in:
lib/xcode_build/formatters/progress_formatter.rb

Instance Method Summary collapse

Methods included from Utilities::Colorize

#blue, #bold, #color, #cyan, #green, #magenta, #red, #short_padding, #white, #yellow

Constructor Details

#initialize(output = STDOUT) ⇒ ProgressFormatter

Returns a new instance of ProgressFormatter.



9
10
11
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 9

def initialize(output = STDOUT)
  @output = output
end

Instance Method Details

#build_finished(build) ⇒ Object



33
34
35
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 33

def build_finished(build)
  report_finished(build)
end

#build_started(build) ⇒ Object



25
26
27
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 25

def build_started(build)
  report_started("Building", build)
end

#build_step_finished(step) ⇒ Object



29
30
31
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 29

def build_step_finished(step)
  report_step_finished(step)
end

#clean_finished(clean) ⇒ Object



21
22
23
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 21

def clean_finished(clean)
  report_finished(clean)
end

#clean_started(clean) ⇒ Object



13
14
15
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 13

def clean_started(clean)
  report_started("Cleaning", clean)
end

#clean_step_finished(step) ⇒ Object



17
18
19
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 17

def clean_step_finished(step)
  report_step_finished(step)
end

#report_finished(object) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 37

def report_finished(object)
  puts
  puts
  puts "Finished in #{object.duration} seconds."
  
  if object.successful?
    puts green("#{object.label} succeeded.")
  else
    puts red("#{object.label} failed.")
    puts
    puts "Failed #{object.label.downcase} steps:"
    puts
    error_counter = 1
    object.steps_completed.each do |step|
      next unless step.has_errors?

      puts indent("#{error_counter}) #{step.type} #{step.arguments.join(" ")}")

      step.errors.each do |err|
        print indent("   #{red(err.message)}")
        if err.error_detail
          puts indent(cyan(err.error_detail)) 
        else
          puts
        end
        puts
      end
      
      error_counter += 1
    end
  end
  puts
end