aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r--railties/lib/tasks/databases.rake1
-rw-r--r--railties/lib/tasks/documentation.rake11
-rw-r--r--railties/lib/tasks/gems.rake81
-rw-r--r--railties/lib/tasks/testing.rake2
4 files changed, 37 insertions, 58 deletions
diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake
index 68ffefae0b..9588fabb2d 100644
--- a/railties/lib/tasks/databases.rake
+++ b/railties/lib/tasks/databases.rake
@@ -250,6 +250,7 @@ namespace :db do
File.open(ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb", "w") do |file|
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
end
+ Rake::Task["db:schema:dump"].reenable
end
desc "Load a schema.rb file into the database"
diff --git a/railties/lib/tasks/documentation.rake b/railties/lib/tasks/documentation.rake
index 6caf69ccd3..8b41478a93 100644
--- a/railties/lib/tasks/documentation.rake
+++ b/railties/lib/tasks/documentation.rake
@@ -54,15 +54,8 @@ namespace :doc do
desc "Generate Rails guides"
task :guides do
- source = File.join(RAILTIES_PATH, "doc/guides")
- destination = File.join(RAILS_ROOT, "doc/guides")
- FileUtils.rm_r(destination) if File.directory?(destination)
- FileUtils.mkdir(destination)
-
- FileUtils.cp_r File.join(source, 'html/.'), File.join(destination)
- # Copy images and css files to html directory. These dirs are in .gitigore and shouldn't be source controlled.
- FileUtils.cp_r File.join(source, 'source/images'), File.join(destination)
- FileUtils.cp_r File.join(source, 'source/stylesheets'), File.join(destination, 'stylesheets')
+ require File.join(RAILTIES_PATH, "guides/rails_guides")
+ RailsGuides::Generator.new(File.join(RAILS_ROOT, "doc/guides")).generate
end
namespace :plugins do
diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake
index e6731ab78c..ed07bf2016 100644
--- a/railties/lib/tasks/gems.rake
+++ b/railties/lib/tasks/gems.rake
@@ -9,72 +9,57 @@ task :gems => 'gems:base' do
puts "R = Framework (loaded before rails starts)"
end
-def print_gem_status(gem, indent=1)
- code = gem.loaded? ? (gem.frozen? ? (gem.framework_gem? ? "R" : "F") : "I") : " "
- puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}"
- gem.dependencies.each { |g| print_gem_status(g, indent+1)} if gem.loaded?
-end
-
namespace :gems do
task :base do
- $rails_rake_task = true
+ $gems_rake_task = true
+ require 'rubygems'
+ require 'rubygems/gem_runner'
Rake::Task[:environment].invoke
end
desc "Build any native extensions for unpacked gems"
task :build do
- $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')
- next unless File.exists?(spec_file)
- specification = YAML::load_file(spec_file)
- next unless ENV['GEM'].blank? || ENV['GEM'] == specification.name
- Rails::GemBuilder.new(specification, gem_dir).build_extensions
- puts "Built gem: '#{gem_dir}'"
- end
+ $gems_build_rake_task = true
+ Rake::Task['gems:unpack'].invoke
+ current_gems.each &:build
end
- desc "Installs all required gems for this application."
+ desc "Installs all required gems."
task :install => :base do
- require 'rubygems'
- require 'rubygems/gem_runner'
- Rails.configuration.gems.each { |gem| gem.install unless gem.loaded? }
+ current_gems.each &:install
end
- desc "Unpacks the specified gem into vendor/gems."
- task :unpack => :base do
- require 'rubygems'
- require 'rubygems/gem_runner'
- Rails.configuration.gems.each do |gem|
- next unless !gem.frozen? && (ENV['GEM'].blank? || ENV['GEM'] == gem.name)
- gem.unpack_to(Rails::GemDependency.unpacked_path) if gem.loaded?
- end
+ desc "Unpacks all required gems into vendor/gems."
+ task :unpack => :install do
+ current_gems.each &:unpack
end
namespace :unpack do
- desc "Unpacks the specified gems and its dependencies into vendor/gems"
- task :dependencies => :unpack do
- require 'rubygems'
- require 'rubygems/gem_runner'
- Rails.configuration.gems.each do |gem|
- next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name
- gem.dependencies.each do |dependency|
- next if dependency.frozen?
- dependency.unpack_to(Rails::GemDependency.unpacked_path)
- end
- end
+ desc "Unpacks all required gems and their dependencies into vendor/gems."
+ task :dependencies => :install do
+ current_gems.each { |gem| gem.unpack(:recursive => true) }
end
end
desc "Regenerate gem specifications in correct format."
task :refresh_specs => :base do
- require 'rubygems'
- require 'rubygems/gem_runner'
- Rails::VendorGemSourceIndex.silence_spec_warnings = true
- Rails.configuration.gems.each do |gem|
- next unless gem.frozen? && (ENV['GEM'].blank? || ENV['GEM'] == gem.name)
- gem.refresh_spec(Rails::GemDependency.unpacked_path) if gem.loaded?
- end
+ current_gems.each &:refresh
end
-end \ No newline at end of file
+end
+
+def current_gems
+ gems = Rails.configuration.gems
+ gems = gems.select { |gem| gem.name == ENV['GEM'] } unless ENV['GEM'].blank?
+ gems
+end
+
+def print_gem_status(gem, indent=1)
+ code = case
+ when gem.framework_gem? then 'R'
+ when gem.frozen? then 'F'
+ when gem.installed? then 'I'
+ else ' '
+ end
+ puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}"
+ gem.dependencies.each { |g| print_gem_status(g, indent+1) }
+end
diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake
index 4242458672..fd5e52a05b 100644
--- a/railties/lib/tasks/testing.rake
+++ b/railties/lib/tasks/testing.rake
@@ -48,7 +48,7 @@ task :test do
task
end
end.compact
- abort "Errors running #{errors.to_sentence}!" if errors.any?
+ abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
end
namespace :test do