Sha256: 30c1beaa43aadd2007f2504be35cdd51a4d3dddcb5b8fcf7684d31c1e5edca0e

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../lib/hudson'
require 'un'
require 'optparse'


options = {
  :port => 3001,
  :control => 3002
}
args = ARGV.dup

opts = OptionParser.new do |opts|
  opts.banner = "Usage: hudson [options] HUDSON_HOME"

  opts.on("-d", "--daemon", "fork into background and run as daemon") do
    options[:daemon] = true
  end

  opts.on("-p", "--port [3001]", "run hudson on specified port ") do |port|
    options[:port] = port
  end
  
  opts.on("-c", "--control-port [3002]", Integer, "set the shutdown/control port") do |port|
    options[:control] = cport
  end
  
  opts.on_tail("-k", "--kill", "send shutdown signal to control port") do
    require 'socket'
    TCPSocket.open("localhost", options[:control]) do |sock|
      sock.write("0")
    end
    exit
  end
  
  opts.on_tail("-v", "--version", "show version information") do
    puts "#{Hudson::VERSION} (Hudson Server #{Hudson::HUDSON_VERSION})"
    exit
  end
  opts.on_tail("-h", "--help") do
    puts opts
    exit
  end
  
end
opts.parse!(args)
unless dir = args.shift
  puts "hudson: no directory specified to house hudson"
  puts opts
  exit(1)
end
FileUtils.mkdir_p dir
FileUtils.cp_r Hudson::PLUGINS, dir
ENV['HUDSON_HOME'] = dir
cmd = ["java", "-jar", Hudson::WAR]
cmd << "--httpPort=#{options[:port]}"
cmd << "--controlPort=#{options[:control]}"
cmd << "--daemon" if options[:daemon]
puts cmd.join(" ")
exec(*cmd)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hudson-0.2.3 bin/hudson
hudson-0.2.2 bin/hudson