Using Ruby Gems in macros
Added by John Zurowski almost 11 years ago
Hi
I'm a relative novice to Ruby and redmine extensions so please bear with me.
On our local install of Redmine (Bitnami stack on Windows) details:
Environment: Redmine version 2.3.2.stable Ruby version 1.9.3-p231 (2012-05-25) [i386-mingw32] Rails version 3.2.13 Environment production Database adapter Mysql2 Redmine plugins: extended_fields 0.2.2 redmine_issue_templates 0.0.5 redmine_multi_column_custom_fields 0.0.1
I have extended macros.rb directly rather than through a plugin - as this was the most expedient things to do - mainly adding very project specific snippets such as being able to "display" project information stored in a file within a ticket.
I am now trying to do the same with some html content (loaded via http) and wanted to use nokogiri (which I see was bundled with this instance of Redmine).
However I am getting errors.
By just adding:
require 'rubygems' require 'nokogiri'
to the top of macros.rb causes the service to stop immediately after restart. This did not output anything into the production.log so I ran redmine on the command line and the output I got (hoping I've pasted the most relevant part) was:
C:\BitNami\redmine-2.3.2-0>ruby\bin\ruby.exe "C:\BitNami\redmine-2.3.2-0/apps/redmine\htdocs\bin\thin" start -p 3001 -e production -c "C:\BitNami\redmine-2.3.2-0/apps/redmine/htdoc s" --prefix /redmine >> Using rack adapter C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on': Missing helper file helpers/nokogiri.rb (LoadError) from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:135:in `block in modules_for_helpers' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:131:in `map!' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/helpers.rb:92:in `modules_for_helpers' from C:/BitNami/redmine-2.3.2-0/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/helpers.rb:95:in `helper'
This error occurred with other Gems too
Any help would be greatly appreciated