Sha256: 7d32ec0ea1cdd264b36918ae6aa53ca892b7a7cfd055a3351f127428adbd6d01
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
#!/usr/bin/env ruby # This software code is made available "AS IS" without warranties of any # kind. You may copy, display, modify and redistribute the software # code either by itself or as incorporated into your code; provided that # you do not remove any proprietary notices. Your use of this software # code is at your own risk and you waive any claim against the author # with respect to your use of this software code. # (c) 2007 Static-CMS require 'optparse' require 'fileutils' require 'Scms' require "scms/version" require 'webrick' require 'launchy' options = {} optparse = OptionParser.new do|opts| # Set a banner, displayed at the top of the help screen. opts.banner = "Usage: scms-server [options]" options[:dir] = Dir::pwd opts.on( '-d', '--dir DIR', 'Document Root of http server [default = current working dir]' ) do|d| options[:dir] = d end options[:port] = 8008 opts.on( '-p', '--port PORT', 'port for http server [default = 8008]' ) do|p| options[:port] = p end # options[:host] = "localhost" # opts.on( '-h', '--host HOST', 'http host for http server [default = localhost]' ) do|h| # options[:host] = h # end options[:version] = false opts.on( '-v', '--version', 'Output scms version' ) do puts "Version: #{Scms::VERSION}" exit end # This displays the help screen, all programs are assumed to have this option. opts.on( '-h', '--help', 'Display this help screen' ) do puts opts exit end end optparse.parse! #puts "Working dir: #{Dir::pwd}" #puts "Doc root: #{options[:dir]}" include WEBrick port = options[:port] puts "Starting server: http://#{Socket.gethostname}:#{port}" #:BindAddress server = HTTPServer.new(:Port=>port,:DocumentRoot=>options[:dir]) trap("INT"){ server.shutdown } uri = "http://localhost:#{port}" Launchy.open( uri ) do |exception| puts "Attempted to open #{uri} and failed because #{exception}" end server.start exit
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scms-2.1.8 | bin/scms-server |