This week I’m going to read through the code for RestClient. RestClient is a simple HTTP and REST client for Ruby that can be used to consume RESTful resources. I’ve used it in a Single Sign On system I built for Redmine, redmine_sso_client and redmine_sso_server. Today I started with the command line binary for RestClient. …
Tag: code-reading
Daily Code Reading #20 – Capistrano recipes – deploy
I’m finishing up my code reading of Capistrano‘s recipes with the recipe that is run most often, deploy. The Code and Review deploy 1 2 3 4 5 6 namespace :deploy do task :default do update restart end endnamespace :deploy do task :default do update restart end end The deploy recipe itself is simple and …
Daily Code Reading #19 – Capistrano recipes – deploy setup
Today I’m reading through Capistrano‘s deploy:setup recipe. This recipe is used to setup a new server for deployment by creating the directories Capistrano uses and checking permissions. The Code 1 2 3 4 5 6 7 namespace :deploy do desc < { :no_release => true } do dirs = [deploy_to, releases_path, shared_path] dirs += …
Daily Code Reading #18 – Capistrano recipes – invoke
Continuing from my tour of Capistrano‘s internals, I’m going to start looking through Capistrano‘s recipes now. A recipe for Capistrano is a unit of work, similar to how Rake uses tasks. I’m going to start with the basic invoke recipe today. The Code 1 2 desc < method) enddesc < method) end Review invoke is …
Daily Code Reading #17 – Capistrano control flow
I’m reading through Capistrano‘s code this week and decided to start with something different. Instead of jumping right into different methods, I’m going to review the overall flow to get an understanding of how one part works. For Capistrano, I’m going to figure out how cap deploy works. 1 2 3 4 #!/usr/bin/env ruby …