Working on Redmine 4.1 support; drop Redmine 3.x support
This commit is contained in:
20
.rubocop.yml
20
.rubocop.yml
@@ -1,5 +1,6 @@
|
||||
require:
|
||||
- rubocop-performance
|
||||
- rubocop-rails
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
@@ -15,32 +16,37 @@ Metrics/BlockLength:
|
||||
Max: 60
|
||||
|
||||
Metrics/ClassLength:
|
||||
Max: 500
|
||||
Enabled: false
|
||||
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 20
|
||||
|
||||
Metrics/LineLength:
|
||||
Layout/LineLength:
|
||||
Max: 140
|
||||
|
||||
Metrics/MethodLength:
|
||||
Max: 60
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Max: 500
|
||||
Enabled: false
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 25
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
Rails/ApplicationJob:
|
||||
Enabled: false
|
||||
|
||||
Rails/ApplicationRecord:
|
||||
Enabled: false
|
||||
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Enabled: false
|
||||
|
||||
# we drop this, if we drop Rails 4.2 support
|
||||
Rails/ApplicationRecord:
|
||||
Enabled: false
|
||||
Rails/HelperInstanceVariable:
|
||||
Enabled: false
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
Enabled: false
|
||||
|
||||
Performance/ChainArrayAllocation:
|
||||
Enabled: true
|
||||
|
||||
26
.travis.yml
26
.travis.yml
@@ -2,9 +2,9 @@ language: ruby
|
||||
dist: xenial
|
||||
|
||||
rvm:
|
||||
- 2.6.3
|
||||
- 2.5.5
|
||||
- 2.4.6
|
||||
- 2.6.5
|
||||
- 2.5.7
|
||||
- 2.4.9
|
||||
|
||||
services:
|
||||
- mysql
|
||||
@@ -12,23 +12,12 @@ services:
|
||||
|
||||
env:
|
||||
- REDMINE_VER=4.0-stable DB=postgresql
|
||||
- REDMINE_VER=3.4-stable DB=postgresql
|
||||
- REDMINE_VER=master DB=postgresql
|
||||
- REDMINE_VER=4.0-stable DB=mysql
|
||||
- REDMINE_VER=3.4-stable DB=mysql
|
||||
- REDMINE_VER=master DB=mysql
|
||||
|
||||
sudo: true
|
||||
|
||||
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:
|
||||
urls:
|
||||
@@ -54,7 +43,4 @@ before_script:
|
||||
|
||||
script:
|
||||
- export SKIP_COVERAGE=1
|
||||
- if [[ "$REDMINE_VER" == "master" ]]; then bundle exec rake redmine:plugins:test:units NAME=$PLUGIN_NAME; fi
|
||||
- if [[ "$REDMINE_VER" == "master" ]]; then bundle exec rake redmine:plugins:test:functionals NAME=$PLUGIN_NAME; fi
|
||||
- if [[ "$REDMINE_VER" == "master" ]]; then bundle exec rake redmine:plugins:test:integration NAME=$PLUGIN_NAME; fi
|
||||
- if [[ "$REDMINE_VER" != "master" ]]; then bundle exec rake redmine:plugins:test NAME=$PLUGIN_NAME RUBYOPT="-W0"; fi
|
||||
- bundle exec rake redmine:plugins:test NAME=$PLUGIN_NAME RUBYOPT="-W0"
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.0.6
|
||||
-----
|
||||
|
||||
- Redmine 4 is required
|
||||
- Redmine 4.1 support
|
||||
|
||||
|
||||
1.0.5
|
||||
-----
|
||||
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -3,6 +3,4 @@ gem 'validate_url'
|
||||
|
||||
group :development, :test do
|
||||
gem 'brakeman', require: false
|
||||
gem 'rubocop', require: false
|
||||
gem 'rubocop-performance', require: false
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ Go to Rocket.Chat documentation [Incoming WebHook Scripting](https://rocket.chat
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* Redmine version >= 3.0.0
|
||||
* Redmine version >= 4.0.0
|
||||
* Ruby version >= 2.4.0
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class CreateMessengerSettings < Rails.version < '5.2' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
|
||||
class CreateMessengerSettings < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :messenger_settings do |t|
|
||||
t.references :project, null: false, index: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class AddDefaultMentions < Rails.version < '5.2' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
|
||||
class AddDefaultMentions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :messenger_settings, :default_mentions, :string
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class AddPrivateSettings < Rails.version < '5.2' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
|
||||
class AddPrivateSettings < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :messenger_settings, :post_private_contacts, :integer, default: 0, null: false
|
||||
add_column :messenger_settings, :post_private_db, :integer, default: 0, null: false
|
||||
|
||||
4
init.rb
4
init.rb
@@ -8,9 +8,9 @@ Redmine::Plugin.register :redmine_messenger do
|
||||
url 'https://github.com/alphanodes/redmine_messenger'
|
||||
author_url 'https://alphanodes.com/'
|
||||
description 'Messenger integration for Slack, Discord, Rocketchat and Mattermost support'
|
||||
version '1.0.5'
|
||||
version '1.0.6'
|
||||
|
||||
requires_redmine version_or_higher: '3.0.0'
|
||||
requires_redmine version_or_higher: '4.0.0'
|
||||
|
||||
permission :manage_messenger, projects: :settings, messenger_settings: :update
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ module RedmineMessenger
|
||||
class << self
|
||||
def setup
|
||||
# Patches
|
||||
Issue.send(:include, RedmineMessenger::Patches::IssuePatch)
|
||||
WikiPage.send(:include, RedmineMessenger::Patches::WikiPagePatch)
|
||||
Issue.include RedmineMessenger::Patches::IssuePatch
|
||||
WikiPage.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')
|
||||
Contact.include(RedmineMessenger::Patches::ContactPatch) if RedmineMessenger::REDMINE_CONTACTS_SUPPORT
|
||||
DbEntry.include(RedmineMessenger::Patches::DbEntryPatch) if RedmineMessenger::REDMINE_DB_SUPPORT
|
||||
Password.include(RedmineMessenger::Patches::PasswordPatch) if Redmine::Plugin.installed?('redmine_passwords')
|
||||
|
||||
# Global helpers
|
||||
ActionView::Base.send :include, RedmineMessenger::Helpers
|
||||
ActionView::Base.include RedmineMessenger::Helpers
|
||||
|
||||
# Hooks
|
||||
require_dependency 'redmine_messenger/hooks'
|
||||
@@ -23,14 +23,9 @@ module RedmineMessenger
|
||||
|
||||
def settings
|
||||
if Setting[:plugin_redmine_messenger].class == Hash
|
||||
if Rails.version >= '5.2'
|
||||
# convert Rails 4 data
|
||||
new_settings = ActiveSupport::HashWithIndifferentAccess.new(Setting[:plugin_redmine_messenger])
|
||||
Setting.plugin_redmine_messenger = new_settings
|
||||
new_settings
|
||||
else
|
||||
ActionController::Parameters.new(Setting[:plugin_redmine_messenger])
|
||||
end
|
||||
new_settings = ActiveSupport::HashWithIndifferentAccess.new(Setting[:plugin_redmine_messenger])
|
||||
Setting.plugin_redmine_messenger = new_settings
|
||||
new_settings
|
||||
else
|
||||
# Rails 5 uses ActiveSupport::HashWithIndifferentAccess
|
||||
Setting[:plugin_redmine_messenger]
|
||||
|
||||
@@ -17,11 +17,7 @@ class I18nTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
def test_locales_validness
|
||||
lang_files_count = Dir[Rails.root.join('plugins',
|
||||
'redmine_messenger',
|
||||
'config',
|
||||
'locales',
|
||||
'*.yml')].size
|
||||
lang_files_count = Dir[Rails.root.join('plugins/redmine_messenger/config/locales/*.yml')].size
|
||||
assert_equal lang_files_count, 4
|
||||
valid_languages.each do |lang|
|
||||
assert set_language_if_valid(lang)
|
||||
|
||||
Reference in New Issue
Block a user