Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1041

Show
Ignore:
Timestamp:
03/31/05 00:36:38 (3 years ago)
Author:
bitsweat
Message:

add --profile option for ./script/console to profile your console session. results printed on exit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/conductor/script/console

    r1027 r1041  
    33 
    44require 'optparse' 
    5 options = {
     5options = { :sandbox => false, :profile => false, :irb => irb
    66OptionParser.new do |opt| 
    77  opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| } 
     8  opt.on('--profile', 'Profile the session and print results on exit.') { |options[:profile]| } 
     9  opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| } 
    810  opt.parse!(ARGV) 
    911end 
     
    1113libs =  " -r #{File.dirname(__FILE__)}/../config/environment" 
    1214libs << " -r #{File.dirname(__FILE__)}/console_sandbox" if options[:sandbox] 
     15libs << " -runprof" if options[:profile] 
    1316libs << " -r irb/completion" 
    1417 
     
    2023  puts "Loading #{ENV['RAILS_ENV']} environment." 
    2124end 
    22 exec "#{irb} #{libs}" 
     25exec "#{options[:irb]} #{libs}"