From ad4b3e542bc6ade4b91e971a760d4042e5b8c363 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 14 Jul 2010 10:58:08 -0700 Subject: [PATCH] [#4184] Added check to make sure the budget plugin is not installed. --- .../budget_plugin_migration.rb | 17 ++++++++++++++++- lib/tasks/budget_plugin_migration.rake | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lib/tasks/budget_plugin_migration.rake diff --git a/lib/redmine_contracts/budget_plugin_migration.rb b/lib/redmine_contracts/budget_plugin_migration.rb index 108ff20..c41a86b 100644 --- a/lib/redmine_contracts/budget_plugin_migration.rb +++ b/lib/redmine_contracts/budget_plugin_migration.rb @@ -1,7 +1,8 @@ require 'pp' module RedmineContracts - + class BudgetPluginInstalledError < StandardError; end + # TODO: decide how this is activated. # Have the user dump yaml themselves? Or rename the tables and # SQL select the data out into yaml? @@ -9,6 +10,20 @@ module RedmineContracts class BudgetPluginMigration @@data = nil + def self.check_for_installed_budget_plugin + if Redmine::Plugin.registered_plugins.keys.include?(:budget_plugin) + raise BudgetPluginInstalledError, "The budget plugin is still installed. Please remove it and retry the conversion" + end + end + + def self.rename_old_tables + + end + + def self.migrate_contracts + + end + def self.migrate(old_data) @@data = old_data diff --git a/lib/tasks/budget_plugin_migration.rake b/lib/tasks/budget_plugin_migration.rake new file mode 100644 index 0000000..cb1f0c6 --- /dev/null +++ b/lib/tasks/budget_plugin_migration.rake @@ -0,0 +1,9 @@ +namespace :redmine_contracts do + desc "Migrate data from the budget_plugin to redmine_contracts" + task :budget_migration => :environment do + RedmineContracts::BudgetPluginMigration.check_for_installed_budget_plugin + RedmineContracts::BudgetPluginMigration.rename_old_tables + RedmineContracts::BudgetPluginMigration.migrate_contracts + # RedmineContracts::BudgetPluginMigration.migrate + end +end