Module: ProxyTester

Defined in:
lib/proxy_tester/version.rb,
lib/proxy_tester/data.rb,
lib/proxy_tester/main.rb,
lib/proxy_tester/config.rb,
lib/proxy_tester/cli/main.rb,
lib/proxy_tester/cli/test.rb,
lib/proxy_tester/git_file.rb,
lib/proxy_tester/ui_logger.rb,
lib/proxy_tester/exceptions.rb,
lib/proxy_tester/http_proxy.rb,
lib/proxy_tester/pac_result.rb,
lib/proxy_tester/environment.rb,
lib/proxy_tester/models/user.rb,
lib/proxy_tester/handle_error.rb,
lib/proxy_tester/rspec/helper.rb,
lib/proxy_tester/rspec_runner.rb,
lib/proxy_tester/erb_generator.rb,
lib/proxy_tester/error_handler.rb,
lib/proxy_tester/git_null_file.rb,
lib/proxy_tester/template_file.rb,
lib/proxy_tester/user_database.rb,
lib/proxy_tester/capybara_proxy.rb,
lib/proxy_tester/error_messages.rb,
lib/proxy_tester/git_repository.rb,
lib/proxy_tester/database_session.rb,
lib/proxy_tester/remote_repository.rb,
lib/proxy_tester/actions/fetch_urls.rb,
lib/proxy_tester/capybara_proxy_pac.rb,
lib/proxy_tester/actions/create_file.rb,
lib/proxy_tester/actions/show_config.rb,
lib/proxy_tester/template_repository.rb,
lib/proxy_tester/actions/handle_error.rb,
lib/proxy_tester/reporters/fetch_urls.rb,
lib/proxy_tester/actions/add_test_case.rb,
lib/proxy_tester/actions/create_output.rb,
lib/proxy_tester/actions/create_directory.rb,
lib/proxy_tester/actions/clear_environment.rb,
lib/proxy_tester/actions/initialize_application.rb,
lib/proxy_tester/actions/add_examples_to_test_cases_directory.rb

Overview

encoding

Defined Under Namespace

Modules: Actions, Cli, ErrorMessages, Exceptions, Reporters, SpecHelper Classes: CapybaraProxy, CapybaraProxyPac, Config, Data, DatabaseSession, Environment, ErbGenerator, ErrorHandler, GitFile, GitNullFile, GitRepository, HttpProxy, PacResult, RemoteRepository, RspecRunner, TemplateFile, TemplateRepository, UiLogger, User, UserDatabase

Constant Summary collapse

VERSION =
'0.1.6'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



9
10
11
# File 'lib/proxy_tester/main.rb', line 9

def config
  @config
end

.environmentObject

Returns the value of attribute environment.



9
10
11
# File 'lib/proxy_tester/main.rb', line 9

def environment
  @environment
end

.sessionObject

Returns the value of attribute session.



9
10
11
# File 'lib/proxy_tester/main.rb', line 9

def session
  @session
end

.ui_loggerObject

Returns the value of attribute ui_logger.



9
10
11
# File 'lib/proxy_tester/main.rb', line 9

def ui_logger
  @ui_logger
end

Class Method Details

.clear_environmentObject



35
36
37
38
39
40
41
42
# File 'lib/proxy_tester/main.rb', line 35

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

.configure_i18nObject



24
25
26
27
28
29
# File 'lib/proxy_tester/main.rb', line 24

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

.enable_debug_modeObject



15
16
17
18
19
20
21
22
# File 'lib/proxy_tester/main.rb', line 15

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

  require 'pry'
  require 'byebug'
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

.load_user_databaseObject



31
32
33
# File 'lib/proxy_tester/main.rb', line 31

def load_user_database
  User.load_from(UserDatabase.new)
end

.root_pathObject



11
12
13
# File 'lib/proxy_tester/main.rb', line 11

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