Class: XcodeBuild::BuildAction

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode_build/build_action.rb

Defined Under Namespace

Classes: Warning

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ BuildAction

Returns a new instance of BuildAction.



10
11
12
13
14
15
16
# File 'lib/xcode_build/build_action.rb', line 10

def initialize()
  @steps_completed = []
  @metadata = 
  @started_at = Time.now
  @warnings = []
  super()
end

Instance Attribute Details

#finished_at=(value) ⇒ Object (writeonly)

Sets the attribute finished_at

Parameters:

  • value

    the value to set the attribute finished_at to.



8
9
10
# File 'lib/xcode_build/build_action.rb', line 8

def finished_at=(value)
  @finished_at = value
end

#steps_completedObject (readonly)

Returns the value of attribute steps_completed.



7
8
9
# File 'lib/xcode_build/build_action.rb', line 7

def steps_completed
  @steps_completed
end

#warningsObject (readonly)

Returns the value of attribute warnings.



7
8
9
# File 'lib/xcode_build/build_action.rb', line 7

def warnings
  @warnings
end

Instance Method Details

#add_step(params) ⇒ Object



32
33
34
# File 'lib/xcode_build/build_action.rb', line 32

def add_step(params)
  @steps_completed << BuildStep.new(params)
end

#add_warning(params) ⇒ Object



89
90
91
# File 'lib/xcode_build/build_action.rb', line 89

def add_warning(params)
  @warnings << Warning.new(params)
end

#configurationObject



81
82
83
# File 'lib/xcode_build/build_action.rb', line 81

def configuration
  @metadata[:configuration]
end

#default_configuration?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/xcode_build/build_action.rb', line 85

def default_configuration?
  @metadata[:default]
end

#durationObject



64
65
66
67
# File 'lib/xcode_build/build_action.rb', line 64

def duration
  return nil unless finished?
  @finished_at - @started_at
end

#error_countObject



60
61
62
# File 'lib/xcode_build/build_action.rb', line 60

def error_count
  has_errors? ? (failed_steps.map { |s| s.errors.length }) : 0
end

#failed_stepsObject



36
37
38
# File 'lib/xcode_build/build_action.rb', line 36

def failed_steps
  @steps_completed.select { |a| a.failed? }
end

#finished?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/xcode_build/build_action.rb', line 48

def finished?
  successful? || failed?
end

#has_errors?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/xcode_build/build_action.rb', line 52

def has_errors?
  failed_steps.any?
end

#has_warnings?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/xcode_build/build_action.rb', line 56

def has_warnings?
  warnings.any?
end

#labelObject



69
70
71
# File 'lib/xcode_build/build_action.rb', line 69

def label
  @label.downcase.capitalize
end

#last_stepObject



44
45
46
# File 'lib/xcode_build/build_action.rb', line 44

def last_step
  @steps_completed.last
end

#project_nameObject



73
74
75
# File 'lib/xcode_build/build_action.rb', line 73

def project_name
  @metadata[:project]
end

#step_with_params(params) ⇒ Object



40
41
42
# File 'lib/xcode_build/build_action.rb', line 40

def step_with_params(params)
  @steps_completed.detect { |a| a == BuildStep.new(params) }
end

#targetObject



77
78
79
# File 'lib/xcode_build/build_action.rb', line 77

def target
  @metadata[:target]
end