class NightcrawlerSwift::CLI::Formatters::Basic
Public Class Methods
new(runner)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 5 def initialize runner @runner = runner end
Public Instance Methods
command_delete(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 27 def command_delete command filepath = @runner.argv.first deleted = command.new.execute(filepath).to_json @runner.log(deleted ? "success" : "failure") end
command_download(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 14 def command_download command filepath = @runner.argv.first @runner.log command.new.execute(filepath) end
command_list(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 9 def command_list command array = command.new.execute array.each {|hash| @runner.log hash["name"]} end
command_metadata(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 33 def command_metadata command filepath = @runner.argv.first metadata = command.new.execute(filepath) @runner.log JSON.pretty_generate(metadata) end
command_upload(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 19 def command_upload command realpath = @runner.argv.shift swiftpath = @runner.argv.shift uploaded = command.new.execute swiftpath, File.open(File.expand_path(realpath), "r") @runner.log(uploaded ? "success" : "failure") end
command_url_for(command)
click to toggle source
# File lib/nightcrawler_swift/cli/formatters/basic.rb, line 39 def command_url_for command filepath = @runner.argv.first @runner.log command.new.execute(filepath) end