Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:

strategy:
matrix:
ruby: ['2.7', '3.0', '3.1']
redmine: ['5.0-stable', 'master']
ruby: ['3.2', '3.3']
redmine: ['6.0-stable', 'master']
db: ['postgres', 'mysql']
fail-fast: false

Expand Down Expand Up @@ -71,10 +71,7 @@ jobs:
- name: Checkout redmine_sidekiq
uses: actions/checkout@v3
with:
# TODO Switch back to the original repo, once https://github.com/ogom/redmine_sidekiq/pull/16 is released
# repository: ogom/redmine_sidekiq
repository: dosyfier/redmine_sidekiq
ref: fix-rails-6
repository: ogom/redmine_sidekiq
path: redmine/plugins/redmine_sidekiq

- name: Checkout gitolite
Expand Down Expand Up @@ -121,7 +118,9 @@ jobs:
run: |
sudo useradd --create-home git
sudo -n -u git -i mkdir bin
sudo -n -u git -i $GITHUB_WORKSPACE/gitolite/install -to /home/git/bin
sudo cp -r $GITHUB_WORKSPACE/gitolite /home/git/
sudo chown -R git:git /home/git/gitolite
sudo -n -u git -i perl /home/git/gitolite/install -to /home/git/bin
sudo cp plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub /home/git/
sudo chown git.git /home/git/redmine_gitolite_admin_id_rsa.pub
sudo -n -u git -i bin/gitolite setup -pk redmine_gitolite_admin_id_rsa.pub
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 7.0.0 - TBD

### Added

- Support for Redmine 6.0

### Changed

- Update all models to inherit from ApplicationRecord instead of ActiveRecord::Base
- Fix serialize syntax for Rails 7 compatibility using `type:` parameter
- Update minimum Ruby version requirement to 3.0+

### BREAKING CHANGE

- Redmine 6.0+ is required
- Ruby 3.0+ is required
- Removed support for Redmine 5.x

## 6.0.1 - 2022-11-04

### Changed
Expand Down
5 changes: 3 additions & 2 deletions app/models/repository_git_extra.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true

class RepositoryGitExtra < ActiveRecord::Base
class RepositoryGitExtra < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes
include Redmine::I18n

SMART_HTTP_OPTIONS = [[l(:label_disabled), '0'],
[l(:label_http_only), '3'],
Expand Down Expand Up @@ -33,7 +34,7 @@ class RepositoryGitExtra < ActiveRecord::Base
validate :validate_urls_order

## Serializations
serialize :urls_order, Array
serialize :urls_order, type: Array

## Callbacks
before_save :check_urls_order_consistency
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_post_receive_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RepositoryPostReceiveUrl < ActiveRecord::Base
validates :mode, presence: true, inclusion: { in: %i[github get post] }

## Serializations
serialize :triggers, Array
serialize :triggers, type: Array

## Scopes
scope :active, -> { where active: true }
Expand Down
2 changes: 1 addition & 1 deletion app/models/repository_protected_branche.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class RepositoryProtectedBranche < ActiveRecord::Base
class RepositoryProtectedBranche < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
include Redmine::SafeAttributes
VALID_PERMS = ['RW+', 'RW', 'R', '-'].freeze
DEFAULT_PERM = 'RW+'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class RepositoryProtectedBrancheWrapped < RepositoryProtectedBranche
serialize :user_list, Array
serialize :user_list, type: Array
end

class MigrateProtectedBranchesUsers < ActiveRecord::Migration[4.2]
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
author_url 'settings/plugin/redmine_git_hosting/authors'

settings partial: 'settings/redmine_git_hosting', default: RedmineGitHosting.settings
requires_redmine version_or_higher: '4.1.0'
requires_redmine version_or_higher: '6.0.0'

permission :create_gitolite_ssh_key, gitolite_public_keys: %i[index create destroy], require: :loggedin

Expand Down
2 changes: 1 addition & 1 deletion lib/redmine_git_hosting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module RedmineGitHosting
extend self

VERSION = '6.0.1'
VERSION = '7.0.0'

# Load RedminePluginLoader
extend RedminePluginLoader
Expand Down
39 changes: 14 additions & 25 deletions lib/redmine_git_hosting/redcarpet_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,35 @@

require 'html/pipeline/filter'
require 'html/pipeline/text_filter'
require 'redcarpet'
require 'rouge'
require 'rouge/plugins/redcarpet'

module RedmineGitHosting
class HTMLwithRouge < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet
end

class RedcarpetFilter < HTML::Pipeline::TextFilter
def initialize(text, context = nil, result = nil)
super text, context, result
@text = @text.delete "\r"
end

# Convert Markdown to HTML using the best available implementation
# and convert into a DocumentFragment.
# Convert Markdown to HTML using Redmine's WikiFormatting system
# for consistency with Redmine's text formatting configuration.
#
def call
html = self.class.renderer.render @text
html = markdown_formatter.new(@text).to_html
html.rstrip!
html
end

def self.renderer
@renderer ||= Redcarpet::Markdown.new HTMLwithRouge, markdown_options
end
private

def self.markdown_options
@markdown_options ||= {
fenced_code_blocks: true,
lax_spacing: true,
strikethrough: true,
autolink: true,
tables: true,
underline: true,
highlight: true
}.freeze
def markdown_formatter
# Find the markdown formatter from Redmine's WikiFormatting system
formatter_name = Redmine::WikiFormatting.format_names.find { |name| name =~ /markdown/i }

if formatter_name
Redmine::WikiFormatting.formatter_for(formatter_name)
else
# Fallback to textile formatter if no markdown formatter is available
Redmine::WikiFormatting.formatter_for('textile')
end
end

private_class_method :markdown_options
end
end
Loading