Class: Mxrb::Compiler::PortableArchiveWriter
- Inherits:
-
Object
- Object
- Mxrb::Compiler::PortableArchiveWriter
- Defined in:
- lib/mxrb/compiler/portable_packager.rb
Overview
Deterministic ZIP writer shared by portable package orchestration.
Constant Summary collapse
- FIXED_TIME =
Packager::FIXED_TIME
- APP_ROOTS =
(Adapter::ROOTS + ['run']).freeze
Instance Method Summary collapse
-
#initialize(deployment, runtime, metadata) ⇒ PortableArchiveWriter
constructor
A new instance of PortableArchiveWriter.
- #write(output) ⇒ Object
Constructor Details
#initialize(deployment, runtime, metadata) ⇒ PortableArchiveWriter
Returns a new instance of PortableArchiveWriter.
184 185 186 187 188 |
# File 'lib/mxrb/compiler/portable_packager.rb', line 184 def initialize(deployment, runtime, ) @deployment = deployment @runtime = runtime @metadata = end |
Instance Method Details
#write(output) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/mxrb/compiler/portable_packager.rb', line 190 def write(output) FileUtils.mkdir_p(File.dirname(output)) Dir.mktmpdir('mxrb-portable-', File.dirname(output)) do |tmpdir| temporary = File.join(tmpdir, 'runtime.zip') Zip::File.open(temporary, create: true) do |archive| add_tree(archive, @runtime, 'lib/runtime') add_application(archive) add_generated_files(archive) end FileUtils.mv(temporary, output, force: true) end end |