Sha256: eb3f49c4d4553932eb939eed657f4d454c66920e8f5783ac0873ed9137b5afb3

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require 'thor'
require 'shuck/server'

module Shuck
  class CLI < Thor
    default_task("server")

    desc "server", "Run a server on a particular hostname"
    method_option :root, :type => :string, :aliases => '-r', :required => true
    method_option :port, :type => :numeric, :aliases => '-p', :required => true
    method_option :hostname, :type => :string, :aliases => '-h', :desc => "The root name of the host.  Defaults to localhost."
    def server
      store = nil
      if options[:root]
        root = File.expand_path(options[:root])
        store = FileStore.new(root)
      end
      if store.nil?
        puts "You must specify a root to use a file store (the current default)"
        exit(-1)
      end

      hostname = 's3.amazonaws.com'
      if options[:hostname]
        hostname = options[:hostname]
      end

      puts "Loading Shuck with #{root} on port #{options[:port]} with hostname #{hostname}"
      server = Shuck::Server.new(options[:port],store,hostname)
      server.serve
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shuck-0.0.7 lib/shuck/cli.rb
shuck-0.0.6 lib/shuck/cli.rb
shuck-0.0.5 lib/shuck/cli.rb
shuck-0.0.4 lib/shuck/cli.rb