class RestShifter::Commands::Start

Public Class Methods

run(port=ARGV) click to toggle source
# File lib/rest_shifter/commands/start.rb, line 3
def run(port=ARGV)

  prepare_server
  Shifter.set :bind, '0.0.0.0'
  Shifter.set :port, port.to_i
  Shifter.run!
end
run_secure(args=ARGV) click to toggle source
# File lib/rest_shifter/commands/start.rb, line 19
def run_secure(args=ARGV)
  port = args.shift
  crt = args.shift
  key = args.shift

  prepare_server
  Shifter.use Rack::SSL
  Shifter.set :bind, '0.0.0.0'
  Shifter.run_ssl! port, crt, key
end
run_secure_no_cert(port=ARGV) click to toggle source
# File lib/rest_shifter/commands/start.rb, line 11
def run_secure_no_cert(port=ARGV) 

  prepare_server
  Shifter.use Rack::SSL
  Shifter.set :bind, '0.0.0.0'
  Shifter.run_ssl! port.to_i, File.join(File.dirname(__FILE__), "fake_certs/localhost.cert"), File.join(File.dirname(__FILE__), "fake_certs/localhost.key")
end

Private Class Methods

prepare_server() click to toggle source
# File lib/rest_shifter/commands/start.rb, line 31
def prepare_server
  begin
    require 'rest_shifter/shifter.rb'
  rescue LoadError => e
    require 'rubygems'
    path = File.expand_path '../../lib', __FILE__
    $:.unshift(path) if File.directory?(path) && !$:.include?(path)
    require 'rest_shifter/shifter.rb'
  end
end