def load_options_from_heroku
      @@heroku_environment ||= begin
        if File.exists?(File.expand_path('~/.heroku'))
          Sauce.logger.debug "Heroku config found."
          heroku_app = ENV['SAUCE_HEROKU_APP']
          cmd = "heroku config #{heroku_app ? "--app #{heroku_app}": ''}"
          cmd += "--shell 2>/dev/null"
          buffer = IO.popen(cmd) { |out| out.read }
          if $?.exitstatus == 0
            env = {}
            buffer.split("\n").each do |line|
              key, value = line.split("=")
              env[key] = value
            end
            extract_options_from_hash(env)
          else
            {}
          end
        else
          {}
        end
      rescue Errno::ENOENT
        {} # not a Heroku environment
      end
      return @@heroku_environment
    end
def load_options_from_heroku
      @@heroku_environment ||= begin
        if File.exists?(File.expand_path('~/.heroku'))
          Sauce.logger.debug "Heroku config found."
          heroku_app = ENV['SAUCE_HEROKU_APP']
          cmd = "heroku config #{heroku_app ? "--app #{heroku_app}": ''}"
          cmd += "--shell 2>/dev/null"
          buffer = IO.popen(cmd) { |out| out.read }
          if $?.exitstatus == 0
            env = {}
            buffer.split("\n").each do |line|
              key, value = line.split("=")
              env[key] = value
            end
            extract_options_from_hash(env)
          else
            {}
          end
        else
          {}
        end
      rescue Errno::ENOENT
        {} # not a Heroku environment
      end
      return @@heroku_environment
    end
Heroku supports multiple apps per $PWD.  Specify $SAUCE_HEROKU_APP if
 needed otherwise this can still time out.