Class: Babushka::LinuxSystemProfile

Inherits:
SystemProfile show all
Defined in:
lib/babushka/system_profile.rb

Instance Method Summary collapse

Methods inherited from SystemProfile

#bsd?, #codename, #codename_str, #cpu_type, #definition, #description, #differentiator_for, #flavour, #hostname, #library_ext, #linux?, #match_list, #matcher, #matches?, #osx?, #pkg_helper, #pkg_helper_key, #pkg_helper_str, #system, #system_description, #version_info

Methods included from ShellHelpers

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

#cpusObject


135
# File 'lib/babushka/system_profile.rb', line 135

def cpus; shell("cat /proc/cpuinfo | grep '^processor\\b' | wc -l").to_i end

#flavour_strObject


132
# File 'lib/babushka/system_profile.rb', line 132

def flavour_str; 'Unknown' end

#public_ipObject


138
139
140
141
142
# File 'lib/babushka/system_profile.rb', line 138

def public_ip
  shell('ifconfig',
    shell('netstat -nr').val_for("0.0.0.0").scan(/\w+$/).first
  ).val_for("inet addr").scan(/^[\d\.]+/).first
end

#releaseObject


134
# File 'lib/babushka/system_profile.rb', line 134

def release; version end

#system_strObject


131
# File 'lib/babushka/system_profile.rb', line 131

def system_str; 'Linux' end

#total_memoryObject


136
# File 'lib/babushka/system_profile.rb', line 136

def total_memory; shell("free -b").val_for("Mem").scan(/^\d+\b/).first.to_i end

#versionObject


133
# File 'lib/babushka/system_profile.rb', line 133

def version; nil end