Sha256: 20c6a455fc5b825eda2f23e333dcc67f38ee7cab8e5948823f052ac3fd7f45a0

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

require 'browsermob/proxy'

module Infrataster
  module BrowsermobProxy
    class << self
      def server
        @server ||= start_server
      end

      def proxy
        @proxy ||= server.create_proxy
      end

      def bin_path
        @bin_path
      end

      def bin_path=(path)
        @bin_path = path
      end

      private
      def start_server
        BrowserMob::Proxy::Server.new(find_bin, timeout: 60).tap do |server|
          server.start
        end
      end

      def find_bin
        return @bin_path if @bin_path
        `which browsermob-proxy`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infrataster-0.1.7 lib/infrataster/browsermob_proxy.rb
infrataster-0.1.6 lib/infrataster/browsermob_proxy.rb
infrataster-0.1.5 lib/infrataster/browsermob_proxy.rb
infrataster-0.1.4 lib/infrataster/browsermob_proxy.rb