Class: RunLoop::CLI::IDM

Inherits:
Thor
  • Object
show all
Includes:
Shell
Defined in:
lib/run_loop/cli/idm.rb

Constant Summary

Constants included from Shell

Shell::DEFAULT_OPTIONS

Instance Method Summary collapse

Methods included from Shell

run_shell_command, #run_shell_command

Methods included from Encoding

#transliterate

Instance Method Details

#install(app) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/run_loop/cli/idm.rb', line 37

def install(app)
  extension =  File.extname(app)
  if extension == ".app"
    app_instance = RunLoop::App.new(app)
  else
    app_instance = RunLoop::Ipa.new(app)
  end

  xcode = RunLoop::Xcode.new
  simctl = RunLoop::Simctl.new
  instruments = RunLoop::Instruments.new

  detect_options = {}

  device = options[:device]
  if !device
    detect_options[:device] = "device"
  else
    detect_options[:device] = device
  end

  device = RunLoop::Device.detect_device(detect_options, xcode,
                                         simctl, instruments)

  idm = RunLoop::PhysicalDevice::IOSDeviceManager.new(device)

  if options[:force]
    idm.install_app(app_instance)
  else
    idm.ensure_newest_installed(app_instance)
  end
end