diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/dbconsole.rb | 18 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 3 | ||||
-rw-r--r-- | railties/lib/tasks/gems.rake | 4 | ||||
-rw-r--r-- | railties/lib/tasks/misc.rake | 1 |
4 files changed, 22 insertions, 4 deletions
diff --git a/railties/lib/commands/dbconsole.rb b/railties/lib/commands/dbconsole.rb index 06848d3c91..8002264f7e 100644 --- a/railties/lib/commands/dbconsole.rb +++ b/railties/lib/commands/dbconsole.rb @@ -3,12 +3,23 @@ require 'yaml' require 'optparse' include_password = false +options = {} OptionParser.new do |opt| opt.banner = "Usage: dbconsole [options] [environment]" opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v| 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| + options['mode'] = mode + end + + opt.on("-h", "--header") do |h| + options['header'] = h + end + opt.parse!(ARGV) abort opt.to_s unless (0..1).include?(ARGV.size) end @@ -60,8 +71,13 @@ when "sqlite" exec(find_cmd('sqlite'), config["database"]) when "sqlite3" - exec(find_cmd('sqlite3'), config["database"]) + args = [] + + args << "-#{options['mode']}" if options['mode'] + args << "-header" if options['header'] + args << config['database'] + exec(find_cmd('sqlite3'), *args) else abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!" end diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index be04873855..da064c86aa 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -302,7 +302,7 @@ module Rails if unloaded_gems.size > 0 @gems_dependencies_loaded = false # don't print if the gems rake tasks are being run - unless $rails_gem_installer + unless $rails_rake_task abort <<-end_error Missing these required gems: #{unloaded_gems.map { |gem| "#{gem.name} #{gem.requirement}" } * "\n "} @@ -379,6 +379,7 @@ Run `rake gems:install` to install the missing gems. # Eager load application classes def load_application_classes + return if $rails_rake_task if configuration.cache_classes configuration.eager_load_paths.each do |load_path| matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/ diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index 754e3ba5c9..e6731ab78c 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -17,13 +17,13 @@ end namespace :gems do task :base do - $rails_gem_installer = true + $rails_rake_task = true Rake::Task[:environment].invoke end desc "Build any native extensions for unpacked gems" task :build do - $rails_gem_installer = true + $rails_rake_task = true require 'rails/gem_builder' Dir[File.join(Rails::GemDependency.unpacked_path, '*')].each do |gem_dir| spec_file = File.join(gem_dir, '.specification') diff --git a/railties/lib/tasks/misc.rake b/railties/lib/tasks/misc.rake index 411750bf40..9e6f96db5b 100644 --- a/railties/lib/tasks/misc.rake +++ b/railties/lib/tasks/misc.rake @@ -1,5 +1,6 @@ task :default => :test task :environment do + $rails_rake_task = true require(File.join(RAILS_ROOT, 'config', 'environment')) end |