From 07207ad6508d66090d8fb12b32bff9096713698d Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 10 Sep 2010 09:31:54 +0200 Subject: [PATCH 1/2] Document -d, since it is recognized as well. --- railties/lib/rails/commands/console.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index de2f190..297c8f1 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -18,7 +18,7 @@ module Rails OptionParser.new do |opt| opt.banner = "Usage: console [environment] [options]" opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v } - opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v } + opt.on('-d', '--debugger', 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v } opt.on('--irb', "DEPRECATED: Invoke `/your/choice/of/ruby script/rails console` instead") { |v| abort '--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead' } opt.parse!(ARGV) end -- 1.7.0.3.311.g6a6955 From 3b761b1d1ef2a9b574cb3e82242fbb7b7aa1ad1c Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 10 Sep 2010 09:43:45 +0200 Subject: [PATCH 2/2] Fix rails console option parsing. options and environment are now commutative. --- railties/lib/rails/commands/console.rb | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 297c8f1..09e2d9c 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -16,7 +16,7 @@ module Rails options = {} OptionParser.new do |opt| - opt.banner = "Usage: console [environment] [options]" + opt.banner = "Usage: console [options] [environment]" opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v } opt.on('-d', '--debugger', 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v } opt.on('--irb', "DEPRECATED: Invoke `/your/choice/of/ruby script/rails console` instead") { |v| abort '--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead' } @@ -47,6 +47,6 @@ module Rails end # Has to set the RAILS_ENV before config/application is required -if ARGV.first && !ARGV.first.index("-") && env = ARGV.pop # has to pop the env ARGV so IRB doesn't freak - ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env -end +env = ARGV.find { |e| e[0] != "-" } || "development" +ARGV.delete env # has to delete the env ARGV so IRB doesn't freak +ENV['RAILS_ENV'] = %w(production development test).find { |e| e.match("^#{env}") } \ No newline at end of file -- 1.7.0.3.311.g6a6955