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 …
Category: Articles
Rails Plugin Reloading with Passenger
I use passenger in development now. Having all of my applications ready to launch at any time makes it easier to test cross application integrations. One problem with passenger is that even in development mode, Rails plugins are cached from request to request. This means if you edit a plugin, you won’t see the changes …
Daily Code Reading #16 – Flay#analyze
The third step in flay’s process is to run the s-expressions through the #analyze method. The Code 1 2 3 4 5 6 7 8 9 10 def analyze self.prune self.hashes.each do |hash,nodes| identical[hash] = nodes[1..-1].all? { |n| n == nodes.first } masses[hash] = nodes.first.mass * nodes.size masses[hash] *= (nodes.size) if identical[hash] self.total += …
Daily Code Reading #15 – Flay#process_sexp
Now I’m starting to get into the deep dark corners of flay. The #process_sexp method is the next step in the process. The Code 1 2 3 4 5 6 7 8 def process_sexp pt pt.deep_each do |node| next unless node.any? { |sub| Sexp === sub } next if node.mass < self.mass_threshold self.hashes[node.structural_hash] << …
Daily Code Reading #14 – Flay#process
Today I’m reading through flay’s #process method. This is one of the core methods that performs the analysis. The Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 …