#!/usr/bin/env ruby require "rubygems" require "optparse" require "readline" require "highline" # for testing inside gem dir $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require "room" opts = OptionParser.new opts.on("-h", "--help") do puts "usage: room" puts " room [room-file.rb]" exit end opts.parse! ARGV FILENAME = ARGV[0] || File.join(File.dirname(__FILE__), '..', 'examples', 'example1.rb') unless File.readable?(FILENAME) $stderr.puts "cannot read file #{FILENAME}" exit 1 end reload! 3.times { Printer.puts } Room.do "look" loop do line = if $secretive $secretive = false HighLine.new.ask("> ") { |q| q.echo = false } else Readline.readline("> ", true) end Room.do line.chomp end Printer.puts "\nThe world is your cantaloupe."