Skip to content

Instantly share code, notes, and snippets.

@wjessop
Created January 23, 2014 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjessop/8587261 to your computer and use it in GitHub Desktop.
Save wjessop/8587261 to your computer and use it in GitHub Desktop.
func (r *repo_handle) get_tar_file() (string, error) {
target_dir, tmpdir_err := ioutil.TempDir("", "captain_app_tar")
log.Println("Got temp directory for app tar", target_dir)
if tmpdir_err != nil {
return "", tmpdir_err
}
archive_path := target_dir + "/" + "app.tar"
log.Println("Going to create the tar archive at path", archive_path)
log.Println("Creating app tar file:", tar_path, "--exclude", ".git", "-cf", archive_path, "-C", r.root, ".")
prepare_cmd := exec.Command(tar_path, "--exclude", ".git", "-cf", archive_path, "-C", r.root, ".")
prepare_err := prepare_cmd.Run()
if prepare_err != nil {
return "", prepare_err
}
return archive_path, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment