Module: Aptible::CLI::Helpers::System

Included in:
Agent
Defined in:
lib/aptible/cli/helpers/system.rb

Instance Method Summary collapse

Instance Method Details

#ask_then_line(*args) ⇒ Object



18
19
20
21
22
# File 'lib/aptible/cli/helpers/system.rb', line 18

def ask_then_line(*args)
  ret = ask(*args)
  puts ''
  ret
end

#which(cmd) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/aptible/cli/helpers/system.rb', line 5

def which(cmd)
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']

  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{cmd}#{ext}")
      return exe if File.executable?(exe) && !File.directory?(exe)
    end
  end

  nil
end