diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-09-12 21:59:26 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-09-25 21:31:45 +0200 |
commit | 03c982fa3417fc49a380eeb88fdd26fdd4bae46b (patch) | |
tree | bf60ebe8bd609876bc381893d20b450b3a023917 /railties/lib/rails/commands/console.rb | |
parent | 4e106ee08b36c2047a6af3829f3497459590c98a (diff) | |
download | rails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.tar.gz rails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.tar.bz2 rails-03c982fa3417fc49a380eeb88fdd26fdd4bae46b.zip |
Remove the old command files.
Wash out your old! These adhoc scripts are replaced by the new
commands.
Diffstat (limited to 'railties/lib/rails/commands/console.rb')
-rw-r--r-- | railties/lib/rails/commands/console.rb | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb deleted file mode 100644 index e00887323e..0000000000 --- a/railties/lib/rails/commands/console.rb +++ /dev/null @@ -1,80 +0,0 @@ -require "optparse" -require "irb" -require "irb/completion" -require "rails/commands/console_helper" - -module Rails - class Console - include ConsoleHelper - - module BacktraceCleaner - def filter_backtrace(bt) - if result = super - Rails.backtrace_cleaner.filter([result]).first - end - end - end - - class << self - def parse_arguments(arguments) - options = {} - - OptionParser.new do |opt| - opt.banner = "Usage: rails console [environment] [options]" - opt.on("-s", "--sandbox", "Rollback database modifications on exit.") { |v| options[:sandbox] = v } - opt.on("-e", "--environment=name", String, - "Specifies the environment to run this console under (test/development/production).", - "Default: development") { |v| options[:environment] = v.strip } - opt.parse!(arguments) - end - - set_options_env(arguments, options) - end - end - - attr_reader :options, :app, :console - - def initialize(app, options={}) - @app = app - @options = options - - app.sandbox = sandbox? - app.load_console - - @console = app.config.console || IRB - - if @console == IRB - IRB::WorkSpace.prepend(BacktraceCleaner) - end - end - - def sandbox? - options[:sandbox] - end - - def environment - options[:environment] ||= super - end - alias_method :environment?, :environment - - def set_environment! - Rails.env = environment - end - - def start - set_environment! if environment? - - if sandbox? - puts "Loading #{Rails.env} environment in sandbox (Rails #{Rails.version})" - puts "Any modifications you make will be rolled back on exit" - else - puts "Loading #{Rails.env} environment (Rails #{Rails.version})" - end - - if defined?(console::ExtendCommandBundle) - console::ExtendCommandBundle.include(Rails::ConsoleMethods) - end - console.start - end - end -end |