Class: Xcodeproj::XCScheme::ProfileAction

Inherits:
AbstractSchemeAction show all
Defined in:
lib/xcodeproj/scheme/profile_action.rb

Overview

This class wraps the ProfileAction node of a .xcscheme XML file

Instance Attribute Summary

Attributes inherited from XMLElementWrapper

#xml_element

Instance Method Summary collapse

Methods inherited from AbstractSchemeAction

#add_post_action, #add_pre_action, #build_configuration, #build_configuration=, #post_actions, #post_actions=, #pre_actions, #pre_actions=

Methods inherited from XMLElementWrapper

#to_s

Constructor Details

#initialize(node = nil) ⇒ ProfileAction

Returns a new instance of ProfileAction.

Parameters:

  • node (REXML::Element) (defaults to: nil)

    The 'ProfileAction' XML node that this object will wrap. If nil, will create a default XML node to use.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xcodeproj/scheme/profile_action.rb', line 12

def initialize(node = nil)
  create_xml_element_with_fallback(node, 'ProfileAction') do
    # Setup default values for other (handled) attributes
    self.build_configuration = 'Release'
    self.should_use_launch_scheme_args_env = true

    # Add some attributes (that are not handled by this wrapper class yet but expected in the XML)
    @xml_element.attributes['savedToolIdentifier'] = ''
    @xml_element.attributes['useCustomWorkingDirectory'] = bool_to_string(false)
    @xml_element.attributes['debugDocumentVersioning'] = bool_to_string(true)
  end
end

Instance Method Details

#buildable_product_runnableBuildableProductRunnable

Returns The BuildableProductRunnable to launch when launching the Profile action.

Returns:



44
45
46
# File 'lib/xcodeproj/scheme/profile_action.rb', line 44

def buildable_product_runnable
  BuildableProductRunnable.new @xml_element.elements['BuildableProductRunnable'], 0
end

#buildable_product_runnable=(runnable) ⇒ Object

Parameters:

  • runnable (BuildableProductRunnable)

    Set the BuildableProductRunnable referencing the target to launch when profiling



51
52
53
54
# File 'lib/xcodeproj/scheme/profile_action.rb', line 51

def buildable_product_runnable=(runnable)
  @xml_element.delete_element('BuildableProductRunnable')
  @xml_element.add_element(runnable.xml_element) if runnable
end

#should_use_launch_scheme_args_env=(flag) ⇒ Object

Parameters:

  • flag (Bool)

    Set Whether this Profile Action should use the same arguments and environment variables as the Launch Action.



37
38
39
# File 'lib/xcodeproj/scheme/profile_action.rb', line 37

def should_use_launch_scheme_args_env=(flag)
  @xml_element.attributes['shouldUseLaunchSchemeArgsEnv'] = bool_to_string(flag)
end

#should_use_launch_scheme_args_env?Bool

Returns Whether this Profile Action should use the same arguments and environment variables as the Launch Action.

Returns:

  • (Bool)

    Whether this Profile Action should use the same arguments and environment variables as the Launch Action.



29
30
31
# File 'lib/xcodeproj/scheme/profile_action.rb', line 29

def should_use_launch_scheme_args_env?
  string_to_bool(@xml_element.attributes['shouldUseLaunchSchemeArgsEnv'])
end