Created
May 14, 2011 02:33
-
-
Save AquaGeek/971723 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #5930
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 50f7cd3e4fe18c742447e29aceb8f5e055e172bd Mon Sep 17 00:00:00 2001 | |
From: Andrei Kulakov <krugliy@gmail.com> | |
Date: Mon, 8 Nov 2010 03:09:35 +0200 | |
Subject: [PATCH] Fix dbconsole arguments order mismatch | |
--- | |
railties/lib/rails/commands/dbconsole.rb | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb | |
index 14d245a..eb0d70b 100644 | |
--- a/railties/lib/rails/commands/dbconsole.rb | |
+++ b/railties/lib/rails/commands/dbconsole.rb | |
@@ -112,6 +112,6 @@ module Rails | |
end | |
# Has to set the RAILS_ENV before config/application is required | |
-if ARGV.first && !ARGV.first.index("-") && env = ARGV.first | |
+if ARGV.last && !ARGV.last.index("-") && env = ARGV.last | |
ENV['RAILS_ENV'] = %w(production development test).find { |e| e.index(env) } || env | |
end | |
-- | |
1.7.3.2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb | |
index f0d6ea1..666efae 100644 | |
--- a/railties/lib/rails/commands/dbconsole.rb | |
+++ b/railties/lib/rails/commands/dbconsole.rb | |
@@ -11,6 +11,8 @@ require 'rbconfig' | |
module Rails | |
class DBConsole | |
+ MODES = ['html', 'list', 'line', 'column'] | |
+ | |
def self.start(app) | |
new(app).start | |
end | |
@@ -28,8 +30,8 @@ module Rails | |
include_password = true | |
end | |
- opt.on("--mode [MODE]", ['html', 'list', 'line', 'column'], | |
- "Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode| | |
+ opt.on("--mode [MODE]", MODES, | |
+ "Automatically put the sqlite3 database in the specified mode (#{MODES.join(', ')}).") do |mode| | |
options['mode'] = mode | |
end | |
@@ -118,6 +120,6 @@ module Rails | |
end | |
# Has to set the RAILS_ENV before config/application is required | |
-if ARGV.first && !ARGV.first.index("-") && env = ARGV.first | |
+if (arg = ARGV.last) && !arg.index("-") && !Rails::DBConsole::MODES.include?(arg) && env = arg | |
ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From c97c66c45e5b7bda0f7eeccd260705f1cb06747d Mon Sep 17 00:00:00 2001 | |
From: Vijay Dev <vijaydev.cse@gmail.com> | |
Date: Sat, 5 Feb 2011 22:23:52 +0530 | |
Subject: [PATCH] change dbconsole usage message to match what the code does | |
--- | |
railties/lib/rails/commands/dbconsole.rb | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb | |
index f0d6ea1..b0ba762 100644 | |
--- a/railties/lib/rails/commands/dbconsole.rb | |
+++ b/railties/lib/rails/commands/dbconsole.rb | |
@@ -23,7 +23,7 @@ module Rails | |
include_password = false | |
options = {} | |
OptionParser.new do |opt| | |
- opt.banner = "Usage: dbconsole [options] [environment]" | |
+ opt.banner = "Usage: dbconsole [environment] [options]" | |
opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v| | |
include_password = true | |
end | |
-- | |
1.7.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment