module Megam::Stuff

Public Instance Methods

git(args) click to toggle source
# File lib/megam/core/stuff.rb, line 9
def git(args)
    return "" unless has_git?
    flattened_args = [args].flatten.compact.join(" ")
    %x{ git #{flattened_args} 2>&1 }.strip
end
has_git?() click to toggle source
# File lib/megam/core/stuff.rb, line 4
def has_git?
    %x{ git --version }
    $?.success?
end
styled_hash(hash) click to toggle source

left justified keyed hash with newlines.

# File lib/megam/core/stuff.rb, line 17
def styled_hash(hash)
    hash.map{|k,v| "#{k.ljust(15)}=#{v}"}.join("\n")
end