migrate_plugins.diff

Jean-Baptiste Barth, 2008-12-02 22:47

Download (830 Bytes)

View differences:

lib/tasks/migrate_plugins.rake (working copy)
12 12
      puts "Make sure engines plugin is installed."
13 13
    end
14 14
  end
15

  
16
  desc 'Migrate a specified plugin.'
17
  task :migrate_plugin => :environment do
18
    if ENV['NAME'].blank?
19
      puts "Please give a plugin name with NAME=my_plugin"
20
      exit
21
    end
22
    name = ENV['NAME']
23
    version = ENV['VERSION']
24
    if plugin = Rails.plugins[name]
25
      puts "Migrating #{plugin.name} to " + (version ? "version #{version}" : 'latest version') + "..."
26
      plugin.migrate(version ? version.to_i : nil)
27
    else
28
      puts "Plugin #{name} does not exist."
29
    end
30
  end
15 31
end