Class: Imap::Backup::Account::FolderEnsurer

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/account/folder_ensurer.rb

Overview

Handles creation of directories for backup storage

Instance Method Summary collapse

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 = 
end

Instance Method Details

#runvoid

This method returns an undefined value.

Creates the account’s base directory and sets its permissions

Raises:

  • (RuntimeError)

    is the account’s backup path is not set



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 #{.username} is not set" if !.local_path

  Serializer::FolderMaker.new(
    base: File.dirname(.local_path),
    path: File.basename(.local_path),
    permissions: Serializer::Directory::DIRECTORY_PERMISSIONS
  ).run
end