view lib/tasks/load_default_data.rake @ 1080:5bd8c86cfa6a issue_540

Makes the Publication model act as an activity; overloading the default ActivitiesController#index view in the Bibliography Plugin in order to differentiate Publications from the other event types. * Known issues: ** route to /activities is not working (only to /activity); ** publication cache needs to be implemented in the model, not in the helper; ** when a publication is added to n projects, n events are created (all with the same content).
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 22 Nov 2012 16:51:23 +0000
parents cbb26bc654de
children 433d4f72a19b
line wrap: on
line source
desc 'Load Redmine default configuration data. Language is chosen interactively or by setting REDMINE_LANG environment variable.'

namespace :redmine do
  task :load_default_data => :environment do
    include Redmine::I18n
    set_language_if_valid('en')

    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
      STDOUT.flush
      puts "===================================="
    end

    begin
      Redmine::DefaultData::Loader.load(current_language)
      puts "Default configuration data loaded."
    rescue Redmine::DefaultData::DataAlreadyLoaded => error
      puts error
    rescue => error
      puts "Error: " + error
      puts "Default configuration data was not loaded."
    end
  end
end