Module: Monkey::Gun::CliHelpers

Defined in:
lib/monkey/gun/cli_helpers.rb

Instance Method Summary collapse

Instance Method Details

#check_for_binaries!(*binaries, &message_block) ⇒ Object



4
5
6
7
8
# File 'lib/monkey/gun/cli_helpers.rb', line 4

def check_for_binaries!(*binaries, &message_block)
  binaries.each do |bin|
    check_for_binary!(bin.to_s, &message_block)
  end
end

#check_for_binary!(binary, &message_block) ⇒ Object



10
11
12
13
14
15
# File 'lib/monkey/gun/cli_helpers.rb', line 10

def check_for_binary!(binary, &message_block)
  bin_location = `which #{binary.to_s}`
  if bin_location.nil? || bin_location.empty?
    raise message_block.call || ''
  end
end