Sha256: f34ed7415b4c27036bef9e922f844cf8b682b3d91017ac25983e9b430672acca
Contents?: true
Size: 944 Bytes
Versions: 3
Compression:
Stored size: 944 Bytes
Contents
require 'optparse' module Mirage module Util def wait_until time=30 start_time = Time.now until Time.now >= start_time + time sleep 0.1 return if yield end raise 'timeout waiting' end def parse_options args options = {:port => 7001, :defaults_directory => 'defaults', :root_directory => '.'} opt_parser = OptionParser.new do |opts| opts.banner = "Usage: mirage start|stop [options]" opts.on("-p", "--port PORT", "the port to start Mirage on") do |port| options[:port] = port.to_i end opts.on("-d", "--defaults DIR", "location to load default responses from") do |directory| options[:defaults_directory] = directory end end begin opt_parser.parse args rescue puts "mirage start|stop [OPTIONS]" puts opt_parser exit 1 end options end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mirage-0.1.4 | lib/mirage/util.rb |
mirage-0.1.3 | lib/mirage/util.rb |
mirage-0.1.2 | lib/mirage/util.rb |