Skip to content

Commit

Permalink
Merge pull request #158 from arBmind/feature/redmine5
Browse files Browse the repository at this point in the history
Redmine 5.0 support
  • Loading branch information
arBmind authored Feb 24, 2023
2 parents ee9c9c3 + 84df61f commit ec937a4
Show file tree
Hide file tree
Showing 46 changed files with 642 additions and 1,303 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG RUBY_VERSION=3.1
ARG REDMINE_VERSION=5-stable

FROM alpinelab/ruby-dev:${RUBY_VERSION} AS redmine
ARG REDMINE_VERSION
ENV REDMINE_VERSION=${REDMINE_VERSION}

RUN \
cd / \
&& mv /app /redmine \
&& chmod ugo+w /redmine
WORKDIR /redmine
14 changes: 14 additions & 0 deletions .devcontainer/postgres/Gemfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
group :development do
# gem 'better_errors'
# gem 'binding_of_caller'
# gem 'meta_request' # support RailsPanel in Chrome
#
# gem 'pry'
# gem 'pry-byebug'
# gem 'pry-rails'

# gem "debase", "0.2.5.beta2", require: false
# gem "ruby-debug-ide", "~> 0.7.3"
gem "debug"
gem 'rufo', require: false
end
16 changes: 16 additions & 0 deletions .devcontainer/postgres/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

development: &postgres
adapter: postgresql
encoding: utf8
database: redmine
username: postgres
password: postgres
host: postgres
port: 5432

test:
<<: *postgres
database: redmine_test

production:
<<: *postgres
58 changes: 58 additions & 0 deletions .devcontainer/postgres/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "Redmine - Postgres",
"dockerComposeFile": "docker-compose.yml",
"service": "redmine",
"workspaceFolder": "/redmine",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "vscode",
"userUid": "1000",
"userGid": "1000"
},
"ghcr.io/devcontainers/features/ruby:1": "none",
"ghcr.io/devcontainers/features/node:1": "none",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},
"customizations": {
"vscode": {
"extensions": [
"rebornix.Ruby",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg",
"craigmaslowski.erb",
"hridoy.rails-snippets",
"misogi.ruby-rubocop",
"jnbt.vscode-rufo",
"donjayamanne.git-extension-pack"
],
"settings": {
"sqltools.connections": [
{
"name": "Rails Development Database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "redmine",
"username": "postgres"
},
{
"name": "Rails Test Database",
"driver": "PostgreSQL",
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"database": "redmine_test",
"username": "postgres"
}
]
}
}
},
"forwardPorts": [ 5000 ],
"postCreateCommand": "sh -x /redmine/post-create.sh",
"remoteUser": "vscode"
}
42 changes: 42 additions & 0 deletions .devcontainer/postgres/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '3.7'

services:
redmine:
build:
context: .
target: redmine
args:
RUBY_VERSION: "3.1.3"
REDMINE_VERSION: "5.0-stable"
NODE_VERSION: "lts/*"
volumes:
- redmine-data:/redmine/files
- node_modules:/redmine/node_modules
- bundle:/bundle
- ../..:/redmine/plugins/redmine_hourglass
- ./Gemfile.local:/redmine/Gemfile.local
- ./database.yml:/redmine/config/database.yml
- ./post-create.sh:/redmine/post-create.sh
environment:
RAILS_ENV: development
REDMINE_SECRET_KEY_BASE: supersecretkey
REDMINE_PLUGINS_MIGRATE: 'true'
command: sleep infinity
depends_on:
- postgres

postgres:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_DB: redmine
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

volumes:
postgres-data: null
redmine-data:
node_modules:
bundle:
27 changes: 27 additions & 0 deletions .devcontainer/postgres/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e

. ${NVM_DIR}/nvm.sh
nvm install --lts

sudo chown -R vscode:vscode .
sudo chmod ugo+w /bundle

git config --global --add safe.directory /redmine
git init
git remote add origin https://github.com/redmine/redmine.git
git fetch
git checkout -t origin/${REDMINE_VERSION} -f
git apply plugins/redmine_hourglass/.devcontainer/postgres/redmine5_i18n.patch

bundle

bundle exec rails config/initializers/secret_token.rb
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails redmine:plugins

# RAILS_ENV=test bundle exec rails db:drop
# RAILS_ENV=test bundle exec rails db:create
# RAILS_ENV=test bundle exec rails db:migrate
# RAILS_ENV=test bundle exec rails redmine:plugins
13 changes: 13 additions & 0 deletions .devcontainer/postgres/redmine5_i18n.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 805e3c61c..42b5ab23f 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -125,7 +125,7 @@ module Redmine
if options[:cache] == false
available_locales = ::I18n.backend.available_locales
valid_languages.
- select {|locale| available_locales.include?(locale)}.
+ select {|locale| available_locales.include?(locale) && (ll(locale.to_s, :general_lang_name) rescue false) }.
map {|lang| [ll(lang.to_s, :general_lang_name), lang.to_s]}.
sort_by(&:first)
else
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
redmine: [ '4.1.3', '4.2.1' ]
ruby: [ '2.5.9', '2.6.8' ]
redmine: [ '5.0.4', '4.2.9' ]
ruby: [ '2.7.7', '2.6.8' ]
database: [ 'sqlite3', 'postgresql', 'mysql2' ]
include:
- redmine: '5.0.4'
ruby: '3.1.3'
database: 'postgresql'
- redmine: '5.0.4'
ruby: '3.1.3'
database: 'mysql2'

services:
postgresql:
Expand Down Expand Up @@ -39,7 +47,7 @@ jobs:
- name: Install redmine
run: wget https://github.com/redmine/redmine/archive/${{ matrix.redmine }}.tar.gz -qO- | tar -C $GITHUB_WORKSPACE -xz --strip=1 --show-transformed -f -

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
path: 'plugins/redmine_hourglass'

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- [please add bug fixes]

## [1.3.0] - TBA

### Added
- support for Redmine 5
- support for Ruby >2.6
- Added .devcontainer to ease development

### Changed
- Upgraded Gems to support Rails 6
- Fixed Swagger API documentation for mass update and create

### Fixed
- Asset compilation for Redmine images

## [1.2.0] - 2023-02-21

Non-Beta Release after proving that everything works.
Expand Down
12 changes: 6 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ gem 'pundit', '~> 1.1.0'

# this is useful for unix based systems which don't have a js runtime installed
# if you are on windows and this makes problems, simply remove the line
gem 'therubyracer', :platform => :ruby
# gem 'therubyracer', :platform => :ruby

# views
gem 'slim', '~> 3.0.8'
gem 'js-routes', '~> 1.3'
gem 'js-routes', '~> 2.2.4'
gem 'momentjs-rails', '>= 2.10.7'

gem 'rswag', '<2.0' # api docs
gem 'rswag', '~> 2.5.1' # api docs
gem 'rspec-core'
gem 'rqrcode' unless dependencies.any? { |d| d.name == 'rqrcode' }

group :development, :test do
gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
gem 'factory_bot_rails', '< 5.0'
gem 'rspec-rails', '~> 5.1.2'
gem 'factory_bot_rails'
gem 'zonebie'
gem 'database_cleaner'
gem 'faker', '~> 2.15', '>= 2.15.1'
gem 'faker'
end

if RUBY_VERSION < "2.1"
Expand Down
14 changes: 0 additions & 14 deletions app/assets/javascripts/swagger.coffee

This file was deleted.

29 changes: 29 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,32 @@
background: url(/images/link.png) no-repeat 0% 70%;
}
}

.swagger-ui {
input,
select,
button {
height: auto;
}
}

.swagger-note {
margin-top: 10px;

.swagger-link {
font-size: 1.3em;
font-weight: bold;
text-decoration: none;

.logo__img {
display: block;
float: left;
margin-top: 2px;
}

.logo__title {
display: inline-block;
padding: 5px 0 0 10px;
}
}
}
2 changes: 0 additions & 2 deletions app/assets/stylesheets/swagger-print.scss

This file was deleted.

Loading

0 comments on commit ec937a4

Please sign in to comment.