Let’s have a quick look on how to reuse our Ruby code and gems in Java leveraging the awesome work of JRuby guys. What we need is Java, Gradle and JRuby installed and we are ready to rock.
HTML-to-PDF or Prawn? Let’s look how these compare by generating an invoice using PDFKit and InvoicePrinter and examine performance, memory and usability.
Ruby on Rails come with three environments by default – development, testing and production. But sooner or later one has a need for staging environment. And don’t get me wrong, you can (or should?) use the production settings there, but if you run it locally or on the same server as production, chances are you need a different database. And while you are at it, it may be handy to allow logging to console or change any other of Rails settings for that matter. In fact you can create as many other environments as you want and since it’s really easy I encourage you to do so.
This is a little thought on packaged Ruby versions (mostly in Linux-based systems) and why I don’t get many people advising newcomers to start by installing RVM when in reality they just want to program Ruby.
They are many options how to generate PDF versions of your invoices in Ruby and the ones that do not come with system dependencies are often built on top of Prawn library. InvoicePrinter is no different. Here is a short announcement on what it is (and aims to be) and what not.