class Bosh::Cli::BackupDestinationPath
Public Class Methods
new(director)
click to toggle source
# File lib/cli/backup_destination_path.rb, line 4 def initialize(director) @director = director end
Public Instance Methods
create_from_path(dest_path = nil)
click to toggle source
# File lib/cli/backup_destination_path.rb, line 8 def create_from_path(dest_path = nil) dest_path ||= Dir.pwd if File.directory?(dest_path) File.join(dest_path, default_backup_name) else is_tar_path?(dest_path) ? dest_path : "#{dest_path}.tgz" end end
Private Instance Methods
bosh_director_name()
click to toggle source
# File lib/cli/backup_destination_path.rb, line 24 def bosh_director_name @director.get_status['name'] end
default_backup_name()
click to toggle source
# File lib/cli/backup_destination_path.rb, line 20 def default_backup_name "bosh_backup_#{bosh_director_name}_#{Time.now.to_i}.tgz" end
is_tar_path?(path)
click to toggle source
# File lib/cli/backup_destination_path.rb, line 28 def is_tar_path?(path) path.end_with?('.tar.gz') || path.end_with?('.tgz') end