Sha256: 4382c6c0df993192006b48c81b8596dfa569e60bc3789ebf8bb75fdd19dd6be6

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

require "open3"
require "shellwords"

module SauceTunnel
  class Error < StandardError; end
  class ConnectionError < Error; end

  @config = {}
  @mutex = Mutex.new
  @tunnel = nil

  class << self
    def config(**config)
      @config = config;
    end

    def start
      # Wrap establishing Tunnel in Mutex since the Tunnel class is not thread safe.
      @mutex.synchronize do
        @tunnel ||= begin
          Tunnel.new(**@config).tap do |tunnel|
            at_exit do
              tunnel.terminate
            end
            tunnel.connect
            tunnel.await
          end
        end
      end
    end
  end
end

require "sauce_tunnel/simple_queue"
require "sauce_tunnel/tunnel"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sauce_tunnel-0.1.0 lib/sauce_tunnel.rb