Class: Backup::Options
- Inherits:
-
Object
- Object
- Backup::Options
- 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.("~/backup/")
Instance Attribute Summary collapse
-
#backup_folder ⇒ Object
readonly
The backup directory where the files to be backed up.
-
#cron ⇒ Object
readonly
The cron schedule.
-
#database ⇒ Object
readonly
Retrieve the database name that has to be backed up.
-
#files ⇒ Object
readonly
The files to be backed up.
-
#max_backups ⇒ Object
readonly
Specifies the maximum backup files to keep.
-
#no_compress ⇒ Object
readonly
Determines whether to compress the backup if not to compress it returns false, otherwise true.
-
#override ⇒ Object
readonly
Determines whether the backup folder to be overridden when already exists.
-
#password ⇒ Object
readonly
The user’s password to access the database.
-
#user ⇒ Object
readonly
The user that is allowed to access the database.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Options
constructor
Takes the arguments from the command line and parses them.
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 parse(argv) end |
Instance Attribute Details
#backup_folder ⇒ Object (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 |
#cron ⇒ Object (readonly)
The cron schedule
24 25 26 |
# File 'lib/backup/options.rb', line 24 def cron @cron end |
#database ⇒ Object (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 |
#files ⇒ Object (readonly)
The files to be backed up
18 19 20 |
# File 'lib/backup/options.rb', line 18 def files @files end |
#max_backups ⇒ Object (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_compress ⇒ Object (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 |
#override ⇒ Object (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 |
#password ⇒ Object (readonly)
The user’s password to access the database
16 17 18 |
# File 'lib/backup/options.rb', line 16 def password @password end |
#user ⇒ Object (readonly)
The user that is allowed to access the database
14 15 16 |
# File 'lib/backup/options.rb', line 14 def user @user end |