crigor.com

Redmine on Jruby

To be able to take advantage of jruby, you need to add config.threadsafe! on your rails app. I tried doing this on redmine 1.0.2 but some pages were not working. Some of the errors were

1
2
3
4
uninitialized constant Redmine::Views::OtherFormatsBuilder
uninitialized constant Redmine::DefaultData
uninitialized constant Redmine::Activity::Fetcher
uninitialized constant ActionView::Base::CompiledTemplates::TabularFormBuilder

I got it to work by changing config/initializers/30-redmine.rb to

1
2
3
4
5
6
7
8
9
10
11
12
I18n.default_locale = 'en'
dirs = ["SVG", "redmine"]
files = []
lib_path = "#{RAILS_ROOT}/lib"
matcher = /\A#{Regexp.escape(lib_path)}\/(.*)\.rb\Z/
dirs.each do |dir|
  files += Dir.glob("#{lib_path}/#{dir}/**/*.rb")
end
files += Dir.glob("#{lib_path}/*.rb")
files.each do |file|
  require file.sub(matcher, '\1')
end

Adding RAILS_ROOT/lib to config.eager_load_paths doesn’t work. If there is a better way, let me know in the comments.

Comments