diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-06-02 12:29:28 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-06-02 12:29:28 +0100 |
commit | 719aa13b0781d662673dba2225bc707fc4182b5e (patch) | |
tree | 057cabf17152a1ab0ccc749dd361eeaf754c38de /railties/lib/commands | |
parent | ad3c97cea6dd0714652db7d9b5b4d06b81e5c035 (diff) | |
parent | a980eb8c7734f14109d8c2a02a88dafdf682e0dc (diff) | |
download | rails-719aa13b0781d662673dba2225bc707fc4182b5e.tar.gz rails-719aa13b0781d662673dba2225bc707fc4182b5e.tar.bz2 rails-719aa13b0781d662673dba2225bc707fc4182b5e.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/lib/commands')
-rw-r--r-- | railties/lib/commands/dbconsole.rb | 14 | ||||
-rw-r--r-- | railties/lib/commands/plugin.rb | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/railties/lib/commands/dbconsole.rb b/railties/lib/commands/dbconsole.rb index b81997aa59..17acb7b68f 100644 --- a/railties/lib/commands/dbconsole.rb +++ b/railties/lib/commands/dbconsole.rb @@ -2,8 +2,13 @@ require 'erb' require 'yaml' require 'optparse' +include_password = false + OptionParser.new do |opt| - opt.banner = "Usage: dbconsole [environment]" + opt.banner = "Usage: dbconsole [options] [environment]" + opt.on("-p", "--include-password", "Automatically provide the database from database.yml") do |v| + include_password = true + end opt.parse!(ARGV) abort opt.to_s unless (0..1).include?(ARGV.size) end @@ -31,10 +36,13 @@ when "mysql" 'port' => '--port', 'socket' => '--socket', 'username' => '--user', - 'password' => '--password', 'encoding' => '--default-character-set' }.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact + if config['password'] && include_password + args << "--password=#{config['password']}" + end + args << config['database'] exec(find_cmd('mysql5', 'mysql'), *args) @@ -43,7 +51,7 @@ when "postgresql" ENV['PGUSER'] = config["username"] if config["username"] ENV['PGHOST'] = config["host"] if config["host"] ENV['PGPORT'] = config["port"].to_s if config["port"] - ENV['PGPASSWORD'] = config["password"].to_s if config["password"] + ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password exec(find_cmd('psql'), config["database"]) when "sqlite" diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index d12d002c4e..105819ce90 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -163,7 +163,7 @@ class Plugin end def git_url? - @uri =~ /^git:\/\// || @url =~ /\.git$/ + @uri =~ /^git:\/\// || @uri =~ /\.git$/ end def installed? |