Class: SpaceArchitect::GitClient
- Inherits:
-
Object
- Object
- SpaceArchitect::GitClient
- Defined in:
- lib/space_architect/git_client.rb
Instance Method Summary collapse
-
#commit_all(path, message) ⇒ Object
Best-effort: a missing git identity (user.name/user.email) must not abort space creation.
- #init(path) ⇒ Object
Instance Method Details
#commit_all(path, message) ⇒ Object
Best-effort: a missing git identity (user.name/user.email) must not abort space creation. Returns false on failure, leaving the repo initialized but uncommitted.
24 25 26 27 28 29 30 31 |
# File 'lib/space_architect/git_client.rb', line 24 def commit_all(path, ) path = Pathname.new(path) _, _, add_status = capture("git", "-C", path.to_s, "add", "-A") return false unless add_status.success? _, _, commit_status = capture("git", "-C", path.to_s, "commit", "-m", ) commit_status.success? end |
#init(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/space_architect/git_client.rb', line 10 def init(path) path = Pathname.new(path) stdout, stderr, status = capture("git", "-C", path.to_s, "init") return true if status.success? output = [stdout, stderr].reject(&:empty?).join("\n").strip = "git init failed for #{path}" = "#{}: #{output}" unless output.empty? raise GitError, end |