Sha256: e4d7eb17c45d9e051ceb9d343de38da304a2f59b025b0b31b36d4f889f8fdc57

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

# coding: utf-8

module Cuesmash

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

    # Public: the Scheme the compiler is compiling
    attr_accessor :scheme
    attr_accessor :tmp_dir

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

    #
    # The compiler's heart, executes the compiling with xcodebuild
    #
    # Returns nothing because it completes with a complete block
    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? do
              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

    #
    # Output a nice message for starting
    #
    def started
      Logger.info "Compiling"
    end

    #
    # Output a nice message for completing
    #
    def completed
      Logger.info "Compiled 👌"
    end
  end # class compiler
end # module cuesmash

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cuesmash-0.1.9.7 lib/cuesmash/compiler.rb
cuesmash-0.1.9.6 lib/cuesmash/compiler.rb
cuesmash-0.1.9.5 lib/cuesmash/compiler.rb
cuesmash-0.1.9.4 lib/cuesmash/compiler.rb
cuesmash-0.1.9.3 lib/cuesmash/compiler.rb
cuesmash-0.1.9.2 lib/cuesmash/compiler.rb
cuesmash-0.1.9.1 lib/cuesmash/compiler.rb
cuesmash-0.1.9 lib/cuesmash/compiler.rb