Class: Edploy::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/edployscripts/git.rb

Class Method Summary collapse

Class Method Details

.git(*opts) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/edployscripts/git.rb', line 6

def git(*opts)
  options = opts.last.is_a?(Hash) ? opts.pop : {}
  opts << "--hard" if options[:hard]
  if message = options.delete(:message)
    opts << "-m '#{message}'"
  end
  opts << '2>/dev/null' if options[:silent]
  cmd = "git #{opts.map(&:to_s).join(' ')}"
  unless system(cmd)
    return if options[:silent]
    abort "error while running `#{cmd}'"
  end
end

.method_missing(method, *args, &block) ⇒ Object



20
21
22
# File 'lib/edployscripts/git.rb', line 20

def method_missing(method, *args, &block)
	git(*([method] + args))
end