From 57fac45dd7ecc36c777fc04918f065c5b4c33ad4 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Wed, 13 Mar 2019 07:57:50 +0100 Subject: [PATCH] RAILS_ENV=test for travis #40 --- .travis.yml | 2 +- init.rb | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c367fe3..7c7aa270 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: - export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git - export REDMINE_PATH=$HOME/redmine - export BUNDLE_GEMFILE=$REDMINE_PATH/Gemfile - - export REDMINE_LANG=en + - export RAILS_ENV=test - git clone $REDMINE_GIT_REPO $REDMINE_PATH - cd $REDMINE_PATH - if [[ "$REDMINE_VER" != "master" ]]; then git checkout -b $REDMINE_VER origin/$REDMINE_VER; fi diff --git a/init.rb b/init.rb index 6b5680d1..4e7fb949 100644 --- a/init.rb +++ b/init.rb @@ -38,17 +38,19 @@ Redmine::Plugin.register :additionals do RedCloth3::ALLOWED_TAGS << 'div' end -Rails.configuration.to_prepare do - Additionals.setup -end +if ActiveRecord::Base.connection.table_exists?(:settings) + Rails.configuration.to_prepare do + Additionals.setup + end -Rails.application.config.after_initialize do - FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab), - far: AdditionalsFontAwesome.load_icons(:far), - fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze -end + Rails.application.config.after_initialize do + FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab), + far: AdditionalsFontAwesome.load_icons(:far), + fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze + end -Rails.application.paths['app/overrides'] ||= [] -Dir.glob(Rails.root.join('plugins', '*', 'app', 'overrides')).each do |dir| - Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir) + Rails.application.paths['app/overrides'] ||= [] + Dir.glob(Rails.root.join('plugins', '*', 'app', 'overrides')).each do |dir| + Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir) + end end