diff options
Diffstat (limited to 'railties/lib/rails/commands')
-rw-r--r-- | railties/lib/rails/commands/dbconsole.rb | 22 | ||||
-rw-r--r-- | railties/lib/rails/commands/runner.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/server.rb | 1 |
3 files changed, 11 insertions, 14 deletions
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb index c84fa832f5..4a5674236d 100644 --- a/railties/lib/rails/commands/dbconsole.rb +++ b/railties/lib/rails/commands/dbconsole.rb @@ -5,8 +5,8 @@ require 'rbconfig' module Rails class DBConsole - attr_reader :config, :arguments - + attr_reader :arguments + def self.start new.start end @@ -59,7 +59,7 @@ module Rails args << "-#{options['mode']}" if options['mode'] args << "-header" if options['header'] - args << File.expand_path(config['database'], Rails.root) + args << File.expand_path(config['database'], Rails.respond_to?(:root) ? Rails.root : nil) find_cmd_and_exec('sqlite3', *args) @@ -82,17 +82,13 @@ module Rails def config @config ||= begin cfg = begin - cfg = YAML.load(ERB.new(IO.read("config/database.yml")).result) + YAML.load(ERB.new(IO.read("config/database.yml")).result) rescue SyntaxError, StandardError require APP_PATH Rails.application.config.database_configuration end - unless cfg[environment] - abort "No database is configured for the environment '#{environment}'" - end - - cfg[environment] + cfg[environment] || abort("No database is configured for the environment '#{environment}'") end end @@ -108,7 +104,7 @@ module Rails def parse_arguments(arguments) options = {} - + OptionParser.new do |opt| opt.banner = "Usage: rails dbconsole [environment] [options]" opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v| @@ -123,7 +119,7 @@ module Rails opt.on("--header") do |h| options['header'] = h end - + opt.on("-h", "--help", "Show this help message.") do puts opt exit @@ -142,7 +138,7 @@ module Rails env = arguments.first options[:environment] = %w(production development test).detect {|e| e =~ /^#{env}/} || env end - + options end @@ -154,7 +150,7 @@ module Rails full_path_command = nil found = commands.detect do |cmd| - dir = dirs_on_path.detect do |path| + dirs_on_path.detect do |path| full_path_command = File.join(path, cmd) File.executable? full_path_command end diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb index 0cc672e01c..62d82cc005 100644 --- a/railties/lib/rails/commands/runner.rb +++ b/railties/lib/rails/commands/runner.rb @@ -41,7 +41,7 @@ ENV["RAILS_ENV"] = options[:environment] require APP_PATH Rails.application.require_environment! - Rails.application.load_runner +Rails.application.load_runner if code_or_file.nil? $stderr.puts "Run '#{$0} -h' for help." diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 80fdc06cd2..0b897d736d 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -72,6 +72,7 @@ module Rails console = ActiveSupport::Logger.new($stdout) console.formatter = Rails.logger.formatter + console.level = Rails.logger.level Rails.logger.extend(ActiveSupport::Logger.broadcast(console)) end |