How to setup prawn on heroku when installed as a git submodule
- by brad
I have a rails app that I am trying to deploy to heroku. This app generates pdfs using prawn. I installed prawn as a git submodule rather than as a gem as this is what is recommended on the prawn website (here).
This has not worked well with heroku so far though. As stated on heroku's application constraints page submodules are not supported so I followed their instructions to track the submodule in the main project and tried again. This has not worked and when I access my application I get the following error:
App failed to start
An error happened during the initialization of your app.
This may be due to a typo, wrong number of arguments, or calling a
function that doesn’t exists. Check
the stack trace below for specific
details.
Make sure the app is working locally in production mode, by running
it with RAILS_ENV (for Rails apps) or
RACK_ENV (for Sinatra or other rack
apps) set to production. e.g.
RAILS_ENV=production script/server.
Original Error
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require':
/disk1/home/slugs/208590_03c9c22_67f5/mnt/app/controllers/invoices_controller.rb:37:
syntax error, unexpected ')'
(SyntaxError)
).to_pdf(@invoice)
(and then a whole lot more that I'll spare you from)
The .to_pdf function described in the last line is called in a controller in exactly the way described in the prawn how-to that I linked to above so my interpretation of the error message is that prawn is not being installed/detected.
Does anyone know how I can address this? I'm new to heroku so have little idea how to approach this. Is the submodule approach for prawn dead in the water from the get-go? Do I need to install it as a gem instead. I'd rather keep it as a submodule just because that works for now and I don't want to break it.