Class: Babushka::SystemProfile
Instance Method Summary
collapse
cmd_dir, current_username, log_shell, login_shell, raw_shell, shell, shell!, shell?, shell_cmd, sudo, which
Methods included from LogHelpers
debug, deprecated!, log, log_block, log_error, log_ok, log_stderr, log_warn, removed!
Instance Method Details
#bsd? ⇒ Boolean
34
|
# File 'lib/babushka/system_profile.rb', line 34
def bsd?; system == :bsd end
|
20
|
# File 'lib/babushka/system_profile.rb', line 20
def codename; definition.codename end
|
#codename_str ⇒ Object
21
|
# File 'lib/babushka/system_profile.rb', line 21
def codename_str; definition.codename_str end
|
43
44
45
46
47
48
49
|
# File 'lib/babushka/system_profile.rb', line 43
def cpu_type
shell('uname -m').tap {|result|
result.replace 'x86' if result[/^i.86$/]
result.replace 'x86_64' if result == 'amd64'
}
end
|
65
|
# File 'lib/babushka/system_profile.rb', line 65
def cpus; raise "#{self.class}#cpus is unimplemented." end
|
#definition ⇒ Object
13
14
15
|
# File 'lib/babushka/system_profile.rb', line 13
def definition
@definition ||= SystemDefinition.new(system, flavour, release)
end
|
#description ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/babushka/system_profile.rb', line 55
def description
[
system_description,
version,
("(#{codename_str})" unless codename_str.nil?)
].compact.join(' ')
end
|
#differentiator_for(specs) ⇒ Object
23
24
25
26
|
# File 'lib/babushka/system_profile.rb', line 23
def differentiator_for specs
differentiator = matcher.differentiator_for(specs)
send("#{differentiator}_str") unless differentiator.nil?
end
|
18
|
# File 'lib/babushka/system_profile.rb', line 18
def flavour; flavour_str.gsub(/[^\w]/, '').downcase.to_sym end
|
36
37
38
|
# File 'lib/babushka/system_profile.rb', line 36
def hostname
ShellHelpers.shell('hostname -f')
end
|
#library_ext ⇒ Object
libblah.so on linux, libblah.bundle on OS X, etc.
64
|
# File 'lib/babushka/system_profile.rb', line 64
def library_ext; 'so' end
|
#linux? ⇒ Boolean
32
|
# File 'lib/babushka/system_profile.rb', line 32
def linux?; system == :linux end
|
#match_list ⇒ Object
11
|
# File 'lib/babushka/system_profile.rb', line 11
def match_list() matcher.list end
|
6
7
8
|
# File 'lib/babushka/system_profile.rb', line 6
def matcher
@matcher ||= SystemMatcher.new(system, flavour, codename, pkg_helper_key)
end
|
#matches?(specs) ⇒ Boolean
10
|
# File 'lib/babushka/system_profile.rb', line 10
def matches?(specs) matcher.matches?(specs) end
|
#osx? ⇒ Boolean
33
|
# File 'lib/babushka/system_profile.rb', line 33
def osx?; system == :osx end
|
#pkg_helper_key ⇒ Object
40
|
# File 'lib/babushka/system_profile.rb', line 40
def pkg_helper_key; pkg_helper.manager_key end
|
#pkg_helper_str ⇒ Object
41
|
# File 'lib/babushka/system_profile.rb', line 41
def pkg_helper_str; pkg_helper_key.to_s.capitalize end
|
#public_ip ⇒ Object
67
|
# File 'lib/babushka/system_profile.rb', line 67
def public_ip; raise "#{self.class}#public_ip is unimplemented." end
|
17
|
# File 'lib/babushka/system_profile.rb', line 17
def system; system_str.gsub(/[^\w]/, '').downcase.to_sym end
|
#system_description ⇒ Object
51
52
53
|
# File 'lib/babushka/system_profile.rb', line 51
def system_description
[flavour_str, system_str].uniq.join(' ')
end
|
#total_memory ⇒ Object
66
|
# File 'lib/babushka/system_profile.rb', line 66
def total_memory; raise "#{self.class}#total_memory is unimplemented." end
|
#version_info ⇒ Object
28
29
30
|
# File 'lib/babushka/system_profile.rb', line 28
def version_info
@_version_info ||= get_version_info
end
|