Module: BenchPress::SystemInformation

Extended by:
SystemInformation
Included in:
SystemInformation
Defined in:
lib/bench_press/system_information.rb

Instance Method Summary collapse

Instance Method Details

#announce_cpuObject



6
7
8
9
10
11
# File 'lib/bench_press/system_information.rb', line 6

def announce_cpu
  [
    announce("CPU:", cpu),
    announce("Processor Count:", processor_count)
  ].join("\n")
end

#announce_memoryObject



13
14
15
# File 'lib/bench_press/system_information.rb', line 13

def announce_memory
  announce "Memory:", memory
end

#announce_osObject



17
18
19
# File 'lib/bench_press/system_information.rb', line 17

def announce_os
  announce "Operating System:", os
end

#announce_ruby_versionObject



21
22
23
# File 'lib/bench_press/system_information.rb', line 21

def announce_ruby_version
  ruby_version
end

#cpuObject



25
26
27
28
29
30
31
# File 'lib/bench_press/system_information.rb', line 25

def cpu
  if mac?
    "#{facts['sp_cpu_type']} #{facts['sp_current_processor_speed']}"
  else
    facts['processor0']
  end
end

#crypted_identifierObject



33
34
35
# File 'lib/bench_press/system_information.rb', line 33

def crypted_identifier
  Digest::SHA1.hexdigest(identifier)
end

#memoryObject



37
38
39
# File 'lib/bench_press/system_information.rb', line 37

def memory
  facts['sp_physical_memory'] || facts['memorysize']
end

#osObject



41
42
43
# File 'lib/bench_press/system_information.rb', line 41

def os
  facts['sp_os_version'] || facts['lsbdistdescription'] || facts['operatingsystem']
end

#processor_countObject



45
46
47
# File 'lib/bench_press/system_information.rb', line 45

def processor_count
  facts['sp_number_processors'] || facts['processorcount'] || facts['physicalprocessorcount']
end

#ruby_versionObject



49
50
51
# File 'lib/bench_press/system_information.rb', line 49

def ruby_version
  RUBY_DESCRIPTION
end

#summaryObject



53
54
55
56
57
58
59
60
# File 'lib/bench_press/system_information.rb', line 53

def summary
  [
    announce_os,
    announce_cpu,
    announce_memory,
    announce_ruby_version
  ].join("\n")
end