language for default configuration data can now be chosen when running 'load_default_data' task

git-svn-id: http://redmine.rubyforge.org/svn/trunk@132 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-01-01 21:34:10 +00:00
parent 6487c1803f
commit e7caec6e7d
1 changed files with 17 additions and 4 deletions

View File

@ -1,9 +1,22 @@
desc 'Load default configuration data (using default language)'
desc 'Load default configuration data'
task :load_default_data => :environment do
include GLoc
set_language_if_valid($RDM_DEFAULT_LANG)
puts
while true
print "Select language: "
print GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }.join(", ")
print " [#{GLoc.current_language}] "
lang = STDIN.gets.chomp!
break if lang.empty?
break if set_language_if_valid(lang)
puts "Unknown language!"
end
puts "===================================="
begin
# check that no data already exists
if Role.find(:first)
@ -19,7 +32,7 @@ begin
raise "Some enumerations are already defined."
end
puts "Loading default configuration for language: #{current_language}"
puts "Loading default configuration data for language: #{current_language}"
# roles
manager = Role.create :name => l(:default_role_manager)
@ -83,6 +96,6 @@ begin
rescue => error
puts "Error: " + error
puts "Default configuration can't be loaded."
puts "Default configuration data can't be loaded."
end
end