moduleJRubyclassCommandsclass<< self# Provide method aliases to scripts commonly found in ${jruby.home}/bin.
ifFile.directory?(Config::CONFIG['bindir'])Dir[Config::CONFIG['bindir']+'/*'].each do |f|ifFile.file?(f)&&File.open(f){|io|(io.readline rescue"")=~/^#!.*ruby/}
meth =File.basename(f)
define_method meth do
require'jruby/extract'JRuby::Extract.new.extract
load f
endendendelse# allow use of 'gem' and 'jirb' without prior extraction
defgemrequire'jruby/extract'JRuby::Extract.new.extract
require'rubygems'Gem.manage_gems
Gem::GemRunner.new.run(ARGV)enddefjirbrequire'irb'IRB.start(__FILE__)endend