Module: Egads::Build::BuildHelpers
- Included in:
- Egads::Build
- Defined in:
- lib/egads/command/build.rb
Instance Method Summary collapse
- #build_type ⇒ Object
- #can_build? ⇒ Boolean
- #error(message) ⇒ Object
- #patch_path ⇒ Object
- #sha_is_checked_out? ⇒ Boolean
- #should_build? ⇒ Boolean
- #working_directory_is_clean? ⇒ Boolean
Instance Method Details
#build_type ⇒ Object
109 110 111 |
# File 'lib/egads/command/build.rb', line 109 def build_type [:seed] ? 'seed' : 'patch' end |
#can_build? ⇒ Boolean
84 85 86 |
# File 'lib/egads/command/build.rb', line 84 def can_build? sha_is_checked_out? && working_directory_is_clean? end |
#error(message) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/egads/command/build.rb', line 113 def error() lines = Array() say_status :error, lines.shift, :red lines.each {|line| say_status '', line } false end |
#patch_path ⇒ Object
105 106 107 |
# File 'lib/egads/command/build.rb', line 105 def patch_path "#{sha}.patch" end |
#sha_is_checked_out? ⇒ Boolean
88 89 90 91 92 93 94 95 |
# File 'lib/egads/command/build.rb', line 88 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? ⇒ Boolean
80 81 82 |
# File 'lib/egads/command/build.rb', line 80 def should_build? [:force] || !tarball.exists? end |
#working_directory_is_clean? ⇒ Boolean
97 98 99 100 101 102 103 |
# File 'lib/egads/command/build.rb', line 97 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 |