Class: ReleaseCeremony::TransactionalWriter
- Inherits:
-
Object
- Object
- ReleaseCeremony::TransactionalWriter
- Defined in:
- lib/release_ceremony/transactional_writer.rb
Overview
Replaces a set of files atomically: every replacement and a backup of every original are staged as sibling temporary files first, so a failure while installing can restore the originals.
Defined Under Namespace
Classes: Artifact
Instance Method Summary collapse
-
#initialize(renamer: File.method(:rename)) ⇒ TransactionalWriter
constructor
A new instance of TransactionalWriter.
- #write(changes) ⇒ Object
Constructor Details
#initialize(renamer: File.method(:rename)) ⇒ TransactionalWriter
Returns a new instance of TransactionalWriter.
13 14 15 |
# File 'lib/release_ceremony/transactional_writer.rb', line 13 def initialize(renamer: File.method(:rename)) @renamer = renamer end |
Instance Method Details
#write(changes) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/release_ceremony/transactional_writer.rb', line 17 def write(changes) artifacts = stage_changes(changes) install(artifacts) true ensure cleanup(artifacts || []) end |