Module: SettingsHelper
- Defined in:
- lib/opsmgr/ui_helpers/config_helper.rb
Instance Method Summary collapse
- #configure_capybara(ops_manager_url) ⇒ Object
- #delete_timeout ⇒ Object
- #environment_name ⇒ Object
- #errand_names ⇒ Object
- #export_destination_path ⇒ Object
- #fetch_environment_settings ⇒ Object
- #import_file_path ⇒ Object
- #install_timeout ⇒ Object
- #om_version ⇒ Object
- #ops_manager_api_driver ⇒ Object
- #ops_manager_driver ⇒ Object
- #product_name ⇒ Object
- #product_path ⇒ Object
- #stemcell_file_path ⇒ Object
Instance Method Details
#configure_capybara(ops_manager_url) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 104 def (ops_manager_url) Capybara.configure do |c| c.default_driver = :webkit end begin Capybara::Webkit.configure do |c| c.allow_url(ops_manager_url) c.ignore_ssl_errors end rescue # Capybara says, "All configuration must take place before the driver starts" end page.current_window.resize_to(1024, 1600) # avoid overlapping footer spec failures end |
#delete_timeout ⇒ Object
40 41 42 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 40 def delete_timeout Integer(ENV.fetch('DELETE_TIMEOUT')) end |
#environment_name ⇒ Object
96 97 98 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 96 def environment_name ENV.fetch('ENVIRONMENT_NAME') end |
#errand_names ⇒ Object
44 45 46 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 44 def errand_names JSON.parse(ENV.fetch('ERRAND_NAMES')) end |
#export_destination_path ⇒ Object
20 21 22 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 20 def export_destination_path ENV.fetch('EXPORT_DESTINATION') end |
#fetch_environment_settings ⇒ Object
100 101 102 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 100 def fetch_environment_settings Opsmgr::Environments.for(environment_name).settings end |
#import_file_path ⇒ Object
24 25 26 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 24 def import_file_path ENV.fetch('IMPORT_FILE') end |
#install_timeout ⇒ Object
36 37 38 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 36 def install_timeout ENV.fetch('INSTALL_TIMEOUT').to_i end |
#om_version ⇒ Object
32 33 34 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 32 def om_version ENV.fetch('OM_VERSION') end |
#ops_manager_api_driver ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 64 def ops_manager_api_driver env_settings = fetch_environment_settings case om_version when '1.4' api_1_4( host: env_settings.ops_manager.url, username: env_settings.ops_manager.username, password: env_settings.ops_manager.password, ) when '1.5' api_1_5( host: env_settings.ops_manager.url, username: env_settings.ops_manager.username, password: env_settings.ops_manager.password, ) when '1.6' api_1_6( host: env_settings.ops_manager.url, username: env_settings.ops_manager.username, password: env_settings.ops_manager.password, ) when '1.7' api_1_7( host: env_settings.ops_manager.url, username: env_settings.ops_manager.username, password: env_settings.ops_manager.password, ) else fail "Unsupported Ops Manager Version #{om_version.inspect}" end end |
#ops_manager_driver ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 48 def ops_manager_driver (fetch_environment_settings.ops_manager.url) case om_version when '1.4' om_1_4(fetch_environment_settings.ops_manager.url) when '1.5' om_1_5(fetch_environment_settings.ops_manager.url) when '1.6' om_1_6(fetch_environment_settings.ops_manager.url) when '1.7' om_1_7(fetch_environment_settings.ops_manager.url) else fail "Unsupported Ops Manager Version #{om_version.inspect}" end end |
#product_name ⇒ Object
16 17 18 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 16 def product_name ENV.fetch('PRODUCT_NAME') end |
#product_path ⇒ Object
12 13 14 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 12 def product_path ENV.fetch('PRODUCT_PATH') end |
#stemcell_file_path ⇒ Object
28 29 30 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 28 def stemcell_file_path ENV.fetch('STEMCELL_FILE') end |