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

Loading…
Cancel
Save