From ba146a84d0ed8a886fdc6b6794ce99a9d37c0190 Mon Sep 17 00:00:00 2001 From: Will Bryant Date: Wed, 19 Nov 2008 22:44:54 +1300 Subject: re-enable db:schema:dump so db:migrate:redo dumps the schema after migrating back up Signed-off-by: Michael Koziarski [#1412 state:committed] --- railties/lib/tasks/databases.rake | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/tasks') 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" -- cgit v1.2.3 From 96d610553e5fdaabc923835ab1f194070ddb4477 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 6 Feb 2009 01:57:02 +0000 Subject: Merge docrails along with the new guides and guides generation code --- railties/lib/tasks/documentation.rake | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'railties/lib/tasks') 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 -- cgit v1.2.3 From 01c818e99f04f70462df68e6a217dfd280c37581 Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Fri, 20 Feb 2009 14:16:07 -0600 Subject: break out of initializer early if gems aren't loaded [#1750 state:resolved] Signed-off-by: Joshua Peek --- railties/lib/tasks/gems.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index e6731ab78c..d538e52ca6 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_rake_task = true + $gems_rake_task = true Rake::Task[:environment].invoke end desc "Build any native extensions for unpacked gems" task :build do - $rails_rake_task = true + $gems_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') -- cgit v1.2.3 From 6de83562f91028629bd24447aa521bc72ef8277a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 27 Feb 2009 14:22:39 +0100 Subject: Force all internal calls to Array#to_sentence to use English [#2010 state:resolved] --- railties/lib/tasks/testing.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/tasks') 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 -- cgit v1.2.3 From a3ac1e1621506a6519b265ef6ec6abc70f6c8a27 Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Sun, 1 Mar 2009 11:53:58 +0000 Subject: Display gem dependencies correctly and unpack exactly once [#2097 state:resolved] Signed-off-by: Pratik Naik --- railties/lib/tasks/gems.rake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index d538e52ca6..0932ba73b5 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -47,8 +47,8 @@ namespace :gems 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? + next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name + gem.unpack_to(Rails::GemDependency.unpacked_path) end end @@ -59,8 +59,7 @@ namespace :gems do 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? + gem.dependencies(:flatten => true).each do |dependency| dependency.unpack_to(Rails::GemDependency.unpacked_path) end end -- cgit v1.2.3 From 99d75a7b02bf430a124b9c3e2515850959d78acf Mon Sep 17 00:00:00 2001 From: David Dollar Date: Fri, 13 Mar 2009 10:20:23 +0000 Subject: Makes the gem system understand development vs. runtime dependencies [#2195 state:resolved] The patch also fixes: * Fixes the chicken/egg problem present in the current gem system when gems are defined in the config that are not yet installed. * Remove the need to have hoe as a dependency of your production app. * Makes the gem 'unpacking' system a lot less fragile. Signed-off-by: Matt Jones Signed-off-by: Pratik Naik --- railties/lib/tasks/gems.rake | 78 ++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 46 deletions(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index 0932ba73b5..ed07bf2016 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -9,71 +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 $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 - $gems_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 ENV['GEM'].blank? || ENV['GEM'] == gem.name - gem.unpack_to(Rails::GemDependency.unpacked_path) - 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(:flatten => true).each do |dependency| - 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 + +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 -end \ No newline at end of file + puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}" + gem.dependencies.each { |g| print_gem_status(g, indent+1) } +end -- cgit v1.2.3