summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-02-15 12:58:35 +0000
committerintrigeri <intrigeri@boum.org>2019-02-15 12:58:35 +0000
commiteb1d978eaeade8914bd248107a5c74c4c958a42d (patch)
tree172c33de136be58f19f3a284b6e3fa51da23d6af
parent4f591943ec2ec519d14533d2772cd12b7215c681 (diff)
Refactoring: extract backup config file path.
I'll need to interact more with this file so let's avoid duplication.
-rw-r--r--lib/Tails/Persistence/Configuration/ConfigFile.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Tails/Persistence/Configuration/ConfigFile.pm b/lib/Tails/Persistence/Configuration/ConfigFile.pm
index b3c94d9..de06d9a 100644
--- a/lib/Tails/Persistence/Configuration/ConfigFile.pm
+++ b/lib/Tails/Persistence/Configuration/ConfigFile.pm
@@ -32,6 +32,13 @@ has 'config_file_path' => (
required => 1,
);
+has 'backup_config_file_path' => (
+ lazy_build => 1,
+ isa => AbsPath,
+ is => 'ro',
+ coerce => AbsPath->coercion,
+);
+
has 'lines' => (
lazy_build => 1,
is => 'rw',
@@ -59,6 +66,9 @@ method _build_lines () {
];
}
+method _build_backup_config_file_path () {
+ $self->config_file_path . '.bak';
+}
=head1 METHODS
@@ -84,7 +94,7 @@ Copy the on-disk configuration file to a backup file.
=cut
method backup () {
- $self->config_file_path->copy($self->config_file_path . '.bak');
+ $self->config_file_path->copy($self->backup_config_file_path);
}
=head2 save