Module: GitImproved::ActionHelper

Included in:
GitAction
Defined in:
lib/git-improved.rb

Instance Method Summary collapse

Instance Method Details

#git(*args) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/git-improved.rb', line 105

def git(*args)
  argstr = args.collect {|s| _qq(s) }.join(" ")
  echoback("git #{argstr}")
  return if $DRYRUN_MODE
  out = $SUBPROCESS_OUTPUT || nil
  if out
    system(["git", "git"], *args, out: out, err: out)  or
      raise GitCommandFailed, "git #{argstr}"
  else
    system(["git", "git"], *args)  or
      raise GitCommandFailed, "git #{argstr}"
  end
end

#git!(*args) ⇒ Object



119
120
121
122
123
# File 'lib/git-improved.rb', line 119

def git!(*args)
  git(*args)
rescue GitCommandFailed
  false
end

#system!(command) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/git-improved.rb', line 125

def system!(command)
  out = $SUBPROCESS_OUTPUT || nil
  if out
    system command, exception: true, out: out, err: out
  else
    system command, exception: true
  end
end