class Cuesmash::Compiler

The calamsash compiler will compiles the Xcode project with the scheme it's told to compile with.

Attributes

scheme[RW]

Public: the Scheme the compiler is compiling

tmp_dir[RW]

Public Class Methods

new(scheme, tmp_dir) click to toggle source
# File lib/cuesmash/compiler.rb, line 13
def initialize(scheme, tmp_dir)
  @scheme = scheme
  @tmp_dir = tmp_dir
end

Public Instance Methods

compile() click to toggle source

The compiler's heart, executes the compiling with xcodebuild

Returns nothing because it completes with a complete block

# File lib/cuesmash/compiler.rb, line 22
def compile
  started
  status = nil

  Open3.popen3 command do |_stdin, out, err, wait_thr|
    print "\n"
    [out, err].each do |stream|
      Thread.new do
        until (line = stream.gets).nil?
          Logger.info line
        end
      end
    end
    wait_thr.join
    status = wait_thr.value.exitstatus
  end

  if status != 0
    # Logger.fatal "Compilation failed: #{output}"
    exit status
    status
  else
    completed
  end
end

Private Instance Methods

completed() click to toggle source

Output a nice message for completing

# File lib/cuesmash/compiler.rb, line 60
def completed
  Logger.info 'Compiled 👌'
end
started() click to toggle source

Output a nice message for starting

# File lib/cuesmash/compiler.rb, line 53
def started
  Logger.info 'Compiling'
end