avoid printing to stdout

pull/10261/head
ulferts 3 years ago
parent e9630be585
commit f4540b8825
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 19
      app/seeders/seeder.rb

@ -35,7 +35,7 @@ class Seeder
seed_data!
end
else
puts " *** #{not_applicable_message}"
Rails.logger.debug { " *** #{not_applicable_message}" }
end
end
@ -54,27 +54,20 @@ class Seeder
protected
def print_status(message)
print message
Rails.logger.info message
return unless block_given?
yield
puts
yield if block_given?
end
##
# Translate the given string with the fixed interpolation for base_url
# Deep interpolation is required in order for interpolations on hashes to work!
def translate_with_base_url(string)
I18n.t(string, deep_interpolation: true, base_url: "{{opSetting:base_url}}")
def translate_with_base_url(string, **i18n_options)
I18n.t(string, deep_interpolation: true, base_url: "{{opSetting:base_url}}", **i18n_options)
end
def edition_data_for(key)
data = translate_with_base_url("seeders.#{OpenProject::Configuration['edition']}.#{key}")
return nil if data.is_a?(String) && data.start_with?("translation missing")
data
translate_with_base_url("seeders.#{OpenProject::Configuration['edition']}.#{key}", default: nil)
end
def demo_data_for(key)

Loading…
Cancel
Save