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", 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", 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(type, 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
# File 'lib/xcode_build/formatters/progress_formatter.rb', line 37

def report_finished(type, object)
  puts
  puts
  puts "Finished in #{object.duration} seconds."
  
  if object.successful?
    puts green("#{type} succeeded.")
  else
    puts red("#{type} failed.")
    puts
    puts "Failed #{type.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|
        puts indent("   #{red(err.message)}")
        puts indent(cyan("   in #{err.file}:#{err.line.to_s}")) if err.file
        puts
      end
      
      error_counter += 1
    end
  end
  puts
end