Class: Imap::Backup::Account::FolderEnsurer
- Inherits:
-
Object
- Object
- Imap::Backup::Account::FolderEnsurer
- Defined in:
- lib/imap/backup/account/folder_ensurer.rb
Overview
Handles creation of directories for backup storage
Instance Method Summary collapse
-
#initialize(account:) ⇒ FolderEnsurer
constructor
A new instance of FolderEnsurer.
-
#run ⇒ void
Creates the account’s base directory and sets its permissions.
Constructor Details
#initialize(account:) ⇒ FolderEnsurer
Returns a new instance of FolderEnsurer.
11 12 13 |
# File 'lib/imap/backup/account/folder_ensurer.rb', line 11 def initialize(account:) @account = account end |
Instance Method Details
#run ⇒ void
This method returns an undefined value.
Creates the account’s base directory and sets its permissions
18 19 20 21 22 23 24 25 26 |
# File 'lib/imap/backup/account/folder_ensurer.rb', line 18 def run raise "The backup path for #{account.username} is not set" if !account.local_path Serializer::FolderMaker.new( base: File.dirname(account.local_path), path: File.basename(account.local_path), permissions: Serializer::Directory::DIRECTORY_PERMISSIONS ).run end |