Padrino

Padrino 0.13.0 - Mustermann Router, Performance Enhancements, Streaming Support, and Much More

Padrino 0.12.4 was shipped on October 19th 2014. Hard to believe that just about a year has flown by since then as we have been working towards our next major release of Padrino. While there have been betas available for some time, we are excited to announce the final release of Padrino 0.13.0! This version has a huge host of improvements and upgrades, both big and small.

This 0.13.0 release brings several major changes and updates including a completely redesigned router, significant performance enhancements, streaming support, bug fixes and a ton of code cleanup. Full details for this release are below. You should also check out the 0.13.0 upgrade guide as well for a detailed look at moving up from 0.12.X.

Redesigned Mustermann Router

One of the big changes in this release was the retirement of http_router which is no longer being maintained. We have switched to a brand new router written by @namusyaka. The older router had accrued significant technical debt with many hacks and workarounds introduced along with thread-safety issues. We’ve been working on this redesigned router for quite sometime, running router benchmarks and making sure we took our time to ensure a smooth replacement. We are proud to unveil the new router with this release and you can read more details in this PR.

Project-wide Configuration

With 0.13.0 comes project-wide global configuration options with environment support. This is inspired by the Sinatra configuration system but is project-wide rather than app-specific. Configuration can be done anywhere in your project including config/apps.rb:

Padrino.config.value1 = 42

Padrino.configure :development do |config|
  config.value2 = "only development"
end

Padrino.configure :development, :production do |config|
  config.value2 = "both development and production"
end

Padrino.configure do |config|
  config.value2 = "any environment"
end

and then these values can be accessed with:

Padrino.config.value1 # => 42
Padrino.config.value2 # => 'any environment'

Thanks to @ujifgc for implementing this. More details can be found in the PR.

Sinatra Upgrades

In this release, we have upgraded Sinatra to the latest 1.4.6 release which allowed us to clean up several previous workarounds. The result is an even cleaner integration with Sinatra. This includes the following Sinatra compatibility improvements:

We are committed to compatibility with our Sinatra core and this release marks a solid step forward in that regard.

Component Updates

There are several component updates and tweaks in this release including but not limited to:

Performance Improvements

We are committed to making Padrino as lightweight and comparable to raw Sinatra speed as possible. In that vein, we have made the following improvements:

We’ve also introduced a benchmark test suite to test speed for padrino core and router:

This should help us in making continued improvements going forward.

Bug Fixes and Misc Improvements

A full list of other changes can be found on Github but an abridged version has been appended below:

  • FIX #1614 Do not search for caller in bundler lib (@ujifgc)
  • FIX #1796 Save and restore layout setting on render (@ujifgc)
  • FIX #1965 Fail properly on wrong mailer name or message (@ujifgc)
  • FIX #1916 Check key existence on caching (@namusyaka)
  • NEW #1919 allow configuring log file path
  • FIX #1931 render partials in mail if padrino-helpers is available (@ujifgc)
  • FIX #1829 add absoluteurl to app methods, add :baseurl setting (@ujifgc)
  • NEW #1898 Adds missing helpers for the input html element (@namusyaka)
  • FIX AWS namespace in Dynamoid component (@namusyaka)
  • FIX Root index route incorrectly matches single-character URLs (@namusyaka)
  • NEW #1929 Alias db:migrate:down and db:migrate:up when using datamapper (@postmodern)
  • FIX Restore AbstractFormBuilder#fieldhumanname (@namusyaka)
  • FIX #1936 Don’t echo password input (@namusyaka)
  • FIX Cache test for moneta (@ujifgc)
  • FIX #1943 Issue with format provides in controller with wildcard accepts header (@ujifgc)
  • FIX properly reload classes without instances (@ujifgc)
  • FIX #1922 consider methodless constants not external (@ujifgc)
  • NEW #1853 Adds wrapper for application which allows better extensibility (@namusyaka)
  • NEW Remove deprecated cache functionality (@minad)
  • FIX #1772 add button content tag to button_to block (@ujifgc)
  • FIX #1795 load missing models for sq:seed (@ujifgc)
  • NEW Use mustermann19 in all cases now (@namusyaka)
  • FIX #1803 Use relative paths for sqlite and sequel (@ujifgc)
  • FIX #1821 Don’t load dependency files unless app’s root is within Padrino root (@namusyaka)
  • FIX #1835 Switch admin to sequel fixtures rather than datamapper (@namusyaka)
  • FIX Widen the range of default_dependency_paths (@namusyaka)
  • NEW #1831 Implement the mi:translate task (@namusyaka)
  • FIX #1852 ApplicationWrapper Prerequisite Issue (@hcatlin)
  • FIX #1856 Skips loading models for the activerecord rake tasks (@namusyaka)
  • NEW #1818 Implement source_location option for logger (@namusyaka)
  • FIX #1859 Correct issues with the admin seeds generator (@Quintasan)
  • FIX #1879 Improve access to Active Record Database Configuration (@scudelletti)
  • DELETE remove deprecations (String#undent, #linkto with :fragment, old caching, old form builder, rendering #fetchtemplatefile, #cachetemplatefile!, #resolvedlayout, Application#loadpaths, Padrino.setloadpaths, Padrino.loadpaths)
  • FIX #1860 Padrino —environment switch now takes precedence over RACK_ENV environment variable
  • FIX #1849 return proper exit codes in CLI

Want to give a special thanks to the key contributors for this release, working tirelessly to make this Padrino release happen: @ujifgc, @namusyaka. Thanks so much!

Please report any issues you encounter with this release! We are working very actively on Padrino and want to make the framework as stable and reliable as possible. 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.


Upgrading Padrino from 0.12.X to 0.13.0 Guide

This is the step-by-step guide for upgrading from Padrino 0.12.X to 0.13.0! This will review all the breaking changes and modifications made within the new release. Be sure to also check the 0.13.0 Release Blog Post for more information.

Deprecated Features Removed

Several deprecated methods were removed in this release including:

  • #link_to with :fragment
    • Use :fragment for #url instead: url(:controller, :action, :fragment => "foo")
  • Application#load_paths, Padrino.set_load_paths, Padrino.load_paths
    • To set, use $LOAD_PATH.concat(paths)
    • To get, use Padrino.prerequisites instead
    • deprecated caching methods
    • methods including #get, #set, #flush (see more here)
  • deprecated form builder methods
    • methods including field_error and nested_form? (see more here")
  • #fetch_template_file, #cache_template_file!, #resolved_layout rendering methods
    • No replacement exists
  • String#undent
    • No replacement exists

Helper Changes

There are a few helper changes to be aware of:

  • select_tag used to be fairly ambiguous when specifying “selected” options. The ambiguity has been removed by always relying on the “value” where possible.
    • Switch your :selected options to indicate the value of the option wherever possible. (see more here)

New Routing System

Subtle differences likely exist between the old http_router and the new mustermann powered system. These differences include:

  • Splat arguments in URL are now a string rather than an array
    • get :show, :map => "/show/*name" used to return params[:name] as an array. Now this is a string.

  • Prev Page
  • Next Page