#!/usr/bin/env ruby require 'hudson' require 'un' require 'optparse' options = { :port => 3001 } args = ARGV.dup opts = OptionParser.new do |opts| opts.banner = "Usage: hudson [options] DIR" opts.on("-p", "--port [3001]", "Run Hudson on specified port ") do |port| options[:port] = port 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 exec("java", "-jar", Hudson::WAR, "--httpPort=#{options[:port]}")