#!/usr/bin/env ruby require 'optparse' options = { } OptionParser.new do |opt| opt.banner = "Usage: console [options]" opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v } opt.parse!(ARGV) end lib_dir = File.expand_path("../../lib/", __FILE__) libs = " -r irb/completion" libs << " -I #{lib_dir}" libs << " -r #{lib_dir}/logjam_agent.rb" if options[:debugger] begin require 'byebug' libs << " -r byebug" puts "=> Debugger enabled" rescue Exception puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'" exit end end irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' exec "#{irb} #{libs} --simple-prompt"