Sha256: e1f454e46ff0ea0efddfc0c9754808aea220f4b1ace03cca694dffe2a54df311

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

#!/usr/bin/env ruby
# require File.expand_path('../../lib/rhp', __FILE__)
require 'rhp'
require 'optparse'

usage = <<USAGE
Usage: rhp <options>

To use rhp, cd to your sites base public directory, and run.

Options
  -p, --port          The port to run RHP from. Default: 2718
USAGE

options = {
  :port => 2718,
  :config => File.expand_path("../../lib/rhp/config.ru", __FILE__)
}

ARGV.options do |o|
  o.on("-p", "--port") do |port|
    options[:port] = port
  end
  
  # o.on("-c", "--config") do |config|
  #   options[:config] = File.expand_path(config, Dir.pwd)
  # end

  o.on_tail("-h", "--help") { puts usage; exit }

  o.parse!
end

project_path = ARGV.first || '.'
RHP::Server.project_root = File.expand_path(project_path, Dir.pwd)


server = Rack::Server.new.tap do |s|
  s.options[:config]  = options[:config]
  s.options[:Port]    = options[:port]
end


puts "RHP started at http://0.0.0.0:#{options[:port]}/ from #{project_path}\n"
server.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
RHP-0.0.2a bin/rhp