Class: Ruborg::CLI::BackupConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/ruborg/cli.rb

Overview

Wrapper class to adapt repository config to existing Backup class

Instance Method Summary collapse

Constructor Details

#initialize(repo_config, merged_settings) ⇒ BackupConfig



728
729
730
731
# File 'lib/ruborg/cli.rb', line 728

def initialize(repo_config, merged_settings)
  @repo_config = repo_config
  @merged_settings = merged_settings
end

Instance Method Details

#backup_pathsObject



733
734
735
736
737
738
# File 'lib/ruborg/cli.rb', line 733

def backup_paths
  sources = @repo_config["sources"] || []
  sources.flat_map do |source|
    source["paths"] || []
  end
end

#compressionObject



750
751
752
# File 'lib/ruborg/cli.rb', line 750

def compression
  @merged_settings["compression"] || "lz4"
end

#encryption_modeObject



754
755
756
# File 'lib/ruborg/cli.rb', line 754

def encryption_mode
  @merged_settings["encryption"] || "repokey"
end

#exclude_patternsObject



740
741
742
743
744
745
746
747
748
# File 'lib/ruborg/cli.rb', line 740

def exclude_patterns
  patterns = []
  sources = @repo_config["sources"] || []
  sources.each do |source|
    patterns += source["exclude"] || []
  end
  patterns += @merged_settings["exclude_patterns"] || []
  patterns.uniq
end