Sha256: 0d9f47e46f9e59aa842d16895f62b390b01cbc9a7e885cd5d46301c26e550ee2

Contents?: true

Size: 1.23 KB

Versions: 13

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
module ProxyTester
  @environment = ProxyTester::Environment.new
  @config      = ProxyTester::Config.new
  @ui_logger   = ProxyTester::UiLogger.new
  @session     = ProxyTester::DatabaseSession.new

  class << self
    attr_accessor :session, :environment, :config, :ui_logger

    def root_path
      ::File.expand_path('../../..', __FILE__)
    end

    def enable_debug_mode
      ProxyTester.ui_logger.info "Activating debug mode."

      require 'pry'
      require 'debugger'
    rescue LoadError
      ProxyTester.ui_logger.error "You tried to enable debug-mode, but either 'pry'- or 'debugger'-gem are not installed. Please fix that before using the debug-switch again."
    end

    def configure_i18n
      I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
      I18n.load_path = Dir[::File.join(ProxyTester.root_path, 'lib', 'proxy_tester', 'locales', '*.yml')]
      I18n.backend.load_translations
      I18n.enforce_available_locales = true
    end

    def load_user_database
      User.load_from(UserDatabase.new)
    end

    def clear_environment
      %w{
      http_proxy
      https_proxy
      HTTP_PROXY
      HTTPS_PROXY
      }.each { |var| ENV.delete(var) }
    end
  end
end

ProxyTester.configure_i18n

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
proxy_tester-0.1.4 lib/proxy_tester/main.rb
proxy_tester-0.1.3 lib/proxy_tester/main.rb
proxy_tester-0.1.2 lib/proxy_tester/main.rb
proxy_tester-0.1.1 lib/proxy_tester/main.rb
proxy_tester-0.1.0 lib/proxy_tester/main.rb
proxy_tester-0.0.9 lib/proxy_tester/main.rb
proxy_tester-0.0.8 lib/proxy_tester/main.rb
proxy_tester-0.0.7 lib/proxy_tester/main.rb
proxy_tester-0.0.6 lib/proxy_tester/main.rb
proxy_tester-0.0.5 lib/proxy_tester/main.rb
proxy_tester-0.0.4 lib/proxy_tester/main.rb
proxy_tester-0.0.3 lib/proxy_tester/main.rb
proxy_tester-0.0.2 lib/proxy_tester/main.rb