Class: Bosh::Director::CompressedRenderedJobTemplates
- Defined in:
- lib/bosh/director/compressed_rendered_job_templates.rb
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(path) ⇒ CompressedRenderedJobTemplates
constructor
A new instance of CompressedRenderedJobTemplates.
- #sha1 ⇒ Object
- #write(rendered_templates) ⇒ Object
Constructor Details
#initialize(path) ⇒ CompressedRenderedJobTemplates
Returns a new instance of CompressedRenderedJobTemplates.
6 7 8 |
# File 'lib/bosh/director/compressed_rendered_job_templates.rb', line 6 def initialize(path) @path = path end |
Instance Method Details
#contents ⇒ Object
20 21 22 |
# File 'lib/bosh/director/compressed_rendered_job_templates.rb', line 20 def contents File.open(@path, 'r') end |
#sha1 ⇒ Object
24 25 26 |
# File 'lib/bosh/director/compressed_rendered_job_templates.rb', line 24 def sha1 Digest::SHA1.file(@path).hexdigest end |
#write(rendered_templates) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/bosh/director/compressed_rendered_job_templates.rb', line 10 def write(rendered_templates) Dir.mktmpdir do |dir| writer = RenderedTemplatesWriter.new writer.write(rendered_templates, dir) tar_gzipper = TarGzipper.new tar_gzipper.compress(dir, %w(.), @path) end end |