Sha256: 92dd2c074e3e4653dee04c895472fb6c27c8fccbed349c8e27d013d2b97f1882

Contents?: true

Size: 858 Bytes

Versions: 5

Compression:

Stored size: 858 Bytes

Contents

irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'

require 'optparse'
options = { :sandbox => false, :irb => irb }
OptionParser.new do |opt|
	opt.banner = "Usage: console [environment] [options]"
  opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
  opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| }
  opt.parse!(ARGV)
end

libs =  " -r irb/completion"
libs << " -r #{SHATTERED_ROOT}/config/environment"
libs << " -r console_sandbox" if options[:sandbox]

ENV['SHATTERED_ENV'] = ARGV.first || ENV['SHATTERED_ENV'] || 'development'
if options[:sandbox]
  puts "Loading #{ENV['SHATTER_ENV']} environment in sandbox."
  puts "Any modifications you make will be rolled back on exit."
else
  puts "Loading #{ENV['SHATTER_ENV']} environment."
end
exec "#{options[:irb]} #{libs} --simple-prompt"

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
shattered-0.4 lib/commands/console.rb
shattered-0.4.0.1 lib/commands/console.rb
shattered-0.5.0.1 lib/commands/console.rb
shattered_ruby-0.5.0.2 lib/commands/console.rb
shattered_ruby-0.5.1 lib/commands/console.rb