Sha256: 86c65f80786dd5d77d1a49b36a94990f0036d9e7b2c4e899c6a34bf57d984dcd

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module Xploy
  class Cli
    def initialize api, out, template_class
      @api = api
      @out = out
      @template_class = template_class
    end

    def start
      parameter = Xploy.parameter
      commands = parameter.rest
      if parameter[:version]
        @out.puts "xploy #{VERSION}"
      elsif commands.empty?
        parameter.print_help!
      elsif commands.first == 'new'
        template_data = @template_class.new.to_s
        if path = commands[1]
          File.open(path, 'w') { |f| f.write template_data }
        else
          @out.puts template_data
        end
      else
        @out.puts @api.request(*commands)
      end
    rescue MissingParameter => e
      @out.puts e.message
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xploy-0.1.1.beta lib/xploy/cli.rb