Padrino 0.10.3 - Sinatra 1.3, Documentation, Minitest, Improved Logger, and

This month and the next is a great time for the Sinatra community at large. Sinatra 1.3 has been released with a lot of exciting changes. Alongside the official release, the sinatra-contrib project is also slowly maturing and will be semi-officially supported by the Sinatra team. The sinatra-recipes resource is a great reference to using components with Sinatra. In addition, Kyle Drake has come along and released sinatra-synchrony which allows for evented concurrent Sinatra applications with almost no code changes and no callbacks.

Thankfully, because Padrino is just Sinatra at its core, our framework and our users can benefit from all the great things being introduced recently for Sinatra. Today we have pushed our Padrino 0.10.3 release which contains a lot of major updates. 0.10.3 upgrades our core to Sinatra 1.3, upgrades our entire test suite to minitest, and upgrades our entire source code documentation to YARD. We have also been hard at work fixing bugs, upgrading our logger, and improving compatibility with JRuby and Rubinius wherever possible. There is also a deprecation you should be aware of in regards to rack-flash. Details for this release are below.

Sinatra 1.3 Upgrade

Sinatra 1.3 has been released with a lot of exciting changes. Be sure to checkout the changes in 1.3.0 in the Sinatra Changelog.

In this release, we have happily upgraded our core to Sinatra 1.3.0. Don't worry as there weren't any breaking changes and upgrading your Padrino projects should be painless. Now all of Padrino is Sinatra 1.3 compatible and taking advantage of the updates including the default enabled rack-protection.

One interesting feature of Sinatra 1.3 to note is the new streaming API:

# app.rb
get '/' do
  stream do |out|
    out << "It's gonna be legen -\n"
    sleep 0.5
    out << " (wait for it) \n"
    sleep 1
    out << "- dary!\n"

As explained by RKH, the cool thing about this is that it abstracts away the differences between all the different Rack servers taking into account their capabilities. Be sure to read the official announcement to see other new features.

Related 1.3 integration commits are here, here, and here.

Rack-Flash Deprecation

The rack-flash gem has been a dependency of Padrino since early versions of our framework. The gem provides the flash functionality that most of us depend on in our controllers. Unfortunately, this gem is not compatible with the latest versions of Rack or Sinatra. This gem also depends on private APIs and is not actively maintained. For this reason, Sinatra and Padrino developers are advised to replace rack-flash in their projects before upgrading to 0.10.3.

Fortunately, upgrading your project and replacing rack-flash is easy thanks to several viable alternatives that provide the same functionality. First and foremost is the new Padrino default for flash, the sinatra-flash gem. This gem is essentially a drop-in replacement that works in nearly the same way while maintaining a cleaner codebase and leveraging only stable Sinatra public APIs. This gem is likely to work consistently with Sinatra going forward.

New projects in Padrino now automatically include this replacement and upgrading to sinatra-flash is as easy as replacing rack-flash in your Gemfile:

# Gemfile
gem "sinatra-flash" # Replaces gem "rack-flash"

In addition, daddye has contributed a slimmer and faster flash in padrino-contrib. Usage is described in the file itself but is as easy as register Padrino::Contrib::Helpers::Flash. Either solution should make upgrading a snap.

For more information about the switch be sure to read the Github Issue on the subject or see the related commit.

Testing and Minitest

We have been using test-unit and shoulda in Padrino as long as the framework has been around. I am a personal fan of test-unit + shoulda and have been using the combination successfully in many projects. However, times change and the fact that Ruby 1.9 seems to recommend minitest over test-unit encouraged us to take a look at the pain of upgrading.

We wanted a faster test suite and less external dependencies. So we decided to bite the bullet and convert our entire test suite over to the minitest test library. Built into 1.9 but available as a gem for 1.8.X, this library is quite stable and fast. The best part is that it has a lot of the great parts of shoulda built in. Thanks to the magic of a few strategic aliases, we can even keep the same shoulda syntax we know and love. Thanks to Ken Collins for making our path from Test::Unit to MiniTest a painless one. We are excited to have a leaner, faster test suite going forward.

Commits are here, here, here, and here.


Since the creation of Padrino, we have always aspired to have good documentation, guides, and release notes that make getting started with our framework that much easier. That said, we had always used RDoc for our inline source docs and we felt the generated APIs and our documentation coverage left something to be desired.

In this release, we are happy to announce that we have converted the entire source code documentation to YARD and in the process did a better job of documenting the public and semipublic interfaces for our framework. We are excited about this release and continuing to improve our documentation. Thanks to postmodern for helping us get the ball rolling.

Converting this documentation was a team effort with lots of commits: 1, 2, 3, 4, 5, 6, 7, 8, 9.

You can checkout the newly generated YARD docs for Padrino at our API Docs page. We would appreciate any patches to help us improve our docs even further! Speaking of which, a few more documentation fixes:

  • Fix issue with generator for template runner on https paths (Thanks xavierRiley): commit.
  • Removes unnecessary commas in doc example (Thanks ugisozols): commit.
  • Document better example of Padrino::Admin::AccessControl (Thanks Benjamin Oakes): commit.
  • Fix typos and inaccuracies related to `time_ago_in_words` helpers: commit

Also, be sure to check out our entirely new Getting Started guide geared towards newcomers to the Sinatra / Padrino community. The guide is intended to provide you the necessary basics and resources to become familiar with the Ruby, Rinatra and Padrino ecosystem.


We have also made a few improvements and updates to our components:

  • Adds minitest test component to project generator: commits here, and here.
  • Remove less dependency for less generation: commit.
  • Added content_for? method to test for content (Thanks mlightner): commit.
  • Make YAML locale files Psych compliant for JRuby 1.9 support (Thanks skade): commit.
  • Improved logger with much nicer colors and formatted output: [commit here, here and here].
  • Adds Latvian locale translation (Thanks ugisozols): commit.

Asset Compression

One final bonus feature to this post is a quick discussion about asset compression / pipelines. Since the release of that feature as a default in Rails 3.1, we have been fielding a lot of questions regarding an equivalent module for Sinatra and Padrino. In the spirit of addressing these concerns, a few early options for Sinatra:

These options should get you started if you are interested in bringing asset pipelining to your Sinatra applications. None of these quite match the comprehensive Rails solution just yet but well on their way.

That concludes the changelog for this release. As always if you want to keep up with Padrino updates, be sure to follow us on twitter: @padrinorb, join us on IRC at “#padrino” on freenode or open an issue on GitHub.

Padrino 0.10.2 - ActiveSupport 3.1, TravisCI Support, Routing and Misc Bug

Just about 1 month ago, we released 0.10.1 which had several important bug fixes after our major 0.10.0 release. Today we are releasing 0.10.2 which continues in this tradition and provides a bunch more fixes that were reported since the last release. We sincerely appreciate everyone opening issues and sending us pull requests on Github. Our framework wouldn’t be half as solid without your contributions.

This release of 0.10.2 marks the beginning of our usage of TravisCI, major route reloading fixes, and a slew of bug fixes for the mailer, renderer, helpers, generators and more. We have also upgraded and locked to ActiveSupport 3.1. If you are using 0.10.1 and having trouble with the reloader, please upgrade to 0.10.2! Details for this release are below.

Upgrade to ActiveSupport 3.1

ActiveSupport 3.1 has been officially released and we have upgraded Padrino accordingly! Padrino 0.10.2 and on will require the latest and greatest ActiveSupport. Upgrading should be painless because there are not many backwards incompatibilities.


This release marks the beginning of our use of Travis CI for Padrino. TravisCI is a great tool for the open source community and improves our continuous integration testing for all versions of Ruby. commit


This release is largely pushed out to fix a major route reloading bug recently introduced. Reloading has continuously been the most error-prone and hardest to test aspect of our system. This has become frustrating for us as well as for our users. However, thanks to Hollin Wilkins & Dave Willett @ TrueCar in San Francisco, this route issue has been resolved for now. Please let us know if you are still experiencing issues when on 0.10.2! Check out the commit which fixed the issue.

We also fixed an issue with routes that contain the word ‘index’. Check out the commit.


  • Adds support for mysql2 when using sequel as adapter (Thanks rafaelss): commit
  • Fixes potential issue with libxml-ruby (Thanks farcaller): commit

Miscellaneous and Bug Fixes

  • Default content type for mailer has been corrected: commit
  • Rendering a hash i.e render :json => obj is now properly set as json: commit
  • Protect admin login from XSS attacks: commit
  • Escape certain html entities when writing html tags: commit
  • Fixes error block handling for ::Exception: commit
  • Fix model test_config require when not using default top level: commit
  • Outputs the partials that are rendered in development mode (Thanks minikomi): commit
  • Preserve the original options when resolving a template (Thanks Xylakant): commit
  • Moved from rdoc documentation to yard: commit
  • Fix issue with not respecting RACK_ENV in the CLI: commit
  • Fixes issue when rendering partials with a forward slash (Thanks philly-mac): commit, commit

That concludes the changelog for this release. As always if you want to keep up with Padrino updates, be sure to follow us on twitter: @padrinorb, join us on IRC at “#padrinorb” on freenode or open an issue on GitHub.

  • Prev Page
  • Next Page