Sha256: 15183081d97a7401691fe0c476a239e6ce78ce0a25cb2ed2f8b7a4a52b18f249

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

require 'background_process'
require 'tmpdir'

module ICuke
  class Simulator
    include Timeout
    
    def launch(project_file, options = {})
      options = {
        :configuration => 'Debug',
        :env => {}
      }.merge(options)
      
      app_name = File.basename(project_file, '.xcodeproj')
      directory = "#{File.dirname(project_file)}/build/#{options[:configuration]}-iphonesimulator"
      
      options[:env]['CFFIXED_USER_HOME'] = Dir.mktmpdir
      
      command = ICuke::SDK.launch("#{directory}/#{app_name}.app", options[:platform], options[:env])
      @simulator = BackgroundProcess.run(command)
      
      timeout(30) do
        begin
          view
        rescue Errno::ECONNREFUSED
          sleep(0.5)
          retry
        end
      end
    end
    
    def quit
      @simulator.kill('QUIT')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iCuke-0.6.1 lib/icuke/waxsim.rb
iCuke-0.6.0 lib/icuke/waxsim.rb