Class: Xcodeproj::XCScheme::AbstractSchemeAction

Inherits:
XMLElementWrapper show all
Defined in:
lib/xcodeproj/scheme/abstract_scheme_action.rb

Overview

This abstract class aims to be the base class for every XxxAction class that have a #build_configuration attribute

Instance Attribute Summary

Attributes inherited from XMLElementWrapper

#xml_element

Instance Method Summary collapse

Methods inherited from XMLElementWrapper

#to_s

Instance Method Details

#add_post_action(post_action) ⇒ Object

Parameters:

  • post_action (ExecutionAction)

    Add an action to the list of actions to run after this scheme action. It can be either a 'Run Script' or a 'Send Email' action.


94
95
96
97
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 94

def add_post_action(post_action)
  post_actions = @xml_element.elements['PostActions'] || @xml_element.add_element('PostActions')
  post_actions.add_element(post_action.xml_element)
end

#add_pre_action(pre_action) ⇒ Object

Parameters:

  • pre_action (ExecutionAction)

    Add an action to the list of actions to run before this scheme action. It can be either a 'Run Script' or a 'Send Email' action.


58
59
60
61
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 58

def add_pre_action(pre_action)
  pre_actions = @xml_element.elements['PreActions'] || @xml_element.add_element('PreActions')
  pre_actions.add_element(pre_action.xml_element)
end

#build_configurationString

Returns The build configuration associated with this action (usually either 'Debug' or 'Release').

Returns:

  • (String)

    The build configuration associated with this action (usually either 'Debug' or 'Release')


15
16
17
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 15

def build_configuration
  @xml_element.attributes['buildConfiguration']
end

#build_configuration=(config_name) ⇒ Object

Parameters:

  • config_name (String)

    The build configuration to associate with this action (usually either 'Debug' or 'Release')


23
24
25
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 23

def build_configuration=(config_name)
  @xml_element.attributes['buildConfiguration'] = config_name
end

#post_actionsArray<ExecutionAction>

Returns The list of actions to run after this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.

Returns:

  • (Array<ExecutionAction>)

    The list of actions to run after this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.


67
68
69
70
71
72
73
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 67

def post_actions
  post_actions = @xml_element.elements['PostActions']
  return nil unless post_actions
  post_actions.get_elements('ExecutionAction').map do |entry_node|
    ExecutionAction.new(entry_node)
  end
end

#post_actions=(post_actions) ⇒ Object

Parameters:

  • post_actions (Array<ExecutionAction>)

    Set the list of actions to run after this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.


79
80
81
82
83
84
85
86
87
88
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 79

def post_actions=(post_actions)
  @xml_element.delete_element('PostActions')
  unless post_actions.empty?
    post_actions_element = @xml_element.add_element('PostActions')
    post_actions.each do |entry_node|
      post_actions_element.add_element(entry_node.xml_element)
    end
  end
  post_actions
end

#pre_actionsArray<ExecutionAction>

Returns The list of actions to run before this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.

Returns:

  • (Array<ExecutionAction>)

    The list of actions to run before this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.


31
32
33
34
35
36
37
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 31

def pre_actions
  pre_actions = @xml_element.elements['PreActions']
  return nil unless pre_actions
  pre_actions.get_elements('ExecutionAction').map do |entry_node|
    ExecutionAction.new(entry_node)
  end
end

#pre_actions=(pre_actions) ⇒ Object

Parameters:

  • pre_actions (Array<ExecutionAction>)

    Set the list of actions to run before this scheme action. Each entry can be either a 'Run Script' or a 'Send Email' action.


43
44
45
46
47
48
49
50
51
52
# File 'lib/xcodeproj/scheme/abstract_scheme_action.rb', line 43

def pre_actions=(pre_actions)
  @xml_element.delete_element('PreActions')
  unless pre_actions.empty?
    pre_actions_element = @xml_element.add_element('PreActions')
    pre_actions.each do |entry_node|
      pre_actions_element.add_element(entry_node.xml_element)
    end
  end
  pre_actions
end