OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Feature/gem update task (#9165)
ulferts901cbada65cd
diff --git a/.codeclimate.yml b/.codeclimate.ymlindex 8d932f29aac..dc4d32bb1ce 100644--- a/.codeclimate.yml+++ b/.codeclimate.yml@@ -27,7 +27,7 @@ checks:plugins:rubocop:enabled: true- channel: rubocop-1-9-1+ channel: rubocop-1-10-0# Codeclimate uses brakeman 4.3.1 which does not support rails 6# Check https://docs.codeclimate.com/docs/brakeman for updates.brakeman:diff --git a/Gemfile b/Gemfileindex c62b332edaf..bb7f92f8645 100644--- a/Gemfile+++ b/Gemfile@@ -248,7 +248,7 @@ group :ldap doendgroup :development do- gem 'listen', '~> 3.4.0' # Use for event-based reloaders+ gem 'listen', '~> 3.5.1' # Use for event-based reloadersgem 'faker'gem 'letter_opener'diff --git a/Gemfile.lock b/Gemfile.lockindex 2084b21f680..33e997d9ee1 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -278,8 +278,8 @@ GEMawesome_nested_set (3.4.0)activerecord (>= 4.0.0, < 7.0)aws-eventstream (1.1.1)- aws-partitions (1.434.0)- aws-sdk-core (3.113.0)+ aws-partitions (1.445.0)+ aws-sdk-core (3.114.0)aws-eventstream (~> 1, >= 1.0.2)aws-partitions (~> 1, >= 1.239.0)aws-sigv4 (~> 1.1)@@ -287,7 +287,7 @@ GEMaws-sdk-kms (1.43.0)aws-sdk-core (~> 3, >= 3.112.0)aws-sigv4 (~> 1.1)- aws-sdk-s3 (1.91.0)+ aws-sdk-s3 (1.93.1)aws-sdk-core (~> 3, >= 3.112.0)aws-sdk-kms (~> 1)aws-sigv4 (~> 1.1)@@ -300,7 +300,7 @@ GEMbindata (2.4.8)binding_of_caller (1.0.0)debug_inspector (>= 0.0.1)- bootsnap (1.7.2)+ bootsnap (1.7.3)msgpack (~> 1.0)brakeman (5.0.0)browser (5.3.1)@@ -386,7 +386,7 @@ GEMdate_validator (0.10.0)activemodel (>= 3)activesupport (>= 3)- debug_inspector (1.0.0)+ debug_inspector (1.1.0)deckar01-task_list (2.3.1)html-pipelinedeclarative (0.0.20)@@ -397,7 +397,7 @@ GEMdelayed_job (>= 4.1)delayed_job (4.1.9)activesupport (>= 3.0, < 6.2)- delayed_job_active_record (4.1.5)+ delayed_job_active_record (4.1.6)activerecord (>= 3.0, < 6.2)delayed_job (>= 3.0, < 5)diff-lcs (1.4.4)@@ -409,7 +409,7 @@ GEMuber (< 0.2.0)domain_name (0.5.20190701)unf (>= 0.0.5, < 1.0.0)- doorkeeper (5.5.0)+ doorkeeper (5.5.1)railties (>= 5)dry-configurable (0.12.1)concurrent-ruby (~> 1.0)@@ -420,7 +420,7 @@ GEMdry-core (0.5.0)concurrent-ruby (~> 1.0)dry-inflector (0.2.0)- dry-logic (1.1.0)+ dry-logic (1.1.1)concurrent-ruby (~> 1.0)dry-core (~> 0.5, >= 0.5)dry-types (1.5.1)@@ -447,7 +447,7 @@ GEMescape_utils (1.2.1)eventmachine (1.2.7)eventmachine_httpserver (0.2.1)- excon (0.79.0)+ excon (0.80.1)factory_bot (6.1.0)activesupport (>= 5.0.0)factory_bot_rails (6.1.0)@@ -455,17 +455,21 @@ GEMrailties (>= 5.0.0)faker (2.17.0)i18n (>= 1.6, < 2)- faraday (1.3.0)+ faraday (1.4.1)+ faraday-excon (~> 1.1)faraday-net_http (~> 1.0)+ faraday-net_http_persistent (~> 1.1)multipart-post (>= 1.2, < 3)- ruby2_keywords+ ruby2_keywords (>= 0.0.4)+ faraday-excon (1.1.0)faraday-http-cache (2.2.0)faraday (>= 0.8)faraday-net_http (1.0.1)+ faraday-net_http_persistent (1.1.0)fastimage (2.2.3)ffi (1.15.0)flamegraph (0.9.5)- fog-aws (3.9.0)+ fog-aws (3.10.0)fog-core (~> 2.1)fog-json (~> 1.1)fog-xml (~> 0.1)@@ -518,7 +522,7 @@ GEMdomain_name (~> 0.5)http_parser.rb (0.6.0)httpclient (2.8.3)- i18n (1.8.9)+ i18n (1.8.10)concurrent-ruby (~> 1.0)i18n-js (3.8.2)i18n (>= 0.6.6)@@ -548,7 +552,7 @@ GEMaddressable (~> 2.7)letter_opener (1.7.0)launchy (~> 2.2)- listen (3.4.1)+ listen (3.5.1)rb-fsevent (~> 0.10, >= 0.10.3)rb-inotify (~> 0.9, >= 0.9.10)livingstyleguide (2.1.0)@@ -566,12 +570,12 @@ GEMactivesupport (>= 4)railties (>= 4)request_store (~> 1.0)- loofah (2.9.0)+ loofah (2.9.1)crass (~> 1.0.2)nokogiri (>= 1.5.9)mail (2.7.1)mini_mime (>= 0.1.1)- marcel (1.0.0)+ marcel (1.0.1)messagebird-rest (1.4.2)meta-tags (2.14.0)actionpack (>= 3.2.0, < 6.2)@@ -598,15 +602,15 @@ GEMnewrelic_rpm (6.15.0)nio4r (2.5.7)no_proxy_fix (0.1.2)- nokogiri (1.11.2)+ nokogiri (1.11.3)mini_portile2 (~> 2.5.0)racc (~> 1.4)- nokogumbo (2.0.4)+ nokogumbo (2.0.5)nokogiri (~> 1.8, >= 1.8.4)octokit (4.20.0)faraday (>= 0.9)sawyer (~> 0.8.0, >= 0.5.3)- oj (3.11.3)+ oj (3.11.5)okcomputer (1.18.4)omniauth-saml (1.10.3)omniauth (~> 1.3, >= 1.3.2)@@ -625,9 +629,9 @@ GEMopenproject-token (2.1.3)activemodelparallel (1.20.1)- parallel_tests (3.5.2)+ parallel_tests (3.7.0)parallel- parser (3.0.0.0)+ parser (3.0.1.0)ast (~> 2.4.1)pdf-core (0.9.0)pdf-inspector (1.3.0)@@ -647,7 +651,7 @@ GEMprawn (2.4.0)pdf-core (~> 0.9.0)ttfunk (~> 1.7)- prawn-markup (0.3.0)+ prawn-markup (0.3.1)nokogiriprawnprawn-table@@ -762,7 +766,7 @@ GEMmime-types (>= 1.16, < 4.0)netrc (~> 0.8)retriable (3.1.2)- rexml (3.2.4)+ rexml (3.2.5)rinku (2.0.6)roar (1.1.0)representable (~> 3.0.0)@@ -780,7 +784,7 @@ GEMrspec-mocks (3.10.2)diff-lcs (>= 1.2.0, < 2.0)rspec-support (~> 3.10.0)- rspec-rails (5.0.0)+ rspec-rails (5.0.1)actionpack (>= 5.2)activesupport (>= 5.2)railties (>= 5.2)@@ -791,7 +795,7 @@ GEMrspec-retry (0.6.2)rspec-core (> 3.3)rspec-support (3.10.2)- rubocop (1.11.0)+ rubocop (1.12.1)parallel (~> 1.10)parser (>= 3.0.0.0)rainbow (>= 2.2.2, < 4.0)@@ -819,8 +823,9 @@ GEMruby-prof (1.4.3)ruby-progressbar (1.11.0)ruby-rc4 (0.1.5)- ruby-saml (1.11.0)- nokogiri (>= 1.5.10)+ ruby-saml (1.12.2)+ nokogiri (>= 1.10.5)+ rexmlruby2_keywords (0.0.4)rubytree (1.0.0)json (~> 2.1)@@ -846,16 +851,16 @@ GEMchildprocess (>= 0.5, < 4.0)rubyzip (>= 1.2.2)semantic (1.6.1)- sentry-delayed_job (4.3.0)+ sentry-delayed_job (4.3.1)sentry-ruby-core (~> 4.3.0)- sentry-rails (4.3.3)+ sentry-rails (4.3.4)railties (>= 5.0)sentry-ruby-core (~> 4.3.0)- sentry-ruby (4.3.1)+ sentry-ruby (4.3.2)concurrent-ruby (~> 1.0, >= 1.0.2)faraday (>= 1.0)- sentry-ruby-core (= 4.3.1)- sentry-ruby-core (4.3.1)+ sentry-ruby-core (= 4.3.2)+ sentry-ruby-core (4.3.2)concurrent-rubyfaradayshoulda-context (2.0.0)@@ -903,12 +908,12 @@ GEMunf_extunf_ext (0.0.7.7)unicode-display_width (2.0.0)- unicorn (5.8.0)+ unicorn (6.0.0)kgio (~> 2.6)raindrops (~> 0.7)- unicorn-worker-killer (0.4.4)+ unicorn-worker-killer (0.4.5)get_process_mem (~> 0)- unicorn (>= 4, < 6)+ unicorn (>= 4, < 7)validate_email (0.1.6)activemodel (>= 3.0)mail (>= 2.2.5)@@ -926,7 +931,7 @@ GEMwebfinger (1.1.0)activesupporthttpclient (>= 2.4)- webmock (3.12.1)+ webmock (3.12.2)addressable (>= 2.3.6)crack (>= 0.3.2)hashdiff (>= 0.4.0, < 2.0.0)@@ -1002,7 +1007,7 @@ DEPENDENCIESladlelaunchy (~> 2.5.0)letter_opener- listen (~> 3.4.0)+ listen (~> 3.5.1)livingstyleguide (~> 2.1.0)lograge (~> 0.11.0)meta-tags (~> 2.14.0)diff --git a/lib/open_project/patches/i18n_reject_empty_string.rb b/lib/open_project/patches/i18n_reject_empty_string.rbindex f0b483356d8..66d1aa0f04e 100644--- a/lib/open_project/patches/i18n_reject_empty_string.rb+++ b/lib/open_project/patches/i18n_reject_empty_string.rb@@ -59,6 +59,6 @@ module OpenProjectendend-OpenProject::Patches.patch_gem_version 'i18n', '1.8.9' do+OpenProject::Patches.patch_gem_version 'i18n', '1.8.10' doI18n.backend.singleton_class.prepend OpenProject::Patches::I18nRejectEmptyStringenddiff --git a/lib/tasks/dependencies.rake b/lib/tasks/dependencies.rakenew file mode 100644index 00000000000..13f65a9da5a--- /dev/null+++ b/lib/tasks/dependencies.rake@@ -0,0 +1,103 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2021 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require 'open3'++namespace :openproject do+ namespace :dependencies do+ desc 'Updates everything that is updatable automatically especially dependencies'+ task update: ['openproject:dependencies:update:gems',+ 'openproject:dependencies:update:rubocop']++ namespace :update do+ def parse_capture(capture, &block)+ capture+ .split("\n")+ .map do |line|+ block.call(line)+ end.compact+ end+++ desc 'Update gems to the extend the Gemfile allows in individual commits'+ task :gems do+ out, _process = Open3.capture3('bundle', 'outdated', '--parseable')++ parsed = parse_capture(out) do |line|+ line.match(/(\S+) \(newest ([0-9.]+), installed ([0-9.]+)(?:, requested .{0,2} ([0-9.]+))?\)/).to_a[1..4]+ end++ parsed.map(&:first).each do |gem|+ puts "Updating #{gem}"+ _out, error = Open3.capture3('bundle', 'update', gem)++ if error.present?+ puts "Attempted to update #{gem} but failed: #{error}"+ else+ out, _process = Open3.capture3('git', 'diff', 'Gemfile.lock')++ parsed = parse_capture(out) do |line|+ line.match(/\A\+\s{4}(\S+) \(([0-9.]+)\)\z/).to_a[1..2]+ end++ parsed.each do |gem, version|+ puts " #{gem}: #{version}"+ end++ Open3.capture3('git', 'add', 'Gemfile.lock')+ Open3.capture3('git', 'commit', '-m', "bump #{parsed.map(&:first).join(' & ')}")+ end+ end+ end++ desc 'Update rubocop used on codeclimate to the extend supported'+ task :rubocop do+ out, _process = Open3.capture3('git',+ 'ls-remote',+ 'https://github.com/codeclimate/codeclimate-rubocop',+ 'channel/rubocop*')++ parsed = parse_capture(out) do |line|+ matches = line.match(/rubocop-(\d+)-(\d+)(?:-(\d+))?/).to_a++ # This version seems to have been a mistake+ next if matches[0] == 'rubocop-1-70'++ matches[1..3].map(&:to_i) + [matches[0]]+ end++ new_version = parsed.sort.pop.last++ Open3.capture3('sed', '-i.bak', "s/channel: rubocop[-0-9]*/channel: #{new_version}/", '.codeclimate.yml')+ Open3.capture3('rm', '.codeclimate.yml.bak')+ Open3.capture3('git', 'add', '.codeclimate.yml')+ Open3.capture3('git', 'commit', '-m', "use #{new_version} on codeclimate")+ end+ end+ end+end