Class: Babushka::LinuxSystemProfile

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

Instance Method Summary collapse

Methods inherited from SystemProfile

#bsd?, #cpu_type, #description, #differentiator_for, #library_ext, #linux?, #match_list, #matcher, #matches?, #name, #name_str, #osx?, #pkg_helper, #pkg_helper_key, #pkg_helper_str, #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



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

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

#flavourObject



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

def flavour; :unknown end

#flavour_strObject



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

def flavour_str; 'Linux' end

#public_ipObject



136
137
138
139
140
# File 'lib/babushka/system_profile.rb', line 136

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



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

def release; version end

#systemObject



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

def system; :linux end

#system_strObject



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

def system_str; 'Linux' end

#total_memoryObject



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

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

#versionObject



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

def version; 'unknown' end