Sha256: ba12f50644b42633645101242d245408264ce304e14538a52da6625a3746c760
Contents?: true
Size: 800 Bytes
Versions: 15
Compression:
Stored size: 800 Bytes
Contents
require 'rack' require 'rack/server' require 'awestruct/rack/app' module Awestruct module CLI class Server attr_reader :server def initialize(path, bind_addr=Options::DEFAULT_BIND_ADDR, port=Options::DEFAULT_PORT) @path = path @bind_addr = bind_addr @port = port end def run url = %(http://#{Options::LOCAL_HOSTS[@bind_addr] || @bind_addr}:#{@port}) msg = %(Starting preview server at #{url} (Press Ctrl-C to shutdown)) puts %(#{'*' * msg.length}\n#{msg}\n#{'*' * msg.length}\n) ::Rack::Server::start( :app => Awestruct::Rack::App.new( @path ), :Port => @port, :Host => @bind_addr ) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems