Padrino 0.17.0 release
Padrino 0.17.0 is out. It runs on Ruby 4.0 and HAML 6 and 7, adds Falcon, Vite and Tailwind CSS to the generators, and fixes a long list of bugs in the generators, the mailer, the reloader and the ActiveRecord rake tasks. It also removes generators for ORMs that are no longer maintained, so read the breaking changes below before you upgrade.
Thanks to @achiurizo, @osbre, @genkami, @matsubara0507 and @Shaisolaris for their work on this release. The full list is in CHANGES.rdoc.
Padrino 0.16.2 is out too. It brings HAML 6 and 7 and Ruby 4.0 to apps that stay on 0.16 for now, such as Middleman sites.
Highlights
- Ruby 4.0 and HAML 6/7. Padrino also runs with
--enable-frozen-string-literal. - New generator options:
--server=falcon,--script=viteand--stylesheet=tailwind. - Faster boot outside development: files are only tracked for reloading in development.
- Mailers are safe to deliver concurrently, and Padrino's view helpers (
link_to,form_for,partial) work in mailer templates. - ActiveRecord 7.1 to 8.1 rake tasks work again, and the ActiveRecord model and migration generators take
:indexand:uniq(email:string:uniq). - Generated projects set
SameSite=Laxon the session cookie and skip CSRF checks in the test environment. - jQuery 3.7.1:
--script jqueryandpadrino g admincopy jQuery 3.7.1 (was 1.9 and 1.11), with an updated UJS adapter. - Hardening: static files are served only from the public folder;
link_toandform_tagdropjavascript:and other unsafe URL schemes; admin access control compares decoded paths.
Breaking changes
- Removed ORMs. The DataMapper, MongoMapper, CouchRest, Ripple and Mongomatic generators and rake tasks are gone, as are the Compass and ExtCore components. Existing apps keep running, but
padrino g modelandpadrino g migrationstop working in projects that use them. -smeans--scriptagain.--serverno longer has a short alias: use--server=puma.- Generators exit with status 1 when they fail, instead of 0.
- Reloading outside development (
enable :reloadin staging, for example) needsPadrino::Reloader.enabled = truebeforePadrino.load!. - Admin access control matches string paths as literal prefixes on path boundaries.
allow '/posts'covers/posts,/posts/...and/posts.json, but no longer/posts_admin, and regular-expression syntax inside a string is no longer interpreted. A Regexp, such asallow %r{\A/posts/\d+}, still matches as a pattern. - Links with other schemes.
link_toandform_tagrender#for any scheme other than http, https, mailto, tel and ftp, such assms:or a custom app scheme. - CGI. Padrino no longer loads the whole CGI library. On Ruby before 4.0, add
require 'cgi'if your app usesCGI::Cookie,CGI.parseor similar. - Server auto-detection prefers Falcon over the other servers when neither Thin nor Puma is installed.
Upgrading from 0.16
- In your Gemfile, set
gem 'padrino', '~> 0.17.0'(or the same version for eachpadrino-*gem you list), then runbundle update padrino. - If you reload code outside development, add
Padrino::Reloader.enabled = truebeforePadrino.load!inconfig/boot.rb. - If you use admin access control, check each
allowandprotectpath: list paths such as/posts_adminexplicitly, and turn any string that relies on regular-expression syntax into a Regexp. - Write links with custom URL schemes as plain
<a href="...">tags instead oflink_to. - On Ruby before 4.0, add
require 'cgi'if you use CGI beyond escaping. On Ruby 4.0, addgem 'irb'to your Gemfile to usepadrino console, since irb is no longer a default gem there. - In scripts, use
--server=NAMEinstead of-s NAME, and expect a non-zero exit when a generator fails. - Generated files are yours, so existing projects keep their jQuery 1.x. To update, copy
js/jquery.jsandujs/jquery.jsfrom padrino-static overpublic/javascripts/jquery.jsandpublic/javascripts/jquery-ujs.js, and for the admin, copyjquery-3.7.1.min.jsintopublic/admin/javascriptsand change thejavascript_include_tagline inadmin/views/layouts/applicationandadmin/views/sessions/newto it. Re-runningpadrino g adminalso works, but answernforadmin/app.rband any file you changed: it overwrites them. On custom admin pages, give Bootstrap 3.1's collapse, tab, modal and alert data attributes adata-targetinstead of a barehref="#". - Run your test suite and boot the app.
Ruby 2.7.8 or later, Sinatra 4 and Rack 3 are still required, as in 0.16.