Class: BackupClient::Components::Ftp::Commands::CreateFolder

Inherits:
Object
  • Object
show all
Includes:
Helpers::FtpHelper, Helpers::LogHelper
Defined in:
lib/backup_client/components/ftp/commands/create_folder.rb

Instance Method Summary collapse

Methods included from Helpers::FtpHelper

#ftp_chdir, #ftp_dir_exists?, #ftp_mkdir, #ftp_mkdir_p, #root_chdir, #to_unix_path, #upload_dir_ftp, #upload_file_ftp

Methods included from Helpers::LogHelper

#log

Constructor Details

#initialize(ftp_client, destination_path) ⇒ CreateFolder

Returns a new instance of CreateFolder.



11
12
13
14
15
# File 'lib/backup_client/components/ftp/commands/create_folder.rb', line 11

def initialize(ftp_client, destination_path)
  @ftp_client       = ftp_client
  @destination_path = destination_path
  @force_root       = force_root
end

Instance Method Details

#callObject



17
18
19
20
21
22
# File 'lib/backup_client/components/ftp/commands/create_folder.rb', line 17

def call
  return if ftp_dir_exists?(ftp_client, destination_path)
  return if ftp_mkdir(destination_path)

  ftp_mkdir_p(destination_path)
end