Browse Source

Don't load redcarpet with JRuby.

git-svn-id: http://svn.redmine.org/redmine/trunk@12453 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.5.0
Jean-Philippe Lang 10 years ago
parent
commit
a657a12450

+ 7
- 3
Gemfile View File

@@ -5,8 +5,6 @@ gem "jquery-rails", "~> 2.0.2"
gem "coderay", "~> 1.1.0"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
# TODO: upgrade to redcarpet 3.x when ruby1.8 support is dropped
gem "redcarpet", "~> 2.3.0"

# Optional gem for LDAP authentication
group :ldap do
@@ -19,14 +17,20 @@ group :openid do
gem "rack-openid"
end

# Optional gem for exporting the gantt to a PNG file, not supported with jruby
platforms :mri, :mingw do
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end

# Optional Markdown support, not for JRuby
group :markdown do
# TODO: upgrade to redcarpet 3.x when ruby1.8 support is dropped
gem "redcarpet", "~> 2.3.0"
end
end

platforms :jruby do

+ 9
- 2
lib/redmine.rb View File

@@ -22,6 +22,11 @@ begin
rescue LoadError
# RMagick is not available
end
begin
require 'Redcarpet' unless Object.const_defined?(:Redcarpet)
rescue LoadError
# Redcarpet is not available
end

require 'redmine/scm/base'
require 'redmine/access_control'
@@ -267,8 +272,10 @@ end

Redmine::WikiFormatting.map do |format|
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
format.register :markdown, Redmine::WikiFormatting::Markdown::Formatter, Redmine::WikiFormatting::Markdown::Helper,
:label => 'Markdown (experimental)'
if Object.const_defined?(:Redcarpet)
format.register :markdown, Redmine::WikiFormatting::Markdown::Formatter, Redmine::WikiFormatting::Markdown::Helper,
:label => 'Markdown (experimental)'
end
end

ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler

+ 1
- 0
lib/redmine/scm/adapters/abstract_adapter.rb View File

@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

require 'cgi'
require 'redmine/scm/adapters'

if RUBY_VERSION < '1.9'
require 'iconv'

+ 4
- 0
test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb View File

@@ -20,6 +20,8 @@ require File.expand_path('../../../../../test_helper', __FILE__)
class Redmine::WikiFormatting::MarkdownFormatterTest < ActionView::TestCase
include ApplicationHelper

if Object.const_defined?(:Redcarpet)

def setup
@formatter = Redmine::WikiFormatting::Markdown::Formatter
end
@@ -59,4 +61,6 @@ STR
text = 'This is a [link](/issues)'
assert_equal '<p>This is a <a href="/issues">link</a></p>', @formatter.new(text).to_html.strip
end

end
end

Loading…
Cancel
Save