class FbsimctlRb::Cmd

Attributes

fbsim[R]

Public Class Methods

new() click to toggle source
# File lib/fbsimctl_rb/command.rb, line 5
def initialize
  @fbsim = get_fbsimctl_path
end

Protected Instance Methods

method_missing(method, *args, &_block) click to toggle source
Calls superclass method
# File lib/fbsimctl_rb/command.rb, line 30
def method_missing(method, *args, &_block)
  if respond_to_missing?
    run(%W(#{@fbsim} #{method}) + args)
  else
    super
  end
end
respond_to_missing?() click to toggle source
# File lib/fbsimctl_rb/command.rb, line 38
def respond_to_missing?
  true
end

Private Instance Methods

get_fbsimctl_path() click to toggle source
# File lib/fbsimctl_rb/command.rb, line 22
def get_fbsimctl_path
  cmd = `which fbsimctl`.strip
  return cmd unless cmd.empty?
  raise "You should install fbsimctl. Read https://github.com/facebook/FBSimulatorControl/tree/master/fbsimctl"
end
run(*command) click to toggle source
# File lib/fbsimctl_rb/command.rb, line 11
def run(*command)
  cmd = command.join(' ')
  sto, ste, status = Open3.capture3(cmd)
  if status.success?
    sto
  else
    puts ste
    raise(sto)
  end
end