Sha256: e954132729c5b869b7f2bcf612e26df946291c0a81b69bb2b5cf2fa5e8140aee
Contents?: true
Size: 642 Bytes
Versions: 8
Compression:
Stored size: 642 Bytes
Contents
require 'optparse' module RubyStation @port = nil @data_dir = nil def self.parse_argv OptionParser.new{|o| o.on("--port N"){|n| @port = n} o.on("--data-dir PATH"){|d| @data_dir = d} }.parse!(ARGV) unless @port @port = 40000 + rand(10000) warn "--port is not specified; assuming it is #{@port}" end unless @data_dir @data_dir = File.expand_path("./") warn "--data-dir is not specified; assuming it is #{@data_dir}" end end def self.port; @port; end def self.data_dir; @data_dir; end def self.data_path(filename) File.expand_path(filename, @data_dir) end end
Version data entries
8 entries across 8 versions & 2 rubygems