Module: Marathon
- Defined in:
- lib/marathon.rb,
lib/marathon/version.rb
Overview
The top-level module for this gem. It’s purpose is to hold global configuration variables that are used as defaults in other classes.
Defined Under Namespace
Modules: Error Classes: App, Base, Connection, Constraint, Container, ContainerDocker, ContainerDockerPortMapping, ContainerVolume, Deployment, DeploymentAction, DeploymentInfo, DeploymentStep, EventSubscriptions, Group, HealthCheck, Leader, Queue, Task, Util
Constant Summary collapse
- DEFAULT_URL =
'http://localhost:8080'
- VERSION =
'1.2.0'
Class Method Summary collapse
-
.connection ⇒ Object
Set a new connection.
-
.env_options ⇒ Object
Get marathon options from environment.
-
.env_url ⇒ Object
Get the marathon url from environment.
-
.info ⇒ Object
Get information about the marathon server.
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.logger=(value) ⇒ Object
Sets the attribute logger.
-
.options ⇒ Object
Get options for connecting to marathon API.
-
.options=(new_options) ⇒ Object
Set new options.
-
.ping ⇒ Object
Ping marathon.
-
.reset_connection! ⇒ Object
Reset the connection.
-
.url ⇒ Object
Get the marathon API URL.
-
.url=(new_url) ⇒ Object
Set a new url.
Class Method Details
.connection ⇒ Object
Set a new connection
73 74 75 |
# File 'lib/marathon.rb', line 73 def connection @connection ||= Connection.new(url, ) end |
.env_options ⇒ Object
Get marathon options from environment
42 43 44 45 46 47 |
# File 'lib/marathon.rb', line 42 def opts = {} opts[:username] = ENV['MARATHON_USER'] if ENV['MARATHON_USER'] opts[:password] = ENV['MARATHON_PASSWORD'] if ENV['MARATHON_PASSWORD'] opts end |
.env_url ⇒ Object
Get the marathon url from environment
37 38 39 |
# File 'lib/marathon.rb', line 37 def env_url ENV['MARATHON_URL'] end |
.info ⇒ Object
Get information about the marathon server
83 84 85 |
# File 'lib/marathon.rb', line 83 def info connection.get('/v2/info') end |
.logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/marathon.rb', line 10 def logger @logger end |
.logger=(value) ⇒ Object
Sets the attribute logger
10 11 12 |
# File 'lib/marathon.rb', line 10 def logger=(value) @logger = value end |
.options ⇒ Object
Get options for connecting to marathon API
56 57 58 |
# File 'lib/marathon.rb', line 56 def @options ||= end |
.options=(new_options) ⇒ Object
Set new options
67 68 69 70 |
# File 'lib/marathon.rb', line 67 def () @options = .merge( || {}) reset_connection! end |
.ping ⇒ Object
Ping marathon
88 89 90 |
# File 'lib/marathon.rb', line 88 def ping connection.get('/ping') end |
.reset_connection! ⇒ Object
Reset the connection
78 79 80 |
# File 'lib/marathon.rb', line 78 def reset_connection! @connection = nil end |
.url ⇒ Object
Get the marathon API URL
50 51 52 53 |
# File 'lib/marathon.rb', line 50 def url @url ||= env_url || DEFAULT_URL @url end |
.url=(new_url) ⇒ Object
Set a new url
61 62 63 64 |
# File 'lib/marathon.rb', line 61 def url=(new_url) @url = new_url reset_connection! end |