Class: FaaStRuby::Command::Workspace::RM
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseCommand
#has_user_logged_in?, #help, #load_credentials, #load_yaml, #say, spin, #spin, #write_file
Constructor Details
#initialize(args) ⇒ RM
Returns a new instance of RM.
7
8
9
10
11
12
13
14
|
# File 'lib/faastruby/cli/commands/workspace/rm.rb', line 7
def initialize(args)
@args = args
help
@workspace_name, @relative_path = @args.shift.split(':')
validate_command
load_credentials
end
|
Class Method Details
.help ⇒ Object
27
28
29
|
# File 'lib/faastruby/cli/commands/workspace/rm.rb', line 27
def self.help
"rm WORKSPACE_NAME:/DESTINATION/PATH"
end
|
Instance Method Details
#run ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/faastruby/cli/commands/workspace/rm.rb', line 16
def run
spinner = say("[#{@relative_path}] Removing file from cloud workspace '#{@workspace_name}'...")
workspace = FaaStRuby::Workspace.new(name: @workspace_name)
workspace.delete_file(relative_path: @relative_path)
FaaStRuby::CLI.error(workspace.errors) if workspace.errors.any?
spinner.success
puts "* [#{@relative_path}] File removed from cloud workspace '#{@workspace_name}'.".green
end
|
#usage ⇒ Object
31
32
33
34
|
# File 'lib/faastruby/cli/commands/workspace/rm.rb', line 31
def usage
puts "\n# Remove static file from cloud workspace path '/DESTINATION/PATH'."
puts "\nUsage: faastruby #{self.class.help}\n\n"
end
|