Sha256: e6733cc848b6ae1a7167cca12a94e7d245f170d0d01d5def5d37a40409d0b30c

Contents?: true

Size: 1007 Bytes

Versions: 3

Compression:

Stored size: 1007 Bytes

Contents

module NightcrawlerSwift::CLI
  module Formatters
    class Basic

      def initialize runner
        @runner = runner
      end

      def command_list command
        array = command.new.execute
        array.each {|hash| @runner.log hash["name"]}
      end

      def command_download command
        filepath = @runner.argv.first
        @runner.log command.new.execute(filepath)
      end

      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

      def command_delete command
        filepath = @runner.argv.first
        deleted = command.new.execute(filepath).to_json
        @runner.log(deleted ? "success" : "failure")
      end

      def command_url_for command
        filepath = @runner.argv.first
        @runner.log command.new.execute(filepath)
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nightcrawler_swift-0.7.0 lib/nightcrawler_swift/cli/formatters/basic.rb
nightcrawler_swift-0.6.0 lib/nightcrawler_swift/cli/formatters/basic.rb
nightcrawler_swift-0.5.0 lib/nightcrawler_swift/cli/formatters/basic.rb