Project

General

Profile

RE: how to uninstall plugins ยป migrate_plugins.rake.patch

Robert Schulze, 2009-12-08 13:51

View differences:

lib/tasks/migrate_plugins.rake
2 2
  desc 'Migrates installed plugins.'
3 3
  task :migrate_plugins => :environment do
4 4
    if Rails.respond_to?('plugins')
5
      Rails.plugins.each do |plugin|
6
        next unless plugin.respond_to?('migrate')
7
        puts "Migrating #{plugin.name}..."
8
        plugin.migrate
5
      if (ENV['PLUGIN'])
6
        plugin = Rails.plugins[ENV['PLUGIN']]
7
        if (!plugin)
8
          puts "Could not find a plugin named #{ENV['PLUGIN']}"
9
        else
10
          puts "Migrating #{plugin.name} to " + (ENV['VERSION'] == nil ? "latest " : "") + "version " + (ENV['VERSION'] == nil ? "" : ENV['VERSION'])
11
          plugin.migrate ENV['VERSION'].to_i
12
        end
13
      else
14
        Rails.plugins.each do |plugin|
15
          next unless plugin.respond_to?('migrate')
16
          puts "Migrating #{plugin.name}..."
17
          plugin.migrate
18
        end
9 19
      end
10 20
    else
11 21
      puts "Undefined method plugins for Rails!"
    (1-1/1)