Class: Backup::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/backup/options.rb

Overview

Parses the command line options the user has provided on the command line

Constant Summary collapse

DEFAULT_BACKUP_FOLDER =

If the user doesn’t provide a backup folder a default folder is used

File.expand_path("~/backup/")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Takes the arguments from the command line and parses them



33
34
35
36
37
# File 'lib/backup/options.rb', line 33

def initialize(argv)
  @exit_code = 0
  init_exit_messages
  parse(argv)
end

Instance Attribute Details

#backup_folderObject (readonly)

The backup directory where the files to be backed up



20
21
22
# File 'lib/backup/options.rb', line 20

def backup_folder
  @backup_folder
end

#cronObject (readonly)

The cron schedule



24
25
26
# File 'lib/backup/options.rb', line 24

def cron
  @cron
end

#databaseObject (readonly)

Retrieve the database name that has to be backed up



12
13
14
# File 'lib/backup/options.rb', line 12

def database
  @database
end

#filesObject (readonly)

The files to be backed up



18
19
20
# File 'lib/backup/options.rb', line 18

def files
  @files
end

#max_backupsObject (readonly)

Specifies the maximum backup files to keep. Count < 1 means infinite backup files



30
31
32
# File 'lib/backup/options.rb', line 30

def max_backups
  @max_backups
end

#no_compressObject (readonly)

Determines whether to compress the backup if not to compress it returns false, otherwise true



27
28
29
# File 'lib/backup/options.rb', line 27

def no_compress
  @no_compress
end

#overrideObject (readonly)

Determines whether the backup folder to be overridden when already exists



22
23
24
# File 'lib/backup/options.rb', line 22

def override
  @override
end

#passwordObject (readonly)

The user’s password to access the database



16
17
18
# File 'lib/backup/options.rb', line 16

def password
  @password
end

#userObject (readonly)

The user that is allowed to access the database



14
15
16
# File 'lib/backup/options.rb', line 14

def user
  @user
end