Class: Dolt::Git::Archiver
- Inherits:
-
Object
- Object
- Dolt::Git::Archiver
- Defined in:
- lib/libdolt/git/archiver.rb
Instance Method Summary collapse
-
#archive(repo, oid, format = :tgz) ⇒ Object
Returns a promise that resolves with the filename of the generated tarball/zip file.
-
#initialize(work_dir, cache_dir) ⇒ Archiver
constructor
A new instance of Archiver.
Constructor Details
#initialize(work_dir, cache_dir) ⇒ Archiver
Returns a new instance of Archiver.
25 26 27 28 |
# File 'lib/libdolt/git/archiver.rb', line 25 def initialize(work_dir, cache_dir) @work_dir = work_dir @cache_dir = cache_dir end |
Instance Method Details
#archive(repo, oid, format = :tgz) ⇒ Object
Returns a promise that resolves with the filename of the generated tarball/zip file.
repo - A repository object
oid - A valid commit oid
format - A symbol. If it is not :zip, tar.gz is assumed.
36 37 38 39 40 |
# File 'lib/libdolt/git/archiver.rb', line 36 def archive(repo, oid, format = :tgz) filename = cache_path(repo, oid, format) return filename if File.exists?(filename) archive_repo(repo, oid, format) end |