Module: Train::Extras::DetectDarwin
- Includes:
- Uname
- Included in:
- OSCommon
- Defined in:
- lib/train/extras/os_detect_darwin.rb
Instance Method Summary
collapse
Methods included from Uname
#uname_m, #uname_r, #uname_s
Instance Method Details
#detect_darwin ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/train/extras/os_detect_darwin.rb', line 16
def detect_darwin
cmd = @backend.run_command('/usr/bin/sw_vers')
return false if cmd.exit_status != 0
return false if cmd.stdout.empty?
name = cmd.stdout[/^ProductName:\s+(.+)$/, 1]
return false if name.nil?
@platform[:name] = name.downcase.chomp.tr(' ', '_')
@platform[:release] = cmd.stdout[/^ProductVersion:\s+(.+)$/, 1]
@platform[:build] = cmd.stdout[/^BuildVersion:\s+(.+)$/, 1]
@platform[:family] = 'darwin'
detect_darwin_arch
true
end
|
#detect_darwin_arch ⇒ Object
36
37
38
|
# File 'lib/train/extras/os_detect_darwin.rb', line 36
def detect_darwin_arch
@platform[:arch] = uname_m
end
|