Sha256: 57fdac5c1d76d2a92910f2eb6ec3a1fef55e0683aa1901e9ba19689ee2563f18
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
#!/usr/bin/env ruby require 'rack' require 'optparse' help = %{Usage: olelo [OPTIONS] [PATH] PATH The path to the git repository to serve from (default .). Options: } options = { port: 8080, host: '0.0.0.0' } app_path = File.expand_path(File.join(__FILE__, '..', '..')) opts = OptionParser.new do |opts| opts.banner = help opts.on('-p', '--port PORT', 'Bind port (default 8080).') do |port| options[:port] = port.to_i end opts.on('-o', '--host HOST', 'Hostname or IP address to listen on (default 0.0.0.0).') do |host| options[:host] = host end opts.on('-s', '--server SERVER', 'serve using SERVER (webrick/mongrel)') do |server| options[:server] = server end opts.on('-c', '--config CONFIG', 'Path to the Olelo configuration, sets the $OLELO_CONFIG environment variable.') do |config| ENV['OLELO_CONFIG'] = File.expand_path(config) end opts.on('-v', '--version', 'Display current version.') do require File.join(app_path, 'lib', 'olelo', 'version.rb') puts "Olelo #{Olelo::VERSION}" exit end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end end opts.parse!(ARGV) if ARGV.size == 1 Dir.chdir(ARGV.first) elsif ARGV.size > 1 puts "Too many arguments: #{ARGV.join(' ')}" puts opts exit end Rack::Server.start(Port: options[:port], Host: options[:host], server: options[:server], config: File.join(app_path, 'config.ru'))
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
olelo-0.9.6 | bin/olelo |
olelo-0.9.5 | bin/olelo |
olelo-0.9.4 | bin/olelo |