From 732b26467efbf17b727e3d71542684ed06e90a18 Mon Sep 17 00:00:00 2001 From: Mark Maglana Date: Thu, 9 Sep 2010 09:11:08 +0800 Subject: [PATCH] Make the user add trackers via Redmine interface Redmine needs to define a workflow for the trackers. We should let Redmine take care of that. --- lib/tasks/install.rake | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/tasks/install.rake b/lib/tasks/install.rake index 0d28920c6b..ff6b9d1779 100644 --- a/lib/tasks/install.rake +++ b/lib/tasks/install.rake @@ -68,15 +68,15 @@ namespace :redmine do if !Task.tracker # Check if there is at least one tracker available puts "-----------------------------------------------------" - if Setting.plugin_redmine_backlogs[:story_trackers].length < trackers.length + if settings[:story_trackers].length < trackers.length invalid = true while invalid # If there's at least one, ask the user to pick one puts "Which tracker do you want to use for your tasks?" - available_trackers = trackers.select{|t| !Setting.plugin_redmine_backlogs[:story_trackers].include? t.id} + available_trackers = trackers.select{|t| !settings[:task_tracker].include? t.id} j = 0 available_trackers.each_with_index { |t, i| puts " #{ j = i + 1 }. #{ t.name }" } - puts " #{ j + 1 }. <>" + # puts " #{ j + 1 }. <>" print "Choose one from above (or choose none to create a new tracker): " STDOUT.flush selection = (STDIN.gets.chomp!).split(/\D+/) @@ -86,20 +86,25 @@ namespace :redmine do print "You selected #{available_trackers[selection.first.to_i-1].name}. Is this correct? (y/n) " STDOUT.flush if (STDIN.gets.chomp!).match("y") - Setting.plugin_redmine_backlogs[:task_tracker] = available_trackers[selection.first.to_i-1].id + settings[:task_tracker] = available_trackers[selection.first.to_i-1].id invalid = false end - elsif selection.length == 0 or selection.first.to_i == j + 1 - # If the user chose to create a new one, then ask for the name - Setting.plugin_redmine_backlogs[:task_tracker] = create_new_tracker - invalid = false + # elsif selection.length == 0 or selection.first.to_i == j + 1 + # # If the user chose to create a new one, then ask for the name + # settings[:task_tracker] = create_new_tracker + # invalid = false else puts "Oooops! That's not a valid selection. Please try again." end end else # If there's none, ask to create one - settings[:task_tracker] = create_new_tracker + # settings[:task_tracker] = create_new_tracker + puts "You don't have any trackers available for use with tasks." + puts "Please create a new tracker via the Redmine admin interface," + puts "then re-run this installer. Press any key to continue." + STDOUT.flush + STDIN.gets end end