Sha256: 49ff1c62a7af5327aabd75ec9092accb5090add56d3067c0e3b9de41fd0a46a4

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

#!/usr/bin/env ruby

require 'optparse'

local_casserver = File.expand_path(File.dirname(File.expand_path(__FILE__))+'/../lib/casserver.rb')
if File.exists? local_casserver
  # use local rubycas-server installation
  $: << File.dirname(local_casserver)
  path = File.dirname(local_casserver)+"/"
else
  # use gem installation
  path = ""
  require 'rubygems'
  gem 'rubycas-server'
end

OptionParser.new do |opts|
  opts.banner = "Usage: rubycas-server [options]"

  opts.on("-c", "--config FILE", "Use config file (default is /etc/rubycas-server/config.yml)") do |c|
  	puts "Using config file #{c}"
    $CONFIG_FILE = c
  end
  
  opts.on("-d", "--daemonize", "Run as a daemon (only when using webrick or mongrel)") do |c|
    $DAEMONIZE = true
  end

  opts.on("-P", "--pid_file FILE", "Use pid file (default is /etc/rubycas-server/rubycas-server.pid)") do |c|
    if $DAEMONIZE && !File.exists?(c)
      puts "Using pid file '#{c}'"
      $PID_FILE = c
    elsif File.exists?(c)
      puts "The pid file already exists.  Is rubycas-server running?\n" +
      	"You will have to first manually remove the pid file at '#{c}' to start the server as a daemon."
      exit 1
    else
      puts "Not running as Daemon.  Ignoring pid option"
    end
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  
  opts.on_tail("-v", "--version", "Show version number") do
  	require "#{path}casserver/version"
    puts "rubycas-server-#{CASServer::VERSION::STRING}"
    exit
  end
end.parse!

$RUN = true

load "#{path}casserver.rb"

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubycas-server-0.4.1 bin/rubycas-server
rubycas-server-0.5.0 bin/rubycas-server
rubycas-server-0.5.0.186 bin/rubycas-server
rubycas-server-0.5.1 bin/rubycas-server
rubycas-server-0.4.0 bin/rubycas-server
rubycas-server-0.4.2 bin/rubycas-server
rubycas-server-0.5.0.193 bin/rubycas-server