Class: Babushka::OSXSystemProfile

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, #hostname, #linux?, #match_list, #matcher, #matches?, #osx?, #pkg_helper_key, #pkg_helper_str, #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


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

def cpus; shell('sysctl -n hw.ncpu').to_i end

#flavourObject


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

def flavour; system end

#flavour_strObject


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

def flavour_str; system_str end

#get_version_infoObject


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

def get_version_info; shell 'sw_vers' end

#library_extObject


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

def library_ext; 'bundle' end

#pkg_helperObject


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

def pkg_helper; BrewHelper end

#public_ipObject


98
99
100
101
102
# File 'lib/babushka/system_profile.rb', line 98

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

#releaseObject


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

def release; version[/^\d+\.\d+/] end

#systemObject


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

def system; :osx end

#system_strObject


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

def system_str; 'Mac OS X' end

#total_memoryObject


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

def total_memory; shell("sysctl -n hw.memsize").to_i end

#versionObject


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

def version; version_info.val_for 'ProductVersion' end