Some cleanups, required ruby changed to 2.1.5 and version bump

This commit is contained in:
Alexander Meindl 2017-04-03 19:42:20 +02:00
parent 145e422c43
commit 22ac3b94bc
39 changed files with 74 additions and 60 deletions

View File

@ -1,6 +1,9 @@
Rails: Rails:
Enabled: true Enabled: true
AllCops:
TargetRubyVersion: 2.1
Metrics/LineLength: Metrics/LineLength:
Max: 140 Max: 140

View File

@ -1,6 +1,13 @@
Changelog Changelog
========= =========
1.0.1
+++++
- Coding standard cleanups
- ruby 2.1.5 required or newer
- version bump
1.0.0 1.0.0
+++++ +++++

View File

@ -1,6 +1,6 @@
/*! /*!
* Redmine Tweaks plugin for Redmine * Redmine Tweaks plugin for Redmine
* Copyright (C) 2013-2016 AlphaNodes GmbH * Copyright (C) 2013-2017 AlphaNodes GmbH
*/ */
$(function() { $(function() {

View File

@ -1,6 +1,6 @@
/*! /*!
* Redmine Tweaks plugin for Redmine * Redmine Tweaks plugin for Redmine
* Copyright (C) 2013-2016 AlphaNodes GmbH * Copyright (C) 2013-2017 AlphaNodes GmbH
*/ */
$(function() { $(function() {

View File

@ -24,7 +24,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'redmine_tweaks' project = u'redmine_tweaks'
copyright = u'2013-2016, AlphaNodes GmbH' copyright = u'2013-2017, AlphaNodes GmbH'
author = u'Alexander Meindl' author = u'Alexander Meindl'
# The short X.Y version. # The short X.Y version.

View File

@ -33,7 +33,7 @@ Requirements
+--------------------+----------------------+ +--------------------+----------------------+
| `Redmine`_ version | >= 2.6.0 | | `Redmine`_ version | >= 2.6.0 |
+--------------------+----------------------+ +--------------------+----------------------+
| `Ruby`_ version | >= 2.0.0 | | `Ruby`_ version | >= 2.1.5 |
+--------------------+----------------------+ +--------------------+----------------------+
| Gem packages | see `PluginGemfile`_ | | Gem packages | see `PluginGemfile`_ |
+--------------------+----------------------+ +--------------------+----------------------+

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require 'redmine' require 'redmine'
require 'redmine_tweaks' require 'redmine_tweaks'
@ -8,7 +8,7 @@ Redmine::Plugin.register :redmine_tweaks do
name 'Tweaks' name 'Tweaks'
author 'AlphaNodes GmbH' author 'AlphaNodes GmbH'
description 'Wiki and content extensions' description 'Wiki and content extensions'
version '1.0.0' version '1.0.1'
author_url 'https://alphanodes.com/' author_url 'https://alphanodes.com/'
url 'https://github.com/alphanodes/redmine_tweaks' url 'https://github.com/alphanodes/redmine_tweaks'

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
if ActiveRecord::Base.connection.table_exists?(:settings) if ActiveRecord::Base.connection.table_exists?(:settings)
Rails.configuration.to_prepare do Rails.configuration.to_prepare do

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Redmine Tweak helper functions # Redmine Tweak helper functions
module RedmineTweaks module RedmineTweaks
@ -94,7 +94,7 @@ module RedmineTweaks
html_options = {} html_options = {}
html_options[:class] = 'external' if item[:url].include? '://' html_options[:class] = 'external' if item[:url].include? '://'
html_options[:title] = item[:title] unless item[:title].blank? html_options[:title] = item[:title] if item[:title].present?
Redmine::MenuManager.map(:top_menu).push menu_name, Redmine::MenuManager.map(:top_menu).push menu_name,
item[:url], item[:url],
caption: item[:name].to_s, caption: item[:name].to_s,

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
module RedmineTweaks module RedmineTweaks
class RedmineTweaksHookListener < Redmine::Hook::ViewListener class RedmineTweaksHookListener < Redmine::Hook::ViewListener

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require_dependency 'redmine/info' require_dependency 'redmine/info'

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
module RedmineTweaks module RedmineTweaks
module Patches module Patches
@ -35,7 +35,7 @@ module RedmineTweaks
return groups[manager_role].first.id unless groups.nil? || groups[manager_role].blank? return groups[manager_role].first.id unless groups.nil? || groups[manager_role].blank?
users_list = project.users_by_role users_list = project.users_by_role
return users_list[manager_role].first.id unless users_list[manager_role].blank? return users_list[manager_role].first.id if users_list[manager_role].present?
end end
def autoassign_get_group_list def autoassign_get_group_list
@ -56,7 +56,7 @@ module RedmineTweaks
def new_ticket_message def new_ticket_message
@new_ticket_message = '' @new_ticket_message = ''
message = Setting.plugin_redmine_tweaks[:new_ticket_message] message = Setting.plugin_redmine_tweaks[:new_ticket_message]
@new_ticket_message << message unless message.blank? @new_ticket_message << message if message.present?
end end
private private

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require_dependency 'time_entry' require_dependency 'time_entry'

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require_dependency 'wiki_controller' require_dependency 'wiki_controller'

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require_dependency 'wiki' require_dependency 'wiki'

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
module RedmineTweaks module RedmineTweaks
module Patches module Patches
@ -20,7 +20,7 @@ module RedmineTweaks
pdf.alias_nb_pages pdf.alias_nb_pages
pdf.footer_date = format_date(User.current.today) pdf.footer_date = format_date(User.current.today)
pdf.add_page pdf.add_page
unless RedmineTweaks.settings[:wiki_pdf_header].blank? if RedmineTweaks.settings[:wiki_pdf_header].present?
pdf.SetFontStyle('', 9) pdf.SetFontStyle('', 9)
pdf.RDMwriteFormattedCell(100, pdf.RDMwriteFormattedCell(100,
5, 5,

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Calendar wiki macros # Calendar wiki macros
module RedmineTweaks module RedmineTweaks
@ -27,7 +27,7 @@ module RedmineTweaks
options[:month] = options[:month].to_i - 1 options[:month] = options[:month].to_i - 1
selected = '' selected = ''
selected = RedmineTweaks.convert_string2date(options[:select]) unless options[:select].blank? selected = RedmineTweaks.convert_string2date(options[:select]) if options[:select].present?
locale = User.current.language.blank? ? ::I18n.locale : User.current.language locale = User.current.language.blank? ? ::I18n.locale : User.current.language
# not more then 30 calendars per page are expected # not more then 30 calendars per page are expected

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Date wiki macros # Date wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Gist wiki macros # Gist wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Issue wiki macros # Issue wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Last_updated_at wiki macros # Last_updated_at wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Last_updated_by wiki macros # Last_updated_by wiki macros
module RedmineTweaks module RedmineTweaks
@ -13,7 +13,7 @@ module RedmineTweaks
macro :last_updated_by do |obj, args| macro :last_updated_by do |obj, args|
raise 'The correct usage is {{last_updated_by}}' unless args.empty? raise 'The correct usage is {{last_updated_by}}' unless args.empty?
content_tag(:span, content_tag(:span,
"#{avatar(obj.author, size: 14)} #{link_to_user(obj.author)}".html_safe, safe_join([avatar(obj.author, size: 14), ' ', link_to_user(obj.author)]),
class: 'last-updated-by') class: 'last-updated-by')
end end
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Member wiki macros # Member wiki macros
module RedmineTweaks module RedmineTweaks
@ -54,7 +54,7 @@ module RedmineTweaks
users = [] users = []
raw_users.each do |user| raw_users.each do |user|
user_roles[user.id] = user.roles_for_project(project) user_roles[user.id] = user.roles_for_project(project)
if !options[:role].present? || RedmineTweaks.check_role_matches(user_roles[user.id], options[:role]) if options[:role].blank? || RedmineTweaks.check_role_matches(user_roles[user.id], options[:role])
users << user users << user
end end
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Project wiki macros # Project wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Recently updated wiki macros # Recently updated wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Slideshare wiki macros # Slideshare wiki macros
module RedmineTweaks module RedmineTweaks
@ -26,12 +26,12 @@ module RedmineTweaks
height = 485 height = 485
slide = 0 slide = 0
width = options[:width] unless options[:width].blank? width = options[:width] if options[:width].present?
height = options[:height] unless options[:height].blank? height = options[:height] if options[:height].present?
slide = options[:slide].to_i unless options[:slide].blank? slide = options[:slide].to_i if options[:slide].present?
if (options[:width].blank? && !options[:height].blank?) || if (options[:width].blank? && options[:height].present?) ||
(!options[:width].blank? && options[:height].blank?) || (options[:width].present? && options[:height].blank?) ||
args.empty? args.empty?
raise 'The correct usage is {{slideshare(<key>[, width=x, height=y, slide=number])}}' raise 'The correct usage is {{slideshare(<key>[, width=x, height=y, slide=number])}}'
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Twitter wiki macros # Twitter wiki macros
module RedmineTweaks module RedmineTweaks

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# User wiki macros # User wiki macros
module RedmineTweaks module RedmineTweaks
@ -38,7 +38,7 @@ module RedmineTweaks
end end
s = [] s = []
if !options[:avatar].blank? && options[:avatar] if options[:avatar].present? && options[:avatar]
s << avatar(user, size: 14) + ' ' s << avatar(user, size: 14) + ' '
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Vimeo wiki macros # Vimeo wiki macros
module RedmineTweaks module RedmineTweaks
@ -26,13 +26,13 @@ module RedmineTweaks
height = 360 height = 360
autoplay = false autoplay = false
width = options[:width] unless options[:width].blank? width = options[:width] if options[:width].present?
height = options[:height] unless options[:height].blank? height = options[:height] if options[:height].present?
autoplay = true if !options[:autoplay].nil? && autoplay = true if !options[:autoplay].nil? &&
(options[:autoplay] == 'true' || options[:autoplay] == '1') (options[:autoplay] == 'true' || options[:autoplay] == '1')
if (options[:width].blank? && !options[:height].blank?) || if (options[:width].blank? && options[:height].present?) ||
(!options[:width].blank? && options[:height].blank?) || (options[:width].present? && options[:height].blank?) ||
args.empty? args.empty?
raise 'The correct usage is {{vimeo(<video key>[, width=x, height=y])}}' raise 'The correct usage is {{vimeo(<video key>[, width=x, height=y])}}'
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
# Youtube wiki macros # Youtube wiki macros
module RedmineTweaks module RedmineTweaks
@ -26,13 +26,13 @@ module RedmineTweaks
height = 360 height = 360
autoplay = false autoplay = false
width = options[:width] unless options[:width].blank? width = options[:width] if options[:width].present?
height = options[:height] unless options[:height].blank? height = options[:height] if options[:height].present?
autoplay = true if !options[:autoplay].nil? && autoplay = true if !options[:autoplay].nil? &&
(options[:autoplay] == 'true' || options[:autoplay] == '1') (options[:autoplay] == 'true' || options[:autoplay] == '1')
if (options[:width].blank? && !options[:height].blank?) || if (options[:width].blank? && options[:height].present?) ||
(!options[:width].blank? && options[:height].blank?) || (options[:width].present? && options[:height].blank?) ||
args.empty? args.empty?
raise 'The correct usage is {{youtube(<video key>[, width=x, height=y])}}' raise 'The correct usage is {{youtube(<video key>[, width=x, height=y])}}'
end end

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
@ -21,7 +21,11 @@ module Redmine
end end
def test_locales_validness def test_locales_validness
lang_files_count = Dir["#{Rails.root}/plugins/redmine_tweaks/config/locales/*.yml"].size lang_files_count = Dir[Rails.root.join('plugins',
'redmine_tweaks',
'config',
'locales',
'*.yml')].size
assert_equal lang_files_count, 3 assert_equal lang_files_count, 3
valid_languages.each do |lang| valid_languages.each do |lang|
assert set_language_if_valid(lang) assert set_language_if_valid(lang)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)

View File

@ -1,5 +1,5 @@
# Redmine Tweaks plugin for Redmine # Redmine Tweaks plugin for Redmine
# Copyright (C) 2013-2016 AlphaNodes GmbH # Copyright (C) 2013-2017 AlphaNodes GmbH
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)