RISCfuture / autumn

Easy, fresh, feature-rich IRC bots in Ruby

autumn / script / console
100755 27 lines (20 sloc) 0.708 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env ruby
#
# Launches an IRb console with the Autumn environment loaded.
 
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
 
# Some code below is from Ruby on Rails and copyright (c) David Heinemeier
# Hansson.
 
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
 
require 'optparse'
options = { :irb => irb }
OptionParser.new do |opt|
  opt.banner = "Usage: #{File.basename(__FILE__)} [options]"
  opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
  opt.parse!(ARGV)
end
 
libs = " -r irb/completion"
libs << " -r libs/console_boot"
 
require 'libs/genesis'
puts "Loading Autumn #{AUTUMN_VERSION}..."
exec "#{options[:irb]} #{libs}"