2009-03-15 13:01:04 +03:00
|
|
|
desc 'Load Redmine default configuration data. Language is chosen interactively or by setting REDMINE_LANG environment variable.'
|
2006-07-29 23:54:22 +04:00
|
|
|
|
2007-09-02 12:08:10 +04:00
|
|
|
namespace :redmine do
|
2008-01-04 21:27:05 +03:00
|
|
|
task :load_default_data => :environment do
|
2009-02-21 14:04:50 +03:00
|
|
|
include Redmine::I18n
|
2008-01-04 21:27:05 +03:00
|
|
|
set_language_if_valid('en')
|
2007-01-02 00:34:10 +03:00
|
|
|
|
2009-03-15 13:01:04 +03:00
|
|
|
envlang = ENV['REDMINE_LANG']
|
|
|
|
if !envlang || !set_language_if_valid(envlang)
|
|
|
|
puts
|
|
|
|
while true
|
|
|
|
print "Select language: "
|
|
|
|
print valid_languages.collect(&:to_s).sort.join(", ")
|
|
|
|
print " [#{current_language}] "
|
|
|
|
STDOUT.flush
|
|
|
|
lang = STDIN.gets.chomp!
|
|
|
|
break if lang.empty?
|
|
|
|
break if set_language_if_valid(lang)
|
|
|
|
puts "Unknown language!"
|
|
|
|
end
|
2009-03-12 21:11:44 +03:00
|
|
|
STDOUT.flush
|
2009-03-15 13:01:04 +03:00
|
|
|
puts "===================================="
|
2008-01-04 21:27:05 +03:00
|
|
|
end
|
2006-11-12 21:50:30 +03:00
|
|
|
|
2008-01-04 21:27:05 +03:00
|
|
|
begin
|
|
|
|
Redmine::DefaultData::Loader.load(current_language)
|
|
|
|
puts "Default configuration data loaded."
|
2009-03-15 13:03:56 +03:00
|
|
|
rescue Redmine::DefaultData::DataAlreadyLoaded => error
|
|
|
|
puts error
|
2008-01-04 21:27:05 +03:00
|
|
|
rescue => error
|
|
|
|
puts "Error: " + error
|
|
|
|
puts "Default configuration data was not loaded."
|
|
|
|
end
|
|
|
|
end
|
2007-09-02 12:08:10 +04:00
|
|
|
end
|