Add mysql for travis tests
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
require: rubocop-performance
|
||||
require:
|
||||
- rubocop-performance
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
||||
33
.travis.yml
33
.travis.yml
@@ -1,18 +1,33 @@
|
||||
language: ruby
|
||||
dist: xenial
|
||||
|
||||
rvm:
|
||||
- 2.5.3
|
||||
- 2.4.5
|
||||
- 2.3.8
|
||||
- 2.6.3
|
||||
- 2.5.5
|
||||
- 2.4.6
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
env:
|
||||
- REDMINE_VER=4.0-stable DB=postgresql
|
||||
- REDMINE_VER=3.4-stable DB=postgresql
|
||||
- REDMINE_VER=4.0-stable DB=mysql
|
||||
- REDMINE_VER=3.4-stable DB=mysql
|
||||
|
||||
sudo: true
|
||||
|
||||
addons:
|
||||
postgresql: "9.6"
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 2.6.3
|
||||
env: REDMINE_VER=3.4-stable DB=mysql
|
||||
- rvm: 2.6.3
|
||||
env: REDMINE_VER=3.4-stable DB=postgresql
|
||||
- rvm: 2.5.5
|
||||
env: REDMINE_VER=3.4-stable DB=mysql
|
||||
- rvm: 2.5.5
|
||||
env: REDMINE_VER=3.4-stable DB=postgresql
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
@@ -26,6 +41,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 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
|
||||
@@ -34,12 +50,7 @@ before_install:
|
||||
- cp $TRAVIS_BUILD_DIR/test/support/database-$DB-travis.yml $REDMINE_PATH/config/database.yml
|
||||
|
||||
before_script:
|
||||
# - bundle exec rake redmine:load_default_data REDMINE_LANG=en
|
||||
# - bundle exec rake db:structure:dump
|
||||
- psql -c 'create database travis_ci_test;' -U postgres
|
||||
# - bundle exec rake db:create
|
||||
- bundle exec rake db:migrate
|
||||
- bundle exec rake redmine:plugins:migrate
|
||||
- bundle exec rake db:create db:migrate redmine:plugins:migrate
|
||||
|
||||
script:
|
||||
- export SKIP_COVERAGE=1
|
||||
|
||||
@@ -4,7 +4,7 @@ Changelog
|
||||
1.0.5
|
||||
-----
|
||||
|
||||
- ruby 2.3.x or newer is required
|
||||
- ruby 2.4.x or newer is required
|
||||
|
||||
|
||||
1.0.4
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -1,2 +1,8 @@
|
||||
gem 'slim-rails'
|
||||
gem 'validate_url'
|
||||
|
||||
group :development, :test do
|
||||
gem 'brakeman', require: false
|
||||
gem 'rubocop', require: false
|
||||
gem 'rubocop-performance', require: false
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ Requirements
|
||||
------------
|
||||
|
||||
* Redmine version >= 3.0.0
|
||||
* Ruby version >= 2.3.0
|
||||
* Ruby version >= 2.4.0
|
||||
|
||||
|
||||
Installation
|
||||
|
||||
13
init.rb
13
init.rb
@@ -1,7 +1,6 @@
|
||||
raise "\n\033[31mredmine_messenger requires ruby 2.3 or newer. Please update your ruby version.\033[0m" if RUBY_VERSION < '2.3'
|
||||
|
||||
require 'redmine'
|
||||
require 'redmine_messenger'
|
||||
require_dependency 'redmine_messenger'
|
||||
|
||||
Redmine::Plugin.register :redmine_messenger do
|
||||
name 'Redmine Messenger'
|
||||
@@ -41,3 +40,13 @@ Redmine::Plugin.register :redmine_messenger do
|
||||
post_password_updates: '0'
|
||||
}, partial: 'settings/messenger_settings'
|
||||
end
|
||||
|
||||
begin
|
||||
if ActiveRecord::Base.connection.table_exists?(Setting.table_name)
|
||||
Rails.configuration.to_prepare do
|
||||
RedmineMessenger.setup
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::NoDatabaseError
|
||||
Rails.logger.error 'database not created yet'
|
||||
end
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
Rails.configuration.to_prepare do
|
||||
module RedmineMessenger
|
||||
REDMINE_CONTACTS_SUPPORT = Redmine::Plugin.installed?('redmine_contacts') ? true : false
|
||||
REDMINE_DB_SUPPORT = Redmine::Plugin.installed?('redmine_db') ? true : false
|
||||
# this does not work at the moment, because redmine loads passwords after messener plugin
|
||||
REDMINE_PASSWORDS_SUPPORT = Redmine::Plugin.installed?('redmine_passwords') ? true : false
|
||||
module RedmineMessenger
|
||||
REDMINE_CONTACTS_SUPPORT = Redmine::Plugin.installed?('redmine_contacts') ? true : false
|
||||
REDMINE_DB_SUPPORT = Redmine::Plugin.installed?('redmine_db') ? true : false
|
||||
# this does not work at the moment, because redmine loads passwords after messener plugin
|
||||
REDMINE_PASSWORDS_SUPPORT = Redmine::Plugin.installed?('redmine_passwords') ? true : false
|
||||
|
||||
def self.settings
|
||||
class << self
|
||||
def setup
|
||||
# Patches
|
||||
Issue.send(:include, RedmineMessenger::Patches::IssuePatch)
|
||||
WikiPage.send(:include, RedmineMessenger::Patches::WikiPagePatch)
|
||||
ProjectsController.send :helper, MessengerProjectsHelper
|
||||
Contact.send(:include, RedmineMessenger::Patches::ContactPatch) if RedmineMessenger::REDMINE_CONTACTS_SUPPORT
|
||||
DbEntry.send(:include, RedmineMessenger::Patches::DbEntryPatch) if RedmineMessenger::REDMINE_DB_SUPPORT
|
||||
Password.send(:include, RedmineMessenger::Patches::PasswordPatch) if Redmine::Plugin.installed?('redmine_passwords')
|
||||
|
||||
# Global helpers
|
||||
ActionView::Base.send :include, RedmineMessenger::Helpers
|
||||
|
||||
# Hooks
|
||||
require_dependency 'redmine_messenger/hooks'
|
||||
end
|
||||
|
||||
def settings
|
||||
if Setting[:plugin_redmine_messenger].class == Hash
|
||||
if Rails.version >= '5.2'
|
||||
# convert Rails 4 data
|
||||
@@ -21,24 +37,10 @@ Rails.configuration.to_prepare do
|
||||
end
|
||||
end
|
||||
|
||||
def self.setting?(value)
|
||||
def setting?(value)
|
||||
return true if settings[value].to_i == 1
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Patches
|
||||
Issue.send(:include, RedmineMessenger::Patches::IssuePatch)
|
||||
WikiPage.send(:include, RedmineMessenger::Patches::WikiPagePatch)
|
||||
ProjectsController.send :helper, MessengerProjectsHelper
|
||||
Contact.send(:include, RedmineMessenger::Patches::ContactPatch) if RedmineMessenger::REDMINE_CONTACTS_SUPPORT
|
||||
DbEntry.send(:include, RedmineMessenger::Patches::DbEntryPatch) if RedmineMessenger::REDMINE_DB_SUPPORT
|
||||
Password.send(:include, RedmineMessenger::Patches::PasswordPatch) if Redmine::Plugin.installed?('redmine_passwords')
|
||||
|
||||
# Global helpers
|
||||
ActionView::Base.send :include, RedmineMessenger::Helpers
|
||||
|
||||
# Hooks
|
||||
require_dependency 'redmine_messenger/hooks'
|
||||
end
|
||||
|
||||
8
test/support/database-mysql-travis.yml
Normal file
8
test/support/database-mysql-travis.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
test:
|
||||
adapter: mysql2
|
||||
database: travis_ci_test
|
||||
host: localhost
|
||||
username: root
|
||||
password:
|
||||
pool: 5
|
||||
encoding: utf8mb4
|
||||
Reference in New Issue
Block a user