Sha256: e1223a673627fddd6100c2f9d0dabe469de21cccafc32c1dffbaf7570128b8a2

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

class Rustic::CommandBuilders::Backup
  def initialize(config)
    @config = config
  end

  def build
    config = @config.backup_config
    raise Rustic::CommandBuilder::MissingConfigError, "Command `backup` misses it's configuration" if config.nil?
    raise Rustic::CommandBuilder::MalformedConfigError, "Backup paths cannot be empty" if config.paths.empty?

    [
      "backup",
      config.one_fs ? "-x" : nil,
      *config.paths,
      *excludes
    ].compact
  end

  private

  def excludes = ["--exclude"].product(@config.backup_config.excluded_paths).flatten
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rustic-0.3.0 lib/rustic/command_builders/backup.rb