Merge remote-tracking branch 'origin/upgrade-to-ruby-3.2' into dev

pull/11871/head
Oliver Günther 2 years ago
commit cb60af9055
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 12
      .github/workflows/test-core.yml
  2. 2
      .ruby-version
  3. 4
      Gemfile
  4. 10
      Gemfile.lock
  5. 2
      app/validators/secure_context_uri_validator.rb
  6. 4
      docker/ci/Dockerfile
  7. 4
      docker/dev/backend/Dockerfile
  8. 4
      docker/prod/Dockerfile
  9. 2
      docs/development/development-environment-docker/README.md
  10. 12
      docs/development/development-environment-osx/README.md
  11. 16
      docs/development/development-environment-ubuntu/README.md
  12. 6
      docs/installation-and-operations/installation/manual/README.md
  13. 2
      lib/tasks/copyright.rake
  14. 2
      lib/tasks/scm.rake
  15. 6
      modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rb
  16. 4
      spec/lib/open_project/scm/adapters/git_adapter_spec.rb
  17. 10
      spec/lib/open_project/scm/adapters/subversion_adapter_spec.rb
  18. 51
      spec/support/rspec_mocks_ruby_3_2_fix_argument_forwarding.rb
  19. 4
      spec/support/scm/relocate_repository.rb
  20. 2
      spec/workers/scm/create_local_repository_job_spec.rb

@ -33,10 +33,10 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/cache
key: ${{ runner.os }}-ruby31-core-tests-units-${{ hashFiles('**/Gemfile.lock') }}
key: ${{ runner.os }}-ruby32-core-tests-units-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-ruby31-core-tests-units-
${{ runner.os }}-ruby31-core-tests-
${{ runner.os }}-ruby32-core-tests-units-
${{ runner.os }}-ruby32-core-tests-
- name: test
run: |
docker-compose -f docker-compose.ci.yml build --pull ci
@ -63,10 +63,10 @@ jobs:
uses: actions/cache@v2
with:
path: /tmp/cache
key: ${{ runner.os }}-ruby31-core-tests-features-${{ hashFiles('**/Gemfile.lock') }}
key: ${{ runner.os }}-ruby32-core-tests-features-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-ruby31-core-tests-features-
${{ runner.os }}-ruby31-core-tests-
${{ runner.os }}-ruby32-core-tests-features-
${{ runner.os }}-ruby32-core-tests-
- name: test
run: |
docker-compose -f docker-compose.ci.yml build --pull ci

@ -1 +1 @@
3.1.2
3.2.0

@ -28,7 +28,7 @@
source 'https://rubygems.org'
ruby '~> 3.1.2'
ruby '~> 3.2.0'
gem 'actionpack-xml_parser', '~> 2.0.0'
gem 'activemodel-serializers-xml', '~> 1.0.1'
@ -181,7 +181,7 @@ gem 'puma', '~> 6.0'
gem 'puma-plugin-statsd', '~> 2.0'
gem 'rack-timeout', '~> 0.6.3', require: "rack/timeout/base"
gem 'nokogiri', '~> 1.13.10'
gem 'nokogiri', '~> 1.14.0.rc1'
gem 'carrierwave', '~> 1.3.1'
gem 'carrierwave_direct', '~> 2.1.0'

@ -464,6 +464,8 @@ GEM
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (3.1.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
@ -648,7 +650,7 @@ GEM
netrc (0.11.0)
nio4r (2.5.8)
no_proxy_fix (0.1.2)
nokogiri (1.13.10)
nokogiri (1.14.0.rc1)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (5.6.1)
@ -1061,7 +1063,7 @@ DEPENDENCIES
multi_json (~> 1.15.0)
my_page!
net-ldap (~> 0.17.0)
nokogiri (~> 1.13.10)
nokogiri (~> 1.14.0.rc1)
oj (~> 3.13.0)
okcomputer (~> 1.18.1)
omniauth!
@ -1162,7 +1164,7 @@ DEPENDENCIES
with_advisory_lock (~> 4.6.0)
RUBY VERSION
ruby 3.1.2p20
ruby 3.2.0p0
BUNDLED WITH
2.3.12
2.4.1

@ -40,7 +40,7 @@ class SecureContextUriValidator < ActiveModel::EachValidator
end
# The URI could be parsable but not contain a host name
if uri.host.nil?
if uri.host.blank?
contract.errors.add(attribute, :invalid_url)
return
end

@ -1,4 +1,4 @@
FROM ruby:3.1.2-buster
FROM ruby:3.2.0-buster
MAINTAINER operations@openproject.com
ENV NODE_VERSION="16.17.0"
@ -27,7 +27,7 @@ RUN for url in $CHROME_SOURCE_URL; do \
ENV CI=true
ENV RAILS_ENV=test
ENV BUNDLER_VERSION="2.3.12"
ENV BUNDLER_VERSION="2.4.1"
ENV BUNDLE_WITHOUT="development:production:docker"
ENV OPENPROJECT_DISABLE_DEV_ASSET_PROXY=1
ENV CAPYBARA_DYNAMIC_BIND_IP=1

@ -1,4 +1,4 @@
FROM ruby:3.1.2-bullseye as develop
FROM ruby:3.2.0-bullseye as develop
MAINTAINER operations@openproject.com
ARG DEV_UID=1000
@ -7,7 +7,7 @@ ARG DEV_GID=1001
ENV USER=dev
ENV RAILS_ENV=development
ENV BUNDLER_VERSION "2.3.12"
ENV BUNDLER_VERSION "2.4.1"
# `--no-log-init` is required as a workaround to avoid disk exhaustion.
#

@ -1,4 +1,4 @@
FROM ruby:3.1.2-buster
FROM ruby:3.2.0-buster
MAINTAINER operations@openproject.com
# Allow platform-specific additions. Valid values are: on-prem,saas,bahn
@ -8,7 +8,7 @@ ARG GITHUB_OAUTH_TOKEN
ARG DEBIAN_FRONTEND=noninteractive
ENV NODE_VERSION="16.17.0"
ENV BUNDLER_VERSION="2.3.12"
ENV BUNDLER_VERSION="2.4.1"
ENV BUNDLE_PATH__SYSTEM=false
ENV APP_USER=app
ENV APP_PATH=/app

@ -186,7 +186,7 @@ When a dependency of the image or the base image itself is changed you may need
Ruby version is updated you may run into an error like the following when running `bin/compose setup`:
```
Your Ruby version is 2.7.6, but your Gemfile specified ~> 3.1.2
Your Ruby version is 2.7.6, but your Gemfile specified ~> 3.2.0
```
This means that the current image is out-dated. You can update it like this:

@ -15,7 +15,7 @@ We'll use [homebrew](https://brew.sh/) to install most of our requirements. Plea
## Install Ruby
Use [rbenv](https://github.com/rbenv/rbenv) and [ruby-build](https://github.com/rbenv/ruby-build#readme) to install Ruby. We always require the latest ruby versions, and you can check which version is required by [checking the Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile#L31) for the `ruby "~> X.Y"` statement. At the time of writing, this version is "3.1.2"
Use [rbenv](https://github.com/rbenv/rbenv) and [ruby-build](https://github.com/rbenv/ruby-build#readme) to install Ruby. We always require the latest ruby versions, and you can check which version is required by [checking the Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile#L31) for the `ruby "~> X.Y"` statement. At the time of writing, this version is "3.2.0"
### Install rbenv and ruby-build
@ -32,20 +32,20 @@ $ rbenv init
### Installing ruby-3.0
With both installed, we can now install the actual ruby version 3.0. You can check available ruby versions with `rbenv install --list`.
At the time of this writing, the latest stable version is `3.1.2`, which we also require.
At the time of this writing, the latest stable version is `3.2.0`, which we also require.
We suggest you install the version we require in the [Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile). Search for the `ruby '~> X.Y.Z'` line
and install that version.
```bash
# Install the required version as read from the Gemfile
rbenv install 3.1.2
rbenv install 3.2.0
```
This might take a while depending on whether ruby is built from source. After it is complete, you need to tell rbenv to globally activate this version
```bash
rbenv global 3.1.2
rbenv global 3.2.0
```
You also need to install [bundler](https://github.com/bundler/bundler/), the ruby gem bundler.
@ -116,10 +116,10 @@ You should now have an active ruby and node installation. Verify that it works w
```bash
$ ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
$ bundler --version
Bundler version 2.3.12
Bundler version 2.4.1
node --version
v16.17.0

@ -26,7 +26,7 @@ sudo apt-get install git curl build-essential zlib1g-dev libyaml-dev libssl-dev
## Install Ruby
Use [rbenv](https://github.com/rbenv/rbenv) and [ruby-build](https://github.com/rbenv/ruby-build#readme) to install Ruby. We always require the latest ruby versions, and you can check which version is required by [checking the Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile#L31) for the `ruby "~> X.Y"` statement. At the time of writing, this version is "3.1.2"
Use [rbenv](https://github.com/rbenv/rbenv) and [ruby-build](https://github.com/rbenv/ruby-build#readme) to install Ruby. We always require the latest ruby versions, and you can check which version is required by [checking the Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile#L31) for the `ruby "~> X.Y"` statement. At the time of writing, this version is "3.2.0"
### Install rbenv and ruby-build
@ -57,23 +57,23 @@ ruby-build is an addon to rbenv that installs ruby versions
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
```
### Installing ruby-3.0
### Installing ruby
With both installed, we can now install the actual ruby version 3.0. You can check available ruby versions with `rbenv install --list`.
At the time of this writing, the latest stable version is `3.1.2` which we also require.
With both installed, we can now install ruby. You can check available ruby versions with `rbenv install --list`.
At the time of this writing, the latest stable version is `3.2.0` which we also require.
We suggest you install the version we require in the [Gemfile](https://github.com/opf/openproject/blob/dev/Gemfile). Search for the `ruby '~> X.Y.Z'` line
and install that version.
```bash
# Install the required version as read from the Gemfile
rbenv install 3.1.2
rbenv install 3.2.0
```
This might take a while depending on whether ruby is built from source. After it is complete, you need to tell rbenv to globally activate this version
```bash
rbenv global 3.1.2
rbenv global 3.2.0
rbenv rehash
```
@ -159,10 +159,10 @@ You should now have an active ruby and node installation. Verify that it works w
```bash
ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
bundler --version
Bundler version 2.3.12
Bundler version 2.4.1
node --version
v16.13.1

@ -108,16 +108,16 @@ time to finish.
[openproject@host] source ~/.profile
[openproject@host] git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
[openproject@host] rbenv install 3.1.2
[openproject@host] rbenv install 3.2.0
[openproject@host] rbenv rehash
[openproject@host] rbenv global 3.1.2
[openproject@host] rbenv global 3.2.0
```
To check our Ruby installation we run `ruby --version`. It should output
something very similar to:
```
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
```
## Installation of Node

@ -113,7 +113,7 @@ namespace :copyright do
file_list = options[:file_list] || Dir[File.absolute_path(path) + "/**/*.#{ending}"]
excluded = exluded_paths.concat(additional_excludes)
raise 'Path not found' unless Dir.exists?(path)
raise 'Path not found' unless Dir.exist?(path)
file_list.each do |file_name|
# Skip 3rd party code

@ -65,7 +65,7 @@ namespace :scm do
next
end
unless Dir.exists?(managed)
unless Dir.exist?(managed)
warn "WARNING: Managed repository path set to '#{managed}'," \
" but does not exist for SCM vendor #{vendor}!"
next

@ -131,13 +131,13 @@ module OpenProject::XlsExport
end
# Add a simple row. This will default to the next row in the sequence.
# Fixnums, Dates and Times are preserved, all other types are converted
# to String as the spreadsheet gem cannot do more formats
# Integer, Float, Date, and Time instances are preserved, all other types
# are converted to String as the spreadsheet gem cannot do more formats
def add_row(arr, idx = nil)
idx ||= [@sheet.last_row_index + 1, 1].max
column_array = []
arr.each_with_index do |c, i|
value = if %w(Time Date Fixnum Float Integer).include?(c.class.name)
value = if %w(Time Date Float Integer).include?(c.class.name)
c
elsif c.instance_of?(BigDecimal)
c.to_f

@ -88,7 +88,7 @@ describe OpenProject::SCM::Adapters::Git do
describe 'invalid repository' do
describe '.check_availability!' do
it 'is not available' do
expect(Dir.exists?(url)).to be false
expect(Dir.exist?(url)).to be false
expect(adapter).not_to be_available
expect { adapter.check_availability! }
.to raise_error(OpenProject::SCM::Exceptions::SCMUnavailable)
@ -155,7 +155,7 @@ describe OpenProject::SCM::Adapters::Git do
end
it 'is a valid repository' do
expect(Dir.exists?(repo_dir)).to be true
expect(Dir.exist?(repo_dir)).to be true
out, process = Open3.capture2e('git', '--git-dir', repo_dir, 'branch')
expect(process.exitstatus).to eq(0)

@ -72,7 +72,7 @@ describe OpenProject::SCM::Adapters::Subversion do
describe 'invalid repository' do
describe '.check_availability!' do
it 'is not available' do
expect(Dir.exists?(url)).to be false
expect(Dir.exist?(url)).to be false
expect(adapter).not_to be_available
expect { adapter.check_availability! }
.to raise_error(OpenProject::SCM::Exceptions::SCMUnavailable)
@ -133,11 +133,11 @@ describe OpenProject::SCM::Adapters::Subversion do
describe '.create_empty_svn' do
context 'with valid root_url' do
it 'creates the repository' do
expect(Dir.exists?(root_url)).to be true
expect(Dir.exist?(root_url)).to be true
expect(Dir.entries(root_url).length).to eq 2
expect { adapter.create_empty_svn }.not_to raise_error
expect(Dir.exists?(root_url)).to be true
expect(Dir.exist?(root_url)).to be true
expect(Dir.entries(root_url).length).to be >= 5
end
end
@ -149,7 +149,7 @@ describe OpenProject::SCM::Adapters::Subversion do
expect { adapter.create_empty_svn }
.to raise_error(OpenProject::SCM::Exceptions::CommandFailed)
expect(Dir.exists?(root_url)).to be false
expect(Dir.exist?(root_url)).to be false
end
end
end
@ -172,7 +172,7 @@ describe OpenProject::SCM::Adapters::Subversion do
end
it 'is a valid repository' do
expect(Dir.exists?(repo_dir)).to be true
expect(Dir.exist?(repo_dir)).to be true
out, process = Open3.capture2e('svn', 'info', url)
expect(process.exitstatus).to eq(0)

@ -0,0 +1,51 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2022 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 COPYRIGHT and LICENSE files for more details.
#++
require 'rspec/mocks'
module RSpec
module Mocks
class Proxy
# Backport rspec/rspec-mocks#1508 for ruby 3.2 compatibility until a new
# version of rspec-mocks is released
#
# Delete this file if using rspec-mocks version > 3.12.1. The fix will
# probably be included.
ruby2_keywords :record_message_received
end
class VerifyingMethodDouble
# Backport rspec/rspec-mocks#1502 for ruby 3.2 compatibility until a new
# version of rspec-mocks is released
#
# Delete this file if using rspec-mocks version > 3.12.1. The fix will
# probably be included.
ruby2_keywords :proxy_method_invoked
end
end
end

@ -26,7 +26,7 @@ shared_examples_for 'repository can be relocated' do |vendor|
it 'relocates when project identifier is updated' do
current_path = repository.root_url
expect(repository.root_url).to eq(repository.managed_repository_path)
expect(Dir.exists?(repository.managed_repository_path)).to be true
expect(Dir.exist?(repository.managed_repository_path)).to be true
# Rename the project
project.update!(identifier: 'somenewidentifier')
@ -39,7 +39,7 @@ shared_examples_for 'repository can be relocated' do |vendor|
expect(current_path).not_to eq(repository.root_url)
expect(repository.url).to eq(repository.managed_repository_url)
expect(Dir.exists?(repository.managed_repository_path)).to be true
expect(Dir.exist?(repository.managed_repository_path)).to be true
end
end

@ -62,7 +62,7 @@ describe SCM::CreateLocalRepositoryJob do
shared_examples 'creates a directory with mode' do |expected|
it 'creates the directory' do
subject
expect(Dir.exists?(repository.root_url)).to be true
expect(Dir.exist?(repository.root_url)).to be true
file_mode = File.stat(repository.root_url).mode
expect(sprintf("%o", file_mode)).to end_with(expected)

Loading…
Cancel
Save