Sha256: d69c8c728034d0dea91c4717659372aa8b963e117e463eee5310ae477a6f22d4
Contents?: true
Size: 940 Bytes
Versions: 20
Compression:
Stored size: 940 Bytes
Contents
module Imap; end module Imap::Backup class Setup; end class Setup::BackupPath attr_reader :account attr_reader :config def initialize(account:, config:) @account = account @config = config end def run account.local_path = highline.ask("backup directory: ") do |q| q.default = account.local_path q.readline = true q.validate = ->(path) { path_modification_validator(path) } q.responses[:not_valid] = "Choose a different directory " end end private def highline Setup.highline end def path_modification_validator(path) same = config.accounts.find do |a| a.username != account.username && a.local_path == path end if same Kernel.puts "The path '#{path}' is used to backup " \ "the account '#{same.username}'" false else true end end end end
Version data entries
20 entries across 20 versions & 1 rubygems