Defect #36892
closedRedmine does not start when installed --without markdown
0%
Description
When installing Redmine 5.0.0 with
bundle install --without markdown
it fails with the following stack trace:
A formatter class is required ~/redmine-5.0.0/lib/redmine/wiki_formatting.rb:45:in `register' ~/redmine-5.0.0/lib/redmine/preparation.rb:400:in `block in prepare' ~/redmine-5.0.0/lib/redmine/wiki_formatting.rb:31:in `map' ~/redmine-5.0.0/lib/redmine/preparation.rb:396:in `prepare' ~/redmine-5.0.0/config/initializers/30-redmine.rb:11:in `block in <top (required)>' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:427:in `instance_exec' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:427:in `block in make_lambda' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:604:in `block (2 levels) in default_terminator' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:603:in `catch' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:603:in `block in default_terminator' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:199:in `block in halting' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `block in invoke_before' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `each' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:512:in `invoke_before' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/callbacks.rb:105:in `run_callbacks' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/reloader.rb:88:in `prepare!' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/application/finisher.rb:124:in `block in <module:Finisher>' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/initializable.rb:32:in `instance_exec' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/initializable.rb:32:in `run' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/initializable.rb:61:in `block in run_initializers' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/initializable.rb:60:in `run_initializers' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/application.rb:391:in `initialize!' ~/redmine-5.0.0/config/environment.rb:16:in `<top (required)>' ~/.gem/ruby/2.7.5/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require' ~/.gem/ruby/2.7.5/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:332:in `block in require' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:299:in `load_dependency' ~/.gem/ruby/2.7.5/gems/activesupport-6.1.4.7/lib/active_support/dependencies.rb:332:in `require' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/application.rb:367:in `require_environment!' ~/.gem/ruby/2.7.5/gems/railties-6.1.4.7/lib/rails/application.rb:533:in `block in run_tasks_blocks' ~/.gem/ruby/2.7.5/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' ~/.gem/ruby/2.7.5/bin/bundle:25:in `load' ~/.gem/ruby/2.7.5/bin/bundle:25:in `<main>' Tasks: TOP => db:migrate => db:load_config => environment
Although the redcarpet
gem is not a strict requirement with the commonmark
gem, in Redmine it is currently required by the CommonMark
formatter because Redmine::WikiFormatting::CommonMark::Formatter < Redmine::WikiFormatting::Markdown::Formatter
. The file where the Markdown formatter is defined, namely lib/redmine/wiki_formatting/markdown/formatter.rb
however defines a sub-class of a Redcloth class. This fails without Redcloth being available.
To solve this, we could either:
- include redcloth in the common_mark group in the
Gemfile
- or extract the markdown parts into different files / modules so that the common_mark stuff can be loaded without Redcloth being present.
Related issues
Updated by Marius BĂLTEANU over 2 years ago
- Status changed from New to Confirmed
- Target version set to 5.0.1
Updated by Marius BĂLTEANU over 2 years ago
Holger Just wrote:
To solve this, we could either:
- include redcloth in the common_mark group in the
Gemfile
- or extract the markdown parts into different files / modules so that the common_mark stuff can be loaded without Redcloth being present.
I think the second option sounds better.
Updated by Marius BĂLTEANU over 2 years ago
- Assignee set to Marius BĂLTEANU
I took a look again on this and for 5.0.1 it's better to go with option 1 because it doesn't require to many code changes. I'm going to commit the following change:
root@0f0593a01efb:/work# git diff
diff --git a/Gemfile b/Gemfile
index 25134c106..64fbd4fc6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -50,6 +50,9 @@ group :common_mark do
gem "commonmarker", (Gem.ruby_version < Gem::Version.new('2.6.0') ? '0.21.0' : '0.23.1')
gem "sanitize", "~> 6.0"
gem 'deckar01-task_list', '2.3.2'
+ # ToDo: Remove redcarpet dependency when common_mark is decoupled from markdown.
+ # See defect (#36892) for more details.
+ gem 'redcarpet', '~> 3.5.1'
end
For version 5.1, I'll add a new tichet to implement the second option.
Updated by Holger Just over 2 years ago
I don't think it's a good idea to define the redcarpet gem two times (in the markdown
and commonmark
groups) as this will cause a warning from bundler and could result in errors later when the version is updated in only one place.
Instead, it should probably be extracted as e.g.
gem 'redcarpet', '~> 3.5.1', :groups => [:markdown, :common_mark]
Updated by Marius BĂLTEANU over 2 years ago
- Resolution set to Fixed
Thanks Holger, I didn't see the warning.
I've committed now the change and I've created (#37119) to properly fix this.
Updated by Marius BĂLTEANU over 2 years ago
- Status changed from Confirmed to Closed
Updated by Holger Just over 1 year ago
- Related to Feature #37119: Drop redcarpet dependency for common_mark formatter added