Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Development
  1. OpenProject
  2. Forums
  3. Development
  4. Plugin development: adding wicked_pdf as a plugin dependency fails

Plugin development: adding wicked_pdf as a plugin dependency fails

Added by Lene Preuss over 10 years ago

Hi,

I am currently developing an OpenProject plugin which uses the wicked_pdf gem to render PDF.

I have added these lines to my plugin’s gemspec:

  s.add_dependency "wicked_pdf"
  s.add_dependency "wkhtmltopdf-binary"

(the latter is a dependency of wicked_pdf). The gems are installed by bundle install, as can be seen here:

$ bundle install | grep -e 'w.*pdf'
Using wicked_pdf 0.11.0
Using wkhtmltopdf-binary 0.9.9.3

But upon starting rails I get the following error:

/home/lene/workspace/plugins/openproject-yellowhat-reports/config/initializers/wicked_pdf.rb:2:in `<top (required)>': uninitialized constant WickedPdf (NameError)
from /home/lene/.rvm/gems/ruby-2.1.2@bookmarx/gems/railties-3.2.19/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
[rest of backtrace available if there is interest]

The line in question (wicked_pdf.rb:2) is simply

WickedPdf.config = {

Confusingly, everything works as intended if I add wicked_pdf and wkhtmltopdf-binary to OpenProject’s Gemfile. The output of bundle install is the same, but rails starts, WickedPdf is defined and rendering PDFs works. Of course, adding dependencies to OpenProject’s Gemfile instead of from the plugin’s gemspec is not a sustainable option.

What am I doing wrong/how can this be fixed?

Thanks, Lene


Loading...