Class: Babushka::OSXSystemProfile

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, #linux?, #match_list, #matcher, #matches?, #name, #name_str, #osx?, #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



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

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

#flavourObject



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

def flavour; system end

#flavour_strObject



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

def flavour_str; system_str end

#get_version_infoObject



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

def get_version_info; shell 'sw_vers' end

#library_extObject



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

def library_ext; 'bundle' end

#pkg_helperObject



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

def pkg_helper; BrewHelper end

#public_ipObject



94
95
96
97
98
# File 'lib/babushka/system_profile.rb', line 94

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

#releaseObject



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

def release; version.match(/^\d+\.\d+/).to_s end

#systemObject



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

def system; :osx end

#system_strObject



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

def system_str; 'Mac OS X' end

#total_memoryObject



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

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

#versionObject



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

def version; version_info.val_for 'ProductVersion' end