Padrino 0.9.27 - Project settings, routing, compatibility and bug fixes
Today, we released a new version of Padrino bringing us to 0.9.27. This release is only a week after our last hotfix release because we wanted to keep up the speed as we approach our 0.10.0 release that will coincide with the Sinatra 1.3 release.
We have also significantly improved our release processes as we approach 1.0 and now the continuous integration measures we put in place run all of our tests on every ruby version, a set of elaborate integration tests as well as full web benchmarks to measure our requests per second versus other ruby frameworks.
This release is primarily compatibility and bug fixes but also contains a few new features involving project-wide settings, reverse route recognition, and offline and test generation updates. Details of the features and fixes are below.
If you want to hear more about Padrino, a podcast was recently released on Rubiverse.
Project-wide Settings
In this release, we have added the notion of ‘project’ settings that are inherited by every Padrino application within the project. This can be used to set any properties but is particularly useful for sharing sessions across your apps. These project-wide settings are intended to live in config/apps.rb
and are generated in every new application.
# config/apps.rb
# Set the global project settings for your apps.
# These settings are inherited by your subapps.
# You can override these settings in each of your sub apps.
Padrino.configure_apps do
enable :sessions
set :foo, "bar"
end
Using this is optional and you can override these settings on a per-app basis as well. Commits are here, here, and here.
Reverse Route Recognition
We have occasionally had the need to access the current route from within a template in order to create links or determine the current page.
Given we have a route such as
# controllers.rb
controller :some do
get :other, :map => "/custom/url/with-:foo" do; end
end
We have added the ability to recognize a url and retrieve the route:
# my_view.haml
url(:some, :other, :foo => :bar)
# => /custom/url/with-bar
We have also added the ability to get the current page:
# in a path like /posts/?search=bar&name=foo
= link_to "Sort by Name", current_path("sort" => :name)
= link_to "Sort by Date", current_path("sort" => :date)
Commits for this are here and here.
Compatibility Fixes
- Upgrade to Sinatra 1.2.6 dependency from 1.2.4 by default
- Make logger Sinatra 1.3 compatible commit
- SCSS needs to rely on ‘sass’ gem instead of ‘haml’ commit
- Use CouchRest::Model in favor of deprecated CouchRest::ExtendedDocument. Thanks to Burgestrand! commit
- Use the sqlite3 gem as dependency for generated projects commit
- Use SecureRandom to generate session secret commit
- Partials can now be used directly with Sinatra from Padrino::Helpers commit, example
- Adds MongoMapper rake task for dropping the database commit
Bug Fixes
- Fix YAML by using ‘syck’ to parse by default commit
- Fix to slim template in admin for destroy session commit
- Offline generation of static js commit