Class: CfnFlow::Git

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

Overview

Git helper module TODO: extract as plugin

Class Method Summary collapse

Class Method Details

.check_statusObject



15
16
17
18
19
20
21
22
# File 'lib/cfn_flow/git.rb', line 15

def check_status
  unless `git status -s`.empty?
    raise Thor::Error.new("Git working directory is not clean. Please commit or reset changes in order to release.")
  end
  unless $?.success?
    raise Thor::Error.new("Error running `git status`")
  end
end

.shaObject



6
7
8
9
10
11
12
13
# File 'lib/cfn_flow/git.rb', line 6

def sha
  command = "git rev-parse --verify HEAD"
  result = `#{command}`.chomp
  unless $?.success?
    raise Thor::Error.new("Error running `#{command}`")
  end
  result
end