class Cuesmash::IosCompiler

iOS Specific compiler

Attributes

build_configuration[RW]
scheme[RW]
tmp_dir[RW]

Public Class Methods

new(scheme:, tmp_dir:, build_configuration:, device: nil, device_name: nil) click to toggle source
# File lib/cuesmash/ios_compiler.rb, line 14
def initialize(scheme:, tmp_dir:, build_configuration:, device: nil, device_name: nil)
  @scheme = scheme
  @tmp_dir = tmp_dir
  @build_configuration = build_configuration
  @device = device
  @device_name = device_name
end

Public Instance Methods

command() click to toggle source

Generate the string to be used as the xcode build command using the scheme ivar

@return [String] The full xcode build command with args

# File lib/cuesmash/ios_compiler.rb, line 27
def command
  xcode_command = 'set -o pipefail '
  xcode_command << "&& xcodebuild #{workspace} "
  xcode_command << "-scheme '#{@scheme}' "
  xcode_command << "-derivedDataPath #{@tmp_dir.shellescape} "
  xcode_command << "-configuration #{@build_configuration} "
  xcode_command << "OBJROOT=#{@tmp_dir.shellescape} "
  xcode_command << "SYMROOT=#{@tmp_dir.shellescape} "
  xcode_command << "-destination 'platform=iOS Simulator,name=#{@device_name}' " if @device.nil?
  xcode_command << 'build '
  xcode_command << '| bundle exec xcpretty -c'

  Logger.info "xcode_command == #{xcode_command}"
  xcode_command
end
workspace() click to toggle source

Looks in the current directory for the workspace file and gets its name if there is one

@return [String] The name of the workspace file that was found along with the -workspace flag

# File lib/cuesmash/ios_compiler.rb, line 48
def workspace
  wp = Dir['*.xcworkspace'].first
  if wp
    flag = "-workspace #{wp}"
    Logger.debug "workspace == #{wp}"
    return flag
  else
    Logger.debug 'no workspace found'
    return wp
  end
end