Sha256: b23968d0fb0d0c4dfe584629a97f5e9da2d30277d1b5f1a61c59fcac3b6bc818

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

require 'singleton'

module Luffa
  class Simulator

    include Singleton

    def core_simulator_home_dir
      @core_simulator_home_dir ||= File.expand_path('~/Library/Developer/CoreSimulator')
    end

    def core_simulator_device_dir(sim_udid=nil)
      if sim_udid.nil?
        @core_simulator_device_dir ||= File.expand_path(File.join(core_simulator_home_dir, 'Devices'))
      else
        File.expand_path(File.join(core_simulator_device_dir, sim_udid))
      end
    end

    def core_simulator_device_containers_dir(sim_udid)
      File.expand_path(File.join(core_simulator_device_dir(sim_udid), 'Containers'))
    end

    def core_simulator_for_xcode_version(idiom, form_factor, xcode_version)
      if xcode_version < Luffa::Version.new('6.1')
        ios_version = '8.0'
      elsif xcode_version < Luffa::Version.new('6.2')
        ios_version = '8.1'
      elsif xcode_version < Luffa::Version.new('6.3')
        ios_version = '8.2'
      elsif xcode_version >= Luffa::Version.new('6.3')
        ios_version = '8.3'
      else
        raise "Unsupported Xcode version: #{xcode_version}"
      end
      "#{idiom} #{form_factor} (#{ios_version} Simulator)"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
luffa-2.1.0 lib/luffa/ios/simulator.rb
luffa-2.0.0 lib/luffa/ios/simulator.rb
luffa-1.1.0 lib/luffa/ios/simulator.rb
luffa-1.0.7 lib/luffa/ios/simulator.rb
luffa-1.0.6 lib/luffa/ios/simulator.rb
luffa-1.0.5 lib/luffa/ios/simulator.rb
luffa-1.0.4 lib/luffa/ios/simulator.rb