lib/backup/packager.rb in backup-4.4.1 vs lib/backup/packager.rb in backup-5.0.0.beta.1
- old
+ new
@@ -1,7 +1,5 @@
-# encoding: utf-8
-
module Backup
module Packager
class Error < Backup::Error; end
class << self
@@ -20,11 +18,11 @@
if @pipeline.success?
Logger.info "Packaging Complete!"
else
raise Error, "Failed to Create Backup Package\n" +
- @pipeline.error_messages
+ @pipeline.error_messages
end
end
private
@@ -41,12 +39,12 @@
# Initial `tar` command to package the temporary backup folder.
# The command's output will then be either piped to the Encryptor
# or the Splitter (if no Encryptor), or through `cat` into the final
# output file if neither are configured.
@pipeline.add(
- "#{ utility(:tar) } -cf - " +
- "-C '#{ Config.tmp_path }' '#{ @package.trigger }'",
+ "#{utility(:tar)} -cf - " \
+ "-C '#{Config.tmp_path}' '#{@package.trigger}'",
tar_success_codes
)
##
# If an Encryptor was configured, it will be called first
@@ -73,29 +71,30 @@
# If so, it will set the package's chunk_suffixes. If not, it will
# remove the '-aa' suffix from the only file created by `split`.
#
# If no Splitter was configured, the final file output will be
# piped through `cat` into the final output file.
- if @splitter
- stack << lambda do
- @splitter.split_with do |command|
- @pipeline << command
+ stack <<
+ if @splitter
+ lambda do
+ @splitter.split_with do |command|
+ @pipeline << command
+ stack.shift.call
+ end
+ end
+ else
+ lambda do
+ outfile = File.join(Config.tmp_path, @package.basename)
+ @pipeline << "#{utility(:cat)} > #{outfile}"
stack.shift.call
end
end
- else
- stack << lambda do
- outfile = File.join(Config.tmp_path, @package.basename)
- @pipeline << "#{ utility(:cat) } > #{ outfile }"
- stack.shift.call
- end
- end
##
# Last Proc to be called runs the Pipeline the procedure built.
# Once complete, the call stack will unwind back through the
# preceeding Procs in the stack (if any)
- stack << lambda { @pipeline.run }
+ stack << -> { @pipeline.run }
stack.shift
end
def tar_success_codes