Method: Tetra::Project#finish

Defined in:
lib/tetra/project.rb

#finish(build_script_lines) ⇒ Object

ends a dry-run assuming a successful build:

- reverts sources as before dry-run
- saves the list of generated files in git comments
- saves the build script lines in git comments


70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/tetra/project.rb', line 70

def finish(build_script_lines)
  # keep track of changed files
  start_id = @git.latest_id("tetra: dry-run-started")
  changed_files = @git.changed_files("src", start_id)

  # revert to pre-dry-run status
  @git.revert_directories(["src"], start_id)

  # prepare commit comments
  comments = ["Dry run finished\n", "tetra: dry-run-finished"]
  comments += changed_files.map { |f| "tetra: file-changed: #{f}" }
  comments += build_script_lines.map { |l| "tetra: build-script-line: #{l}" }

  # commit end of dry run
  @git.commit_directories(["kit"], comments.join("\n"))
end