Class: Bosh::Director::Core::Templates::CompressedRenderedJobTemplates
- Inherits:
-
Object
- Object
- Bosh::Director::Core::Templates::CompressedRenderedJobTemplates
- Defined in:
- lib/bosh/director/core/templates/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.
9 10 11 |
# File 'lib/bosh/director/core/templates/compressed_rendered_job_templates.rb', line 9 def initialize(path) @path = path end |
Instance Method Details
#contents ⇒ Object
23 24 25 |
# File 'lib/bosh/director/core/templates/compressed_rendered_job_templates.rb', line 23 def contents File.open(@path, 'r') end |
#sha1 ⇒ Object
27 28 29 |
# File 'lib/bosh/director/core/templates/compressed_rendered_job_templates.rb', line 27 def sha1 Digest::SHA1.file(@path).hexdigest end |
#write(rendered_templates) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/bosh/director/core/templates/compressed_rendered_job_templates.rb', line 13 def write(rendered_templates) Dir.mktmpdir do |dir| writer = RenderedTemplatesWriter.new writer.write(rendered_templates, dir) tar_gzipper = Bosh::Director::Core::TarGzipper.new tar_gzipper.compress(dir, %w(.), @path) end end |