Sha256: eaff8600196e62df13e07e465321071d50f4285d08732c216a3196d7178dcb40

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

# coding: utf-8

module Cuesmash
  require 'shellwords'

  #
  # iOS Specific compiler
  #
  class IosCompiler < Compiler
    attr_accessor :scheme
    attr_accessor :tmp_dir
    attr_accessor :build_configuration

    def initialize(scheme:, tmp_dir:, build_configuration:)
      @scheme = scheme
      @tmp_dir = tmp_dir
      @build_configuration = build_configuration
    end

    #
    # Generate the string to be used as the xcode build command
    # using the scheme ivar
    #
    # @return [String] The full xcode build command with args
    def command
      xcode_command = "set -o pipefail && xcodebuild #{workspace} -scheme '#{@scheme}' -derivedDataPath #{@tmp_dir.shellescape} -configuration #{@build_configuration} OBJROOT=#{@tmp_dir.shellescape} SYMROOT=#{@tmp_dir.shellescape} -sdk iphonesimulator build | bundle exec xcpretty -c"

      Logger.info "xcode_command == #{xcode_command}"
      xcode_command
    end # command

    #
    # 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
    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 # workspace
  end # class IosCompiler
end # module Cuesmash

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cuesmash-0.3.0 lib/cuesmash/ios_compiler.rb
cuesmash-0.2.0.0 lib/cuesmash/ios_compiler.rb
cuesmash-0.1.9.9 lib/cuesmash/ios_compiler.rb
cuesmash-0.1.9.8 lib/cuesmash/ios_compiler.rb