Sha256: 78daf85094fd66486a2645af0d9f2066c355a1963375463d9756afe82301e15e

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

module RunLoop
  # @!visibility private
  module DeviceAgent
    # @!visibility private
    #
    # An abstract base class for something that can launch the CBXRunner on a
    # device.  The CBXRunner is AKA the DeviceAgent.
    class Launcher
      require "run_loop/abstract"
      include RunLoop::Abstract

      # @!visibility private
      attr_reader :device

      # @!visibility private
      # @param [RunLoop::Device] device where to launch the CBX-Runner
      def initialize(device)
        @device = device

        if device.version < RunLoop::Version.new("9.0")
          raise ArgumentError, %Q[
Invalid device:

#{device}

XCUITest is only available for iOS >= 9.0
]
        end
      end

      # @!visibility private
      # The name of this launcher. Must be a symbol (keyword).  This value will
      # be used for the key :cbx_launcher in the RunLoop::Cache so Calabash
      # iOS can attach and reattach to an XCUITest instance.
      def name
        abstract_method!
      end

      # @!visibility private
      #
      # Does whatever it takes to launch the CBX-Runner on the device.
      def launch
        abstract_method!
      end

      # @!visibility private
      def self.dot_dir
        path = File.join(RunLoop::DotDir.directory, "xcuitest")

        if !File.exist?(path)
          FileUtils.mkdir_p(path)
        end

        path
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
run_loop-2.1.7 lib/run_loop/device_agent/launcher.rb
run_loop-2.1.6 lib/run_loop/device_agent/launcher.rb
run_loop-2.1.5 lib/run_loop/device_agent/launcher.rb
run_loop-2.1.4 lib/run_loop/device_agent/launcher.rb