def add_versions
      new_gemfile = Tempfile.new("Gemfile.versioned")
      begin
        gemfile_content.each do |gem_line|
          if is_gem_line?(gem_line)
            new_gemfile.puts(build_gem_line(gem_line))
          else
            new_gemfile.puts(gem_line)
          end
        end
        File.truncate(gemfile_path, 0)
        new_gemfile.rewind
        File.open(gemfile_path, "w") {|f| f.write(new_gemfile.read)}
      rescue Exception => e
        puts "ERROR: #{e}"
        puts "Restoring Gemfile at #{gemfile_path}"
        File.open(gemfile_path, "w") {|f| f.write(@orig_gemfile)}
      ensure
        new_gemfile.close
        new_gemfile.unlink
      end
    end
def add_versions
      new_gemfile = Tempfile.new("Gemfile.versioned")
      begin
        gemfile_content.each do |gem_line|
          if is_gem_line?(gem_line)
            new_gemfile.puts(build_gem_line(gem_line))
          else
            new_gemfile.puts(gem_line)
          end
        end
        File.truncate(gemfile_path, 0)
        new_gemfile.rewind
        File.open(gemfile_path, "w") {|f| f.write(new_gemfile.read)}
      rescue Exception => e
        puts "ERROR: #{e}"
        puts "Restoring Gemfile at #{gemfile_path}"
        File.open(gemfile_path, "w") {|f| f.write(@orig_gemfile)}
      ensure
        new_gemfile.close
        new_gemfile.unlink
      end
    end
TODO: Clean this up!