Daniel Farina, a founder of Ubicloud
Acknowledgements Will Leinweber and Craig Kerstiens of {Heroku,Citus,Crunchy} without whom this would have been impossible.
...and to Peter van Hardenberg, who stands at the beginning.
"Routing Tree" Framework
The "tree" takes the form of nested blocks.
Elegant "before" filters
Matchers accept literal values and simple data types.
class App < Roda
route do |r|
# Matches "/items/<whatever>"
r.on "items" do
# Matches /items/[0-9]+$
r.is Integer do |item_id|
@item = Item[item_id]
# e.g. GET /items/123
r.get { "Rendering item: #{@item}" }
# e.g. DELETE /items/123
r.delete { @item.destroy }
end
end
# Matches /foo, /foo/bar, /pear/apple/peach
r.on String do |a_prefix|
r.get { "You asked for #{a_prefix}" }
end
end
end
class CloverWeb < Roda
# [...Lots of plugin setup...]
route do |r|
r.public
r.assets
r.on "webhook" do
r.hash_branches(:webhook_prefix)
end
check_csrf!
@current_user = Account[rodauth.session_value]
r.rodauth
rodauth.load_memory
rodauth.check_active_session
r.root do
r.redirect rodauth.login_route
end
rodauth.require_authentication
r.hash_branches("")
end
endclass CloverWeb
hash_branch("project") do |r|
@serializer = Serializers::Web::Project
r.get true do
@projects = serialize(@current_user.projects.filter(&:visible))
view "project/index"
end
r.post true do
project = @current_user.create_project_with_default_policy(r.params["name"], provider: r.params["provider"])
r.redirect project.path
endCloverWeb" (one class, many files)hash_branch jumps to the matching block./clover_web.rb:class CloverWeb < Roda
./routes/web/project.rb:class CloverWeb
./routes/web/github.rb:class CloverWeb
./routes/web/project/github.rb:class CloverWeb
./routes/web/project/user.rb:class CloverWeb
./routes/web/project/vm.rb:class CloverWeb
./routes/web/project/billing.rb:class CloverWeb
./routes/web/project/policy.rb:class CloverWeb
./routes/web/project/private_subnet.rb:class CloverWeb
./routes/web/project/location/vm.rb:class CloverWeb
./routes/web/project/location/private_subnet.rb:class CloverWeb
./routes/web/project/location/postgres.rb:class CloverWeb
./routes/web/project/postgres.rb:class CloverWeb
./routes/web/project/location.rb:class CloverWeb
./routes/web/account.rb:class CloverWeb
./routes/web/webhook/github.rb:class CloverWeb
Lots is okay
Ruby 🔥
Sequel 💧
Sinatra 💧
Postgres 💧
Ruby 💧
Sequel 💧
Postgres 🔥
Roda ❄️
Rodauth ❄️
Legend: "normalness" in descending order 🔥💧❄️
inspired, artistic, beautiful
"productive"
"developer happiness"
slow
wild or unprincipled
hard to maintain
good for prototyping, but
Stable
Rigorous
Prudent
Restrained
Economical
...slowish
2007: Sequel
2014: Roda
2015: Rodauth
Maintains all of:
Not only an acknowledgement.
The three programs are cohesive.
Roda: request routing
Rodauth: authentication
Sequel: database access
Blink and you'll miss something important in his talks.
...it gives me a sense of accomplishment to be able to fix bugs in Ruby that have been known but unfixed for many years. That's a situation that doesn't happen in my other open source projects.
—From one tiny corner of an interview
Check out
100% branch coverage: totally reasonable
can be done with rspec or minitest.
no...
if you seek the highest standards of a rigorous program
Probably, for cross referencing
VSCode & LSP are prime movers here
Improve economy of elimination of simple defects