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, Apps, Base, Connection, Constraint, Container, ContainerDocker, ContainerDockerPortMapping, ContainerVolume, Deployment, DeploymentAction, DeploymentInfo, DeploymentStep, Deployments, EventSubscriptions, Group, HealthCheck, Leader, MarathonInstance, Queue, Queues, Task, Tasks, Util

Constant Summary collapse

DEFAULT_URL =
'http://localhost:8080'
VERSION =
'1.3.4'

Class Method Summary collapse

Class Method Details

.connectionObject

Set a new connection



131
132
133
# File 'lib/marathon.rb', line 131

def connection
  singleton.connection
end

.env_optionsObject

Get marathon options from environment



99
100
101
102
103
104
105
# File 'lib/marathon.rb', line 99

def env_options
  opts = {}
  opts[:username] = ENV['MARATHON_USER'] if ENV['MARATHON_USER']
  opts[:password] = ENV['MARATHON_PASSWORD'] if ENV['MARATHON_PASSWORD']
  opts[:insecure] = ENV['MARATHON_INSECURE'] == 'true' if ENV['MARATHON_INSECURE']
  opts
end

.env_urlObject

Get the marathon url from environment



94
95
96
# File 'lib/marathon.rb', line 94

def env_url
  ENV['MARATHON_URL']
end

.infoObject

Get information about the marathon server



145
146
147
# File 'lib/marathon.rb', line 145

def info
  singleton.info
end

.loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

.logger=(value) ⇒ Object

Sets the attribute logger

Parameters:

  • value

    the value to set the attribute logger to.



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

def logger=(value)
  @logger = value
end

.metricsObject



154
155
156
# File 'lib/marathon.rb', line 154

def metrics
  singleton.metrics
end

.optionsObject

Get options for connecting to marathon API



114
115
116
# File 'lib/marathon.rb', line 114

def options
  @options ||= env_options
end

.options=(new_options) ⇒ Object

Set new options



125
126
127
128
# File 'lib/marathon.rb', line 125

def options=(new_options)
  @options = env_options.merge(new_options || {})
  reset_singleton!
end

.pingObject

Ping marathon



150
151
152
# File 'lib/marathon.rb', line 150

def ping
  singleton.ping
end

.reset_connection!Object



140
141
142
# File 'lib/marathon.rb', line 140

def reset_connection!
  reset_singleton!
end

.reset_singleton!Object



136
137
138
# File 'lib/marathon.rb', line 136

def reset_singleton!
  @singleton = MarathonInstance.new(url,options)
end

.singletonObject

Returns the value of attribute singleton.



89
90
91
# File 'lib/marathon.rb', line 89

def singleton
  @singleton
end

.urlObject

Get the marathon API URL



108
109
110
111
# File 'lib/marathon.rb', line 108

def url
  @url ||= env_url || DEFAULT_URL
  @url
end

.url=(new_url) ⇒ Object

Set a new url



119
120
121
122
# File 'lib/marathon.rb', line 119

def url=(new_url)
  @url = new_url
  reset_singleton!
end