Top Level Namespace
Defined Under Namespace
Modules: CellQueue, Memory, Zygote
Classes: CellQueueEntry, ZygoteWeb
Instance Method Summary
collapse
Instance Method Details
#clean_params(params) ⇒ Object
25
26
27
28
|
# File 'lib/zygote/util.rb', line 25
def clean_params(params)
params.delete_if { |x, _| x == 'splat' || x == 'captures' }
params
end
|
#compute_sku(vendor, serial, board_serial) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/zygote/util.rb', line 3
def compute_sku(vendor, serial, board_serial)
strip_pattern = /[^-^:\p{Alnum}]/
serial = (serial || '').gsub(strip_pattern, '')
vendor = (vendor || '').gsub(strip_pattern, '')
board_serial = (board_serial || '').gsub(strip_pattern, '')
serial = board_serial unless board_serial.empty?
case vendor
when 'DellInc'
sku = 'DEL'
when 'Supermicro'
sku = 'SPM'
else
sku = 'UKN' end
sku = "#{sku}-#{serial}"
sku
end
|
#discover_domain ⇒ Object
34
35
36
|
# File 'lib/zygote/util.rb', line 34
def discover_domain
Socket.gethostname.split('.')[1..-1].join('.')
end
|
#my_ip ⇒ Object
30
31
32
|
# File 'lib/zygote/util.rb', line 30
def my_ip
Socket.ip_address_list.find { |x| x.ipv4? && !x.ipv4_loopback? }.ip_address
end
|
#zygote(port: 7000, threads: 1000, config_path: nil, cells: [], debug: false) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/zygote/http.rb', line 105
def zygote(port: 7000, threads:1000, config_path: nil, cells: [], debug:false)
debug ||= ENV['DEBUG']
cell_config = YAML.load(File.read(config_path || File.join(Dir.pwd, 'config', 'cells.yml')))
ZygoteWeb.cell_config = cell_config
zygote = Genesis::Reactor.new(
threads: threads,
protocols: {
Genesis::Http::Protocol => port
},
handlers: [ZygoteWeb],
views: [File.expand_path('../../../views', __FILE__), cells].flatten,
debug: debug
)
if debug
$stdout.sync = true
$stderr.sync = true
end
zygote
end
|