http://www.redmine.org/
+== 2009-xx-xx v0.8.3
+
+* Ability to set language for redmine:load_default_data task using REDMINE_LANG environment variable
+* Rescue Redmine::DefaultData::DataAlreadyLoaded in redmine:load_default_data task
+* Flush buffer when asking for language in redmine:load_default_data task
+
+
== 2009-03-07 v0.8.2
* Send an email to the user when an administrator activates a registered user
-desc 'Load Redmine default configuration data'\r
+desc 'Load Redmine default configuration data. Language is chosen interactively or by setting REDMINE_LANG environment variable.'\r
\r
namespace :redmine do\r
task :load_default_data => :environment do\r
include GLoc\r
set_language_if_valid('en')\r
- puts\r
\r
- while true\r
- print "Select language: "\r
- print GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }.join(", ")\r
- print " [#{GLoc.current_language}] "\r
- lang = STDIN.gets.chomp!\r
- break if lang.empty?\r
- break if set_language_if_valid(lang)\r
- puts "Unknown language!"\r
+ envlang = ENV['REDMINE_LANG']\r
+ if !envlang || !set_language_if_valid(envlang)\r
+ puts\r
+ while true\r
+ print "Select language: "\r
+ print GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }.join(", ")\r
+ print " [#{GLoc.current_language}] "\r
+ STDOUT.flush\r
+ lang = STDIN.gets.chomp!\r
+ break if lang.empty?\r
+ break if set_language_if_valid(lang)\r
+ puts "Unknown language!"\r
+ end\r
+ STDOUT.flush\r
+ puts "===================================="\r
end\r
\r
- puts "===================================="\r
- \r
begin\r
Redmine::DefaultData::Loader.load(current_language)\r
puts "Default configuration data loaded."\r
+ rescue Redmine::DefaultData::DataAlreadyLoaded => error\r
+ puts error\r
rescue => error\r
puts "Error: " + error\r
puts "Default configuration data was not loaded."\r