module Egads::Build::BuildHelpers

Public Instance Methods

can_build?() click to toggle source
# File lib/egads/command/build.rb, line 63
def can_build?
  sha_is_checked_out? && working_directory_is_clean?
end
error(message) click to toggle source
# File lib/egads/command/build.rb, line 88
def error(message)
  lines = Array(message)
  say_status :error, lines.shift, :red
  lines.each {|line| say_status '', line }

  false
end
patch_path() click to toggle source
# File lib/egads/command/build.rb, line 84
def patch_path
  "#{sha}.patch"
end
sha_is_checked_out?() click to toggle source
# File lib/egads/command/build.rb, line 67
def sha_is_checked_out?
  head = run_with_code("git rev-parse --verify HEAD").strip
  short_head = head[0,7]
  head == sha or error [
    "Cannot build #{short_sha} because #{short_head} is checked out.",
    "Run `git checkout #{short_sha}` and try again"
  ]
end
should_build?() click to toggle source
# File lib/egads/command/build.rb, line 59
def should_build?
  options[:force] || !tarball.exists?
end
working_directory_is_clean?() click to toggle source
# File lib/egads/command/build.rb, line 76
def working_directory_is_clean?
  run("git status -s", capture: true).empty? or
  error [
    "Cannot build #{short_sha} because the working directory is not clean.",
    "Stash your changes with `git stash -u` and try again."
  ]
end