class XcodeArchiveCache::Xcodebuild::Executor
Attributes
action[R]
@return [String]
args[R]
@return [String]
arguments_state[R]
@return [String]
configuration[R]
@return [String]
destinations[R]
@return [Array<String>]
platform[R]
@return [String]
shell_executor[RW]
@return [XcodeArchiveCache::Shell::Executor]
Public Class Methods
new(configuration, platform, destination, action, args)
click to toggle source
@param [String] configuration @param [String] platform @param [String] destination @param [String] action @param [String] args
# File lib/xcodebuild/executor.rb, line 18 def initialize(configuration, platform, destination, action, args) @configuration = configuration @platform = platform @destinations = destination.split("|") @action = action @args = args @shell_executor = XcodeArchiveCache::Shell::Executor.new @arguments_state = "#{configuration}-#{platform}-#{destination}-#{action}-#{args}" end
Public Instance Methods
build(project_path, scheme, derived_data_path)
click to toggle source
@param [String] project_path @param [String] scheme @param [String] derived_data_path
# File lib/xcodebuild/executor.rb, line 46 def build(project_path, scheme, derived_data_path) flags = [project_flag(project_path), configuration_flag, destination_flag, scheme_flag(scheme), derived_data_path_flag(derived_data_path), args, action] command = "#{compile_command(flags)} | xcpretty" shell_executor.execute(command, true) end
load_build_settings(project_path)
click to toggle source
@param [String] project_path
# File lib/xcodebuild/executor.rb, line 30 def load_build_settings(project_path) flags = [project_flag(project_path), configuration_flag, destination_flag, all_targets_flag, show_build_settings_flag, args, action] command = compile_command(flags) shell_executor.execute_for_output(command) end
set_up_for_simulator?()
click to toggle source
# File lib/xcodebuild/executor.rb, line 58 def set_up_for_simulator? destination_flag.include?("Simulator") end
Private Instance Methods
all_targets_flag()
click to toggle source
@return [String]
# File lib/xcodebuild/executor.rb, line 129 def all_targets_flag "-alltargets" end
compile_command(flags)
click to toggle source
@param [Array<String>] flags
@return [String]
# File lib/xcodebuild/executor.rb, line 92 def compile_command(flags) "xcodebuild #{flags.join(" ")}" end
configuration_flag()
click to toggle source
@return [String]
# File lib/xcodebuild/executor.rb, line 106 def configuration_flag "-configuration '#{configuration}'" end
derived_data_path_flag(path)
click to toggle source
@param [String] path
@return [String]
# File lib/xcodebuild/executor.rb, line 145 def derived_data_path_flag(path) "-derivedDataPath '#{path}'" end
destination_flag()
click to toggle source
@return [String]
# File lib/xcodebuild/executor.rb, line 112 def destination_flag platform_regexp = Regexp.new("#{platform}", Regexp::IGNORECASE) destination_by_platform = destinations.select {|destination| destination.match?(platform_regexp)}.first # archives can only be made with generic destination # inferred_destination = action == ARCHIVE_ACTION ? GENERIC_DESTINATION : destination_by_platform if inferred_destination == nil raise XcodeArchiveCache::Informative, "Destination not set for #{platform} platform" end destination_specifier = inferred_destination == GENERIC_DESTINATION ? "generic/platform=#{platform}" : inferred_destination "-destination '#{destination_specifier}'" end
project_flag(project_path)
click to toggle source
@param [String] project_path
@return [String]
# File lib/xcodebuild/executor.rb, line 100 def project_flag(project_path) "-project '#{project_path}'" end
scheme_flag(scheme)
click to toggle source
@param [String] scheme
@return [String]
# File lib/xcodebuild/executor.rb, line 137 def scheme_flag(scheme) "-scheme '#{scheme}'" end
show_build_settings_flag()
click to toggle source
@return [String]
# File lib/xcodebuild/executor.rb, line 151 def show_build_settings_flag "-showBuildSettings" end