Sha256: 6c66e69db30e2850c98e23f6eba1fb7ac95bbf5b5fccb8d34b99255176cb853c
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 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." method_option :limit, :aliases => '-l', :type => :string, :desc => 'Rate limit for serving (ie. 50K, 1.0M)' 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 if options[:limit] begin store.rate_limit = options[:limit] rescue puts $!.message exit(-1) end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shuck-0.0.8 | lib/shuck/cli.rb |