aboutsummaryrefslogtreecommitdiffstats
path: root/railties/bin/console
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 15:37:45 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 15:37:45 +0000
commit54f2d1d944bb7577ef33ab086191992210f4788c (patch)
tree2362ded764df45f2d931cfe4d5f665f580067894 /railties/bin/console
parente6f3e5d90017f3f642dd2f4205679cc861a8a2ab (diff)
downloadrails-54f2d1d944bb7577ef33ab086191992210f4788c.tar.gz
rails-54f2d1d944bb7577ef33ab086191992210f4788c.tar.bz2
rails-54f2d1d944bb7577ef33ab086191992210f4788c.zip
Added console --profile for profiling an IRB session #1154 [bitsweat]. Changed console_sandbox into console --sandbox #1154 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1261 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/bin/console')
-rw-r--r--railties/bin/console13
1 files changed, 8 insertions, 5 deletions
diff --git a/railties/bin/console b/railties/bin/console
index fa7acc1598..4ebcaa0b23 100644
--- a/railties/bin/console
+++ b/railties/bin/console
@@ -2,15 +2,18 @@
irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
require 'optparse'
-options = {}
+options = { :sandbox => false, :profile => false, :irb => irb }
OptionParser.new do |opt|
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
+ opt.on('--profile', 'Profile the session and print results on exit.') { |options[:profile]| }
+ opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| }
opt.parse!(ARGV)
end
-libs = " -r #{File.dirname(__FILE__)}/../config/environment"
-libs << " -r #{File.dirname(__FILE__)}/console_sandbox" if options[:sandbox]
-libs << " -r irb/completion"
+libs = " -r irb/completion"
+libs << " -r #{File.dirname(__FILE__)}/../config/environment"
+libs << " -r console_sandbox" if options[:sandbox]
+libs << " -r console_profile" if options[:profile]
ENV['RAILS_ENV'] = ARGV.first || 'development'
if options[:sandbox]
@@ -19,4 +22,4 @@ if options[:sandbox]
else
puts "Loading #{ENV['RAILS_ENV']} environment."
end
-exec "#{irb} #{libs}"
+exec "#{options[:irb]} #{libs} --prompt-mode simple"