From a0e7b99443cccbd01b0eefcd53b0e20878f54deb Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 12 Nov 2008 11:32:36 -0800 Subject: Remove deprecated Gem.manage_gems --- railties/lib/tasks/framework.rake | 1 - 1 file changed, 1 deletion(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 66ab78c3b2..5d1f8cf945 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -5,7 +5,6 @@ namespace :rails do deps = %w(actionpack activerecord actionmailer activesupport activeresource) require 'rubygems' require 'rubygems/gem_runner' - Gem.manage_gems rails = (version = ENV['VERSION']) ? Gem.cache.find_name('rails', "= #{version}").first : -- cgit v1.2.3 From 3c9beb3dab73013af83b90983f283b76625052b8 Mon Sep 17 00:00:00 2001 From: Eugene Bolshakov Date: Mon, 17 Nov 2008 21:55:56 -0600 Subject: Add helper test generators [#1199 state:resolved] Signed-off-by: Joshua Peek --- railties/lib/tasks/testing.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake index 328bde7442..4242458672 100644 --- a/railties/lib/tasks/testing.rake +++ b/railties/lib/tasks/testing.rake @@ -7,7 +7,7 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago) tests = [] source_dir = File.dirname(path).split("/") source_file = File.basename(path, '.rb') - + # Support subdirs in app/models and app/controllers modified_test_path = source_dir.length > 2 ? "#{test_path}/" << source_dir[1..source_dir.length].join('/') : test_path @@ -18,7 +18,7 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago) # For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}" FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exist?(test) - + return tests end @@ -63,7 +63,7 @@ namespace :test do t.test_files = touched.uniq end Rake::Task['test:recent'].comment = "Test recent changes" - + Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t| def t.file_list if File.directory?(".svn") @@ -82,7 +82,7 @@ namespace :test do unit_tests.uniq + functional_tests.uniq end - + t.libs << 'test' t.verbose = true end -- cgit v1.2.3 From 9e08a3bb1d47f79b6953056e72eee58e86d83ead Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 23 Nov 2008 13:39:30 +0100 Subject: Added rake rails:update:application_controller to renamed application.rb to application_controller.rb -- included in rake rails:update so upgrading to 2.3 will automatically trigger it [#1439 state:committed] (kastner) --- railties/lib/tasks/framework.rake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 5d1f8cf945..4cf174b15b 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -78,7 +78,7 @@ namespace :rails do end desc "Update both configs, scripts and public/javascripts from Rails" - task :update => [ "update:scripts", "update:javascripts", "update:configs" ] + task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:application_controller" ] namespace :update do desc "Add new scripts to the application script/ directory" @@ -114,5 +114,15 @@ namespace :rails do require 'railties_path' FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb') end + + desc "Rename application.rb to application_controller.rb" + task :application_controller do + old_style = RAILS_ROOT + '/app/controllers/application.rb' + new_style = RAILS_ROOT + '/app/controllers/application_controller.rb' + if File.exists?(old_style) && !File.exists?(new_style) + FileUtils.mv(old_style, new_style) + puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary" + end + end end end -- cgit v1.2.3 From 1cbdd53bd383e7d1dc34cad50c22ff5a330bbf91 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 24 Nov 2008 19:50:09 +0100 Subject: Add a rake task to generate dispatchers : rake rails:generate_dispatchers --- railties/lib/tasks/framework.rake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 4cf174b15b..df080e94ac 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -124,5 +124,13 @@ namespace :rails do puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary" end end + + desc "Generate dispatcher files in RAILS_ROOT/public" + task :generate_dispatchers do + require 'railties_path' + FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.fcgi', RAILS_ROOT + '/public/dispatch.fcgi') + FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.rb') + FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.cgi') + end end end -- cgit v1.2.3 From 36dcfcf126b7e7ba33ebe0d7148c9023e7494464 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 24 Nov 2008 18:48:00 -0800 Subject: Really remove components. --- railties/lib/tasks/statistics.rake | 1 - 1 file changed, 1 deletion(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/statistics.rake b/railties/lib/tasks/statistics.rake index dbd0773194..5ab27a0f62 100644 --- a/railties/lib/tasks/statistics.rake +++ b/railties/lib/tasks/statistics.rake @@ -4,7 +4,6 @@ STATS_DIRECTORIES = [ %w(Models app/models), %w(Libraries lib/), %w(APIs app/apis), - %w(Components components), %w(Integration\ tests test/integration), %w(Functional\ tests test/functional), %w(Unit\ tests test/unit) -- cgit v1.2.3 From 61958032d3dbb8da8363d02ccda8933b99421fb1 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 1 Dec 2008 12:21:18 -0600 Subject: Generate rackup dispatcher with rails:update:generate_dispatchers --- railties/lib/tasks/framework.rake | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index df080e94ac..d639214ffe 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -128,6 +128,7 @@ namespace :rails do desc "Generate dispatcher files in RAILS_ROOT/public" task :generate_dispatchers do require 'railties_path' + FileUtils.cp(RAILTIES_PATH + '/dispatches/config.ru', RAILS_ROOT + '/config.ru') FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.fcgi', RAILS_ROOT + '/public/dispatch.fcgi') FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.rb') FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.cgi') -- cgit v1.2.3 From 06ed8e451198b2296d8b2752741e259b4f995081 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 1 Dec 2008 13:48:47 -0600 Subject: Add internal middleware stack to Dispatcher config.middleware.use Rack::Cache --- railties/lib/tasks/middleware.rake | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 railties/lib/tasks/middleware.rake (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/middleware.rake b/railties/lib/tasks/middleware.rake new file mode 100644 index 0000000000..e0dcf50307 --- /dev/null +++ b/railties/lib/tasks/middleware.rake @@ -0,0 +1,7 @@ +desc 'Prints out your Rack middleware stack' +task :middleware => :environment do + ActionController::Dispatcher.middleware.each do |middleware| + puts "use #{middleware.inspect}" + end + puts "run ActionController::Dispatcher.new" +end -- cgit v1.2.3 From a8fc494dbb86be13248613565c0b611c561cdc48 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Mon, 1 Dec 2008 21:19:55 +0100 Subject: Manually load the DB config rather than firing the whole initializer [Gerrit Kaiser] --- railties/lib/tasks/databases.rake | 13 +++++++++---- railties/lib/tasks/misc.rake | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 5cb27f1f10..2140adb76e 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -1,7 +1,12 @@ namespace :db do + task :load_config => :rails_env do + require 'active_record' + ActiveRecord::Base.configurations = Rails::Configuration.new.database_configuration + end + namespace :create do desc 'Create all the local databases defined in config/database.yml' - task :all => :environment do + task :all => :load_config do ActiveRecord::Base.configurations.each_value do |config| # Skip entries that don't have a database key, such as the first entry here: # @@ -22,7 +27,7 @@ namespace :db do end desc 'Create the database defined in config/database.yml for the current RAILS_ENV' - task :create => :environment do + task :create => :load_config do create_database(ActiveRecord::Base.configurations[RAILS_ENV]) end @@ -76,7 +81,7 @@ namespace :db do namespace :drop do desc 'Drops all the local databases defined in config/database.yml' - task :all => :environment do + task :all => :load_config do ActiveRecord::Base.configurations.each_value do |config| # Skip entries that don't have a database key next unless config['database'] @@ -87,7 +92,7 @@ namespace :db do end desc 'Drops the database for the current RAILS_ENV' - task :drop => :environment do + task :drop => :load_config do config = ActiveRecord::Base.configurations[RAILS_ENV || 'development'] begin drop_database(config) diff --git a/railties/lib/tasks/misc.rake b/railties/lib/tasks/misc.rake index 5c99725203..411750bf40 100644 --- a/railties/lib/tasks/misc.rake +++ b/railties/lib/tasks/misc.rake @@ -3,6 +3,12 @@ task :environment do require(File.join(RAILS_ROOT, 'config', 'environment')) end +task :rails_env do + unless defined? RAILS_ENV + RAILS_ENV = ENV['RAILS_ENV'] ||= 'development' + end +end + desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions.' task :secret do puts ActiveSupport::SecureRandom.hex(64) -- cgit v1.2.3 From a0bc480e1ddcaa015927c2d941e7b96a8ce4f6fa Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Fri, 28 Nov 2008 17:09:46 +0200 Subject: establish mysql connection before dropping database Signed-off-by: Michael Koziarski [#63 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 2140adb76e..a90c1d4a77 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -398,6 +398,7 @@ end def drop_database(config) case config['adapter'] when 'mysql' + ActiveRecord::Base.establish_connection(config) ActiveRecord::Base.connection.drop_database config['database'] when /^sqlite/ FileUtils.rm(File.join(RAILS_ROOT, config['database'])) -- cgit v1.2.3