Sha256: ef2388c4998274b66b2277c32163536aa327385b6209b38728c915c932b96dec

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

#!/usr/bin/env ruby

require 'fcrepo_wrapper'
require 'optparse'

options = {}

args = OptionParser.new do |opts|
  opts.banner = "Usage: fcrepo_wrapper [options]"

  opts.on("--config FILE", "Load configuration from a file") do |v|
    options[:config] = v
  end

  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
    options[:verbose] = v
  end

  opts.on("--[no-]jms", "Run with[or witout] JMS") do |v|
    options[:enable_jms] = v
  end

  opts.on("--version VERSION", "Specify a fcrepo version to download (default: #{FcrepoWrapper.default_fcrepo_version})") do |v|
    options[:version] = v
  end

  opts.on("-pPORT", "--port PORT", "Specify the port fcrepo should run at (default: #{FcrepoWrapper.default_fcrepo_port})") do |p|
    if p == 'random'
      options[:port] = nil
    else
      options[:port] = p
    end
  end

  opts.on("-iDIR", "--instance_directory DIR", "Install/use fcrepo jar at the given directory") do |d|
    options[:instance_dir] = d
  end

  opts.on("-dDIR", "--fcrepo_home DIR", "Store fcrepo at the given directory") do |d|
    options[:fcrepo_home_dir] = d
  end

  opts.on("-h", "--help", "Show these usage options") do
    puts opts
    exit
  end
end

begin
  args.parse!
rescue => error
  $stderr.puts "ERROR: #{error}\n"
  $stderr.puts "#{args.help}\n"
  exit 1
end

# default to verbose
options[:verbose] = true if options[:verbose].nil?

instance = FcrepoWrapper.default_instance(options)
$stderr.print "Starting Fedora #{instance.version} on port #{instance.port} ... "
instance.wrap do |conn|
  $stderr.puts "http://#{instance.host}:#{instance.port}/"
  begin
    while conn.status
      sleep 1
    end
  rescue Interrupt
    $stderr.puts "Fedora is shutting down."
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fcrepo_wrapper-0.4.0 exe/fcrepo_wrapper