module Bashman::ClassMethods

make the following functions available in every class

Public Instance Methods

get_config(section) click to toggle source
# File lib/bashman.rb, line 24
def get_config(section)
    require 'parseconfig'

    fullconfig = ParseConfig.new(CONFIG)
    config = {}
    config = fullconfig[section] if fullconfig.get_params.include?(section)
    config
end
which(binary) click to toggle source
# File lib/bashman.rb, line 17
def which(binary)
    ret = ''
    possibles = ENV["PATH"].split(File::PATH_SEPARATOR)
    possibles.map {|p| File.join(p, binary)}.find {|p| ret = p if File.executable?(p)}
    ret
end