Bundler version 1.0.0.rc.5 Full Service Capistrano Task

I've recently been working on updating a set of Ruby applications and converting all of the gem dependencies to use Bundler (gembundler.com)

I've added to my optimized Capistrano Bundler tasks to include handling the prequisite rubygems version and providing a number of customization parameters.

Bundler 1.0 now includes a basic "bundle:install" Capistrano script http://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb, but since mine covers a bit more ground than the default one I'm continuing to build my scripts around the following Bundler tasks.

Capistrano::Configuration.instance(:must_exist).load do

  desc "Add deploy hooks to invoke bundler:install"
  task :acts_as_bundled do
    after "deploy:rollback:revision", "bundler:install"
    after "deploy:update_code", "bundler:install"
    after "deploy:setup", "bundler:setup"
  namespace :bundler do
    set :bundler_ver, '1.0.0.rc.5'
    set :bundler_opts, %w(--deployment --no-color --quiet)
    set(:bundler_exec) { ruby_enterprise_path + "/bin/bundle" }
    set(:bundler_dir) { "#{shared_path}/bundle" }
    set :bundler_rubygems_ver, '1.3.7'
    set(:bundler_user) { apache_run_user }
    set :bundler_file, "Gemfile"
    desc "Update Rubygems to be compatible with bundler"
    task :update_rubygems, :except => { :no_release => true } do
      gem_ver = capture("gem --version").chomp
      if gem_ver < bundler_rubygems_ver
        logger.important "RubyGems needs to be udpated, has gem --version #{gem_ver}"
    desc "Setup system to use bundler"
    task :setup, :except => { :no_release => true } do
      gem2.install_only "bundler", bundler_ver
    desc "bundle the release"
    task :install, :except => { :no_release => true } do
      #Don't bother if there's no gemfile.
      #optionally do it as a specific user to avoid permissions problems
      #do as much as possible in a single 'run' for speed.
      args = bundler_opts
      args << "--path #{bundler_dir}" unless bundler_dir.to_s.empty? || bundler_opts.include?("--system")
      args << "--gemfile=#{bundler_file}" unless bundler_file == "Gemfile"
      cmd = "cd #{latest_release}; if [ -f #{bundler_file} ]; then #{bundler_exec} install #{args.join(' ')}; fi"
      cmd = "sudo -u #{bundler_user} sh -c '#{cmd}'" if bundler_user and not bundler_user.empty?
      run cmd

      on_rollback do
        if previous_release
          cmd = "cd #{previous_release}; if [ -f #{bundler_file} ]; then #{bundler_exec} install #{args.join(' ')}; fi"
          cmd = "sudo -u #{bundler_user} sh -c '#{cmd}'" if bundler_user and not bundler_user.empty?
          run cmd
          logger.important "no previous release to rollback to, rollback of bundler:install skipped"


This code uses some other dependencies that I use throughout my Capistrano scripts, namely the customized Gem2 plugin from vmbuilder_plugins. This following code necessary to monkey-patch the Gem2 plugin, which is bundled with Mike Bailey's deprec project http://github.com/mbailey/deprec/blob/master/lib/vmbuilder_plugins/gem.rb

module Gem

  GEM_UNINSTALL= "gem uninstall --ignore-dependencies --executables"

  def install_only(package, version=nil)
    tries = 3
      cmd = "if ! gem list | grep --silent -e '#{package}.*#{version}'; then gem uninstall --ignore-dependencies --executables --all #{package}; #{GEM_INSTALL} #{if version then '-v '+version.to_s end} #{package}; fi"
    rescue Capistrano::Error
      tries -= 1
      retry if tries > 0

  # uninstalls the gems detailed in +package+, selecting version +version+ if
  # specified, otherwise all.
  def uninstall(package, version=nil)
    cmd = "#{GEM_UNINSTALL} #{if version then '-v '+version.to_s  else '--all' end} #{package}"
    wrapped_cmd = "if gem list | grep --silent -e '#{package}.*#{version}'; then #{cmd}; fi"


Unlike many examples of Capistrano deploy scripts which are kept inside the app root of the application they deploy, my deploy scripts are kept in their own repository, and they were built to contain all of the "institutional knowledge" of how to interact with all of our server farms and applications.  There is a lot of shared code that would have to be duplicated if I were to try to break the deploy scripts apart, and store them with each application.  There would also be a lot of tasks that don't make sense to live in only one application, some wouldn't have a home in any application.  I've found a couple of patterns that make it easier to hook and unhook code into the main deploy processes, which I may touch on in other posts. 

One of the techniques which is used in the bundler tasks is to separate out the callback hooks into their own top level task.  This allows me to not have to remember all of bundlers individual hooks, I can easily add them to any application that needs them, and omit them from applications that don't.  A second technique that I use is to control the task chains.  I learned early on that you want to be able to call individual tasks for maintenance and not inadvertently trigger a long series of chained tasks.

This is an example of what you might see in one of my application deploy scripts:

  on :start, :only => ["deploy","deploy:setup","deploy:migrations","deploy:cold"] do
    before "deploy:update_code", "deploy:clear_release_path","deploy:setup_dirs"
    after "deploy:update_code", "deploy:authentication", "git:track", "scalr:on_boot_finish", "git:config", "scalr:on_hostup"
    after "deploy:symlink", "deploy:cleanup"

Notice the acts_as_bundled acts as a nice declarative way to invoke bundlers callback assignments, and that they are only invoked if one of the top level tasks matches the :only clause.

So for example I can do a command like

cap deploy:symlink

Without causing "deploy:cleanup" to be executed.  But when I do:

cap deploy

It will.

Good-Guys 17th Summer Get-Together

My 73 Firebird in the parking lot


I parked just a few down from this car, it should have been in the show.

This time I went primarily to scope out the swap meet, but wasn't impressed, so I wandered back in to take a look at some of the cars.

I was on the lookout for Firebirds, but I was also on the lookout for some different Mustangs for my nephew to perhaps give him some ideas to figure out what models and years he likes best.

I scoped out a couple potential project cars at the swap meet, but I have a feeling this wouldn't be an ideal way to buy your first project car.

I got a chance to see the auto-cross which looked like a ton of fun.

May 30 2010 Bracket Drags at Infineon

Awesome run even though he powered down before finishing.  

  The raceway and Wednesday Night Drags crew would also like to remember long-time racer and friend, "Mr. Pontiac" Pete Aljian.  Pete passed away on May 22, following complications after a stroke.  He was 71.  

  We’ll all remember the great pride Pete took in his all-steel, mid-nine-second, blue 1955 Pontiac, which  he built and drove, and was later driven by Bob Van Poppering and John Tobias.  As a tribute to Pete, his fellow ICRA (Island Cities Racing Assoc.) club members will be racing this weekend in his honor. Please keep Pete and his family and friends in your thoughts and prayers.

Repair the paint job on the suburban after it came out of the wash.

A couple weeks ago I took the suburban to get it washed, and a little spot of paint that had chipped off, turned into a big chunk of paint that went MIA.


This time I saw that the chips went all the way down to metal. (Top right grey color)

I had a couple of choices, ignore it some more, repaint the whole truck, or try to fix it myself.

Ignore it certainly hadn't helped up to this point, and I knew I had some white paint leftover from my repair of under the battery compartment of the Jeep.  I thought it would be a pretty good match. 

It's funny, I'm not a fan of white vehicles, and yet I have two trucks painted the whitest white you can imagine. It certainly wasn't intentional thats just the color they came with, and I'm very much a function over form kinda guy.  I wouldn't turn down a good truck just because it was white.

Materials: my auto masking tape, sanding pad, 1000 grit wet sand paper, old newspapers, old t-shirts, and paint prep cleaner (all left over from my wheel resto project). I  used the low grit sand pad to knock off any weak chips and to round off the edges of the remaining paint. I gave the windshield a slight dusting overspray after the first pass, so after this photo I cleaned it off and put more newspaper up to keep that from happening again. You need more newspaper than you think.

I used the 1000grit to knock the edge off the new paint where it abutted the masking tape.  It's a Good From Far, but Far From Good job.  There is a slight hue difference between the white paints, and theres a difference in the surface texture, but I made the ridge to be in the middle of the curve so it's very difficult to see it if your more than 10' away.  I should have practiced with some body filler and additional sanding, but I'll do that next time.  It does the job for now.

So heres the true out of pocket repair cost: $0; I already had everything from other projects, and still plenty of paint in the rattle can for a few more projects. 

The Paddock GTO/G8 Show'n'Shine at the Livery, Danville CA, May 23rd. 2010

The show was put on by Norcal Goats and the Golden Gate Goats

I didn't expect to see any Firebirds, but I was in luck.

I'm pretty sure the the white Firebird is the same one that I previously photographed at the GoodGuy's show.  It's a shame he hasn't repainted it yet, but from what I understand is it's for sale, so perhaps he just doesn't want to invest any more money in it.

The blue car was absolutely incredible, It's almost exactly what I'd like to do with my Firebird, but I'm more partial to the Formula dual snorkels rather than the shaker hood.  I love the paint scheme though.  I like the use of the black border, I'm thinking now thats what I may do, and keep my white vinyl top.

Other images from the same event:

Instrument Panel Overhaul

Last weekends project was re-opening the dash to fix all of the instrument panel lights, and figure out why the fuel gauge was stuck.

Using the service manuals I was able to verify the resistance at the tank, and was able to test it at the wiring harness. So the problem seemed to be the gauge itself.

I rigged up some leads to a 12v DC power supply and tested running a current through the gauge, I managed to make it move, so I figured I'd try putting everything back together and see if it works.


I replaced all thirteen lamps in the instrument panel, and discovered one defective socket.  Luckily my parts store had one of the sockets in stock.

I re-assembled everything, and then took a victory ride, with some pictures along the way at my favorite spot to show off the updated rims and tires.

So far so good with the fuel gauge.

Repainting my Rally II's. -- Done.

This is how they ended up. Mounted and wrapped with 225/60R14 BFG Radial T/A's:


This is what I started with:


Back from the sandblaster ($15/wheel)


After 3 coats of Duplicolor Self Etching Primer (DAP 1690), and 2 light coats and a med coat of Duplicolor High Performance Silver Wheel Coating (WP 101).  * see notes about colors later.
This is also where things start going awry.  I had purchased the 14" Rally II Mask Kit from Ames, which turned out to be a waste in effort and quality.  They are essentially a material that's consistent with shipping labels, they came on a sheet as peel and sticks.  The mask makes no provisions for masking the small 1/4" ring that surrounds the parts that will be charcoal on the face of the rim.  I had "Assumed" the mask kit, was a complete mask. Not so.  The "stick" part of the mask was also a lie.  It didn't stick well, as you can see in this photo. It will come into play later.  I went out looking for some 3m pinstriping tape to try to mask off the areas that the Ames mask didn't cover; couldn't find any with my local loop of Monument Auto Parts, Autozone, OSH, Lowes... I settled on the Automotive masking tape you see in the photo below.  The auto masking tape $4.99 worked better than the mask kit. I could put it down, there is a small ridge between in what would be the charcoal sections, pressing my thumbnail into the depression made a crisp crease, that I could then use as a guide with my pocket knife to cut away the masking tape leaving a nice edge as the mask.  I knew at this point I should rip off the stupid mask kit and just use the masking tape for the spokes. But I ignored my common sense and stubbornly moved forward.  Damnit I paid for them I'm going to use them.


Not shown but there's also the problem of masking the wheel sides, after failed attempts to use a larger 3m masking tape, it just did not want to flex in a circle without coming off the wheel, I crafted a piece of corrugated cardboard into a cylinder that fit over the masking tape in the groove between the wheel face and wheel rim. The only downside to this, was the corrugated cardboard with an uneven cut left room for a little bit of the charcoal to over-spray into the void which I later had to touch up with the silver paint. The darker color is Duplicolor WP102 Graphite.


While painting the graphite color, just as I made a the final pass, one of the stupid mask labels popped up, and I covered the tip of one of the spokes in graphite.  After some expletives, I decided the wheels had enough coats of the graphite color and called it quits.  Once the wheels were dry, I sprayed some of the silver onto a piece of cardboard until it pooled, and I used a craft paintbrush to cover up the graphite over-spray on the spoke that had popped up.

When I had ordered the mask kit from Ames I also asked about the red Pontiac insert in the center wheel caps.  They didn't have a record of a part number for it. I asked about the entire center cap, and apparently its been discontinued.  To make mine red again I used a red sharpie ($0.95), that I spotted as I was checking out after buying some tools at OSH.


Now, about the colors. Despite being armed with known good Duplicolor Paint Numbers that would match the original OEM paints, Nobody locally had them in stock. To order them online would have meant waiting at least five to seven days for them to come via ground.  I settled on the Duplicolor paints above because they were, in stock, close enough to the hues I was after, and I was willing to sacrifice correctness for getting the wheels painted and having the car off the jack stands by the following weekend when my dad comes to visit.  A rolling running car is a lot more interesting than one on Jackstands.  And ultimately my plan is to replace the wheels anyway with some 18x8".  So they just needed to look decent, I didn't need correct. A Pontiac enthusiast will immediately be able to detect that these paints are highly metallic and the graphite is not a dark charcoal, and they are most certainly not correct.  But they do look good.

I am not an expert, and certainly won't be winning any concourse awards for my handiwork, but I'll give you the benefit of my limited wheel painting experience.

If I were to do this again, I would definitely have them sandblasted, I tried cleaning them with a 2000 psi power-washer, which was a waste of time, have them blasted.  I used Maas Bros Powder Coating, and I found that if I had allotted enough time for them to do it, they could have powder coated the wheels in the correct Silver/Argent for $50/wheel.  I thought that was expensive at the time, but considering it took me from 6am to 9pm, and a couple hours the next day to prep, prime, and paint these wheels it now seems like a bargain.

Have a work area in mind first.  Working on the wheels is a lot easier if you can do them all in the same stages.  My workbench couldn't hold more than three wheels at a time, so I had to do them in shifts.  I would make sure I had enough room to do all five wheels on a bench with at least a wheels space between any of the wheels. (All I needed to do was throw a longer 3/4 or 1" plywood board over my sawhorses, if I had thought about it ahead of time)

Do it indoors if you can, I did mine outdoors, and I had to pick out debris that was blown in from the trees. (It's also easier to paint by light if you are indoors) I on the other hand was outside at 9pm when it was pitch dark with my LED headlamp and work-light painting a dark graphite color.

Just mask them yourselves, and don't use the stupid tape with plastic dropcloth that you can buy at OSH it will not stick, or it'll stick to itself, trust me, just throw it away it'll cause you less frustration there. Mask it with auto-masking tape and newspaper and keep your sanity, don't bother with the silly mailing label masks.

If I were to do my cylinder column again, I would use a posterboard, and cut it very accurately. I'd also cut one for each wheel, because using only one form for all wheels it began accumulating paint on the form, and was about to start to run paint down into the work area.  You only need a cylinder about 5" tall, any taller then it starts making the only angle you can spray the paint, almost straight down.

Oh which brings me to my last annoyance.


When I remounted my wheels and was going on my first test drive, something was rubbing, majorly. It turns out that the new way to balance a tire is to install these flat lead weights that are mounted on double sticky tape on the inside of the wheel. WTF?!  And they were hitting my brake calipers on the front. I dismounted the wheels and had to cut them out. I've got to drive it to the shop that did the balancing and make them do it again on all wheels to make sure I can rotate the tires.

My last lesson learned so far: The valve stems are too short once the chrome covers go on, I guess I should have known this and made sure the shop put on longer ones.  Shouldn't the shop have known this?  They are common wheels, they knew exactly what kind of car I had even if they couldn't see it.

But the wheels and that BFG rubber, look good; so in the end, it'll have been worth it.

The Blubird is now on blocks.

Well jackstands actually.

It's time to restore the wheels and wrap them is some proper rubber. While I've got it up on the stands I'll be replacing the shocks, all of the fan belts, oil pan gasket, and I'm going to attempt to replace the main rear seal.

Quick note on the placement of the jack, even though its on jackstands, a number of people suggested leaving the jack in place in case of a stand failure, at least you would have some secondary protection.  So I've got the cars jack at the front and the floor jack under the rear, just touching not actually lifting.  It's quite stable on the jacks by themselves.  Another suggestion that I used was to give the car a decent test in all directions, give it a good shove. If it's going to fall down, you'd rather have it happen on your terms than when your under it.  It's not a time to be gentle, you want to be confident the car isn't going to shift, or that your jacks or stands are only barely keeping it up.

I managed to get two lugnuts off by using the t-bar, but got stymied by the rest of them.  I decided it was time to spend some money instead of wasting the braun.

I briefly considered that it might be time for an air compressor setup, as I tallied up how much it was going to cost to get a unit that would actually do everything I wanted I decided it wasn't yet time to splurge.

So off on my circuit to find an electric Impact wrench.  Lowes, Monument Auto Parts, Autozone, Orchard Supply Hardware then Home Depot. Lowes had a DeWalt, Monument nothing, Autozone Nothing, Osh had a crappy looking green Hitachi, that was $69 bucks, Home Depot had the same DeWalt as Lowes and at the same price.  I paid $179. I know it was a lot more than the Hitachi, but I just don't know the quality of the Hitachi, the ultra green didn't do it any favors. DeWalt is at least a name I trust, though I would have preferred a Millwaukee, but nobody had one.

In any case the DeWalt whipped those lug-nuts right off, This is a tool that I think I'm going to get a LOT of use out of.  I need to mail order some impact extensions, I could only find two sets of impact sockets at Lowes, I bought the SAE, I'll buy the metric if I ever have occasion to need it.  Lowes didn't carry any of the extensions or any other accessories for Impact wrenches except in a kit, that included an air impact gun.  I had to jerry rig the gun to accept one of my socket 1/2" extensions.  Probably not wise but it got the job done.

I'm getting frustrated by having to do the circuit each time I need something and having to settle for whats in stock.  I'm going to start trying to buy more online so I can get exactly what I want and don't have to settle for just whats in stock locally.

I bought a pressure washer this weekend to help clean up the wheels, but I'm still pretty certain I'll have to have them blasted. I'm just hoping that if I clean them up well with the pressure washer, then they will need to spend less time blasting them.  I'm hoping the pressure washer will help out with a number of car cleanup projects as well as around the outside of the house chores.  I didn't get a chance to play with the pressure washer this weekend though as I spent Sunday assembling my new Gas Grill... and then it promptly rained so we couldn't use it either.  Hopefully I'll get to play with both next weekend.

Good Guys 28th All American Get-Together in Pleasanton

This weekend I went to the 28th All American Get-Together in Pleasanton.

The event features over 3,000 American powered rods, customs, classics, trucks and late models sprawled throughout the entire acreage of the beautiful fairgrounds. A spectacular indoor show will feature the world’s top custom cars as they compete for the Goodguys West Coast Custom of the Year award. Vendor exhibits, a swap meet & cars for sale corral, arts & crafts, model car show and live entertainment will also be featured throughout the weekend.

I was surprised by three things:

1) The number of blatantly obvious non-show quality cars that littered the fair grounds, incomplete, bumpers hangin' off and rusted out, and I'm not talking about the crap rods. I could have taken my Firebird in it's current state and it would have been better than a few of them.

2) The sheer number of baby-blue with two white stripe, Camaros. I stopped taking pictures of them, they became boring.

3) Granted I don't think I saw every car there, but there were maybe only 4 Firebirds that showed well.

It was a good experience I enjoyed being there early as they were still parking a lot of the rides, and you could hear all kinds of sweet exhaust sounds from street rods to dragsters.  After about 10am everything settled down and you just heard the din of the crowd.