iStats 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -21
- data/lib/iStats.rb +1 -0
- data/lib/iStats/battery.rb +1 -1
- data/lib/iStats/command.rb +7 -1
- data/lib/iStats/cpu.rb +1 -1
- data/lib/iStats/extra.rb +3 -3
- data/lib/iStats/printer.rb +17 -0
- data/lib/iStats/smc.rb +1 -1
- data/lib/iStats/utils.rb +12 -0
- data/lib/iStats/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d54c5c804c54fed0d04f31076a0aaa8ba12dfe
|
4
|
+
data.tar.gz: 622027f040ac6ae403c3d1001701a75e8732c9dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ffa8f9e3b78f50e6fcb767ead6f877ef1c133ba1c7822b56541d5b19700797f2f3227879ec75b1871c6f1aa10ed0754ba65d75cb668023d8c24876406689b5
|
7
|
+
data.tar.gz: 69c8d8d52003bfa4432765e59390c71f619d55336cc266fe65a4cc51515b31bf959a982de37092e022ef16cc2e5aeb92b4f5385c9fbd88e650eba9b6e7279014
|
data/README.md
CHANGED
@@ -23,27 +23,32 @@ If you are running an older version of OS X and the install fails you might want
|
|
23
23
|
```
|
24
24
|
- iStats: help ---------------------------------------------------
|
25
25
|
|
26
|
-
istats --help
|
27
|
-
istats --version
|
28
|
-
|
29
|
-
|
30
|
-
istats
|
31
|
-
istats cpu
|
32
|
-
istats
|
33
|
-
istats fan
|
34
|
-
istats
|
35
|
-
istats battery
|
36
|
-
istats battery [
|
37
|
-
istats battery [
|
38
|
-
istats battery [
|
39
|
-
istats battery [
|
40
|
-
istats battery [
|
41
|
-
|
42
|
-
|
43
|
-
istats scan
|
44
|
-
istats
|
45
|
-
istats
|
46
|
-
istats
|
26
|
+
istats --help This help text
|
27
|
+
istats --version Print current version
|
28
|
+
|
29
|
+
# Commands
|
30
|
+
istats all Print all stats
|
31
|
+
istats cpu Print all CPU stats
|
32
|
+
istats cpu [temp | temperature] Print CPU temperature
|
33
|
+
istats fan Print all fan stats
|
34
|
+
istats fan [speed] Print fan speed
|
35
|
+
istats battery Print all battery stats
|
36
|
+
istats battery [health] Print battery health
|
37
|
+
istats battery [time | remain] Print battery time remaining
|
38
|
+
istats battery [cycle_count | cc] Print battery cycle count info
|
39
|
+
istats battery [temp | temperature] Print battery temperature
|
40
|
+
istats battery [charge] Print battery charge
|
41
|
+
istats battery [capacity] Print battery capacity info
|
42
|
+
|
43
|
+
istats scan Scans and print temperatures
|
44
|
+
istats scan [key] Print single SMC temperature key
|
45
|
+
istats enable [key | all] Enables key
|
46
|
+
istats disable [key | all] Disable key
|
47
|
+
istats list List available keys
|
48
|
+
|
49
|
+
# Arguments
|
50
|
+
--no-graphs Don't display sparklines graphs
|
51
|
+
-f, --fahrenheit Display temperatures in fahrenheit
|
47
52
|
|
48
53
|
for more help see: https://github.com/Chris911/iStats
|
49
54
|
```
|
data/lib/iStats.rb
CHANGED
data/lib/iStats/battery.rb
CHANGED
@@ -99,7 +99,7 @@ module IStats
|
|
99
99
|
# Get the battery temperature
|
100
100
|
#
|
101
101
|
def battery_temperature
|
102
|
-
puts "Battery temp: #{
|
102
|
+
puts "Battery temp: #{Printer.format_temperature(get_battery_temp)} "
|
103
103
|
end
|
104
104
|
|
105
105
|
# Get the battery health
|
data/lib/iStats/command.rb
CHANGED
@@ -26,6 +26,7 @@ module IStats
|
|
26
26
|
#
|
27
27
|
def setup(options)
|
28
28
|
Printer.disable_graphs unless options[:display_graphs]
|
29
|
+
Printer.set_temperature_scale options[:temperature_scale]
|
29
30
|
end
|
30
31
|
|
31
32
|
# Delegate command to proper class
|
@@ -81,7 +82,7 @@ module IStats
|
|
81
82
|
#
|
82
83
|
# returns nothing
|
83
84
|
def parse_options
|
84
|
-
options = {:display_graphs => true}
|
85
|
+
options = {:display_graphs => true, :temperature_scale => 'celcius'}
|
85
86
|
|
86
87
|
opt_parser = OptionParser.new do |opts|
|
87
88
|
opts.on('-v', '--version', 'Print Version') do
|
@@ -97,6 +98,10 @@ module IStats
|
|
97
98
|
opts.on('--no-graphs', 'Don\'t display graphs') do
|
98
99
|
options[:display_graphs] = false
|
99
100
|
end
|
101
|
+
|
102
|
+
opts.on('-f', '--fahrenheit', 'Display temperatures in fahrenheit') do
|
103
|
+
options[:temperature_scale] = 'fahrenheit'
|
104
|
+
end
|
100
105
|
end
|
101
106
|
|
102
107
|
begin
|
@@ -144,6 +149,7 @@ module IStats
|
|
144
149
|
|
145
150
|
# Arguments
|
146
151
|
--no-graphs Don't display sparklines graphs
|
152
|
+
-f, --fahrenheit Display temperatures in fahrenheit
|
147
153
|
|
148
154
|
for more help see: https://github.com/Chris911/iStats
|
149
155
|
".gsub(/^ {8}/, '') # strip the first eight spaces of every line
|
data/lib/iStats/cpu.rb
CHANGED
@@ -30,7 +30,7 @@ module IStats
|
|
30
30
|
def cpu_temperature
|
31
31
|
t = get_cpu_temp
|
32
32
|
thresholds = [50, 68, 80, 90]
|
33
|
-
puts "CPU temp: #{t}#{
|
33
|
+
puts "CPU temp: #{Printer.format_temperature(t)} #{Printer.gen_sparkline(t, thresholds)}"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/iStats/extra.rb
CHANGED
@@ -46,14 +46,14 @@ module IStats
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
# Pretty print sensor
|
49
|
+
# Pretty print sensor temperature
|
50
50
|
def display_temp(key, sensor, display)
|
51
51
|
t = SMC.is_key_supported(key).round(2);
|
52
52
|
thresholds = sensor['thresholds'][1..-2].split(/, /).map { |s| s.to_i }
|
53
53
|
if (display)
|
54
|
-
puts "#{key} #{t}
|
54
|
+
puts "#{key} #{Printer.format_temperature(t)} \t#{Printer.gen_sparkline(t, thresholds)} #{sensor['name']}"
|
55
55
|
else
|
56
|
-
puts "#{key} #{sensor['name']} temp: #{t}#{
|
56
|
+
puts "#{key} #{sensor['name']} temp: #{Printer.format_temperature(t)} #{Printer.gen_sparkline(t, thresholds)}"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
data/lib/iStats/printer.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module IStats
|
2
2
|
class Printer
|
3
3
|
@display_graphs = true
|
4
|
+
@temperature_scale = 'celcius'
|
4
5
|
|
5
6
|
class << self
|
6
7
|
include IStats::Color
|
@@ -9,6 +10,10 @@ module IStats
|
|
9
10
|
@display_graphs = false
|
10
11
|
end
|
11
12
|
|
13
|
+
def set_temperature_scale(scale)
|
14
|
+
@temperature_scale = scale
|
15
|
+
end
|
16
|
+
|
12
17
|
# Create colored sparkline
|
13
18
|
# value - The stat value
|
14
19
|
# thresholds - must be an array of size 4 containing the threshold values
|
@@ -37,6 +42,18 @@ module IStats
|
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
45
|
+
|
46
|
+
# Pretty print temperature values.
|
47
|
+
# Also converts the value to the class temperature_scale.
|
48
|
+
#
|
49
|
+
# Returns the temperature string.
|
50
|
+
def format_temperature(temperature)
|
51
|
+
if @temperature_scale == 'celcius'
|
52
|
+
"#{temperature.round(2)}#{Symbols.degree}C"
|
53
|
+
else
|
54
|
+
"#{Utils.to_fahrenheit(temperature).round(2)}#{Symbols.degree}F"
|
55
|
+
end
|
56
|
+
end
|
40
57
|
end
|
41
58
|
end
|
42
59
|
end
|
data/lib/iStats/smc.rb
CHANGED
@@ -112,7 +112,7 @@ module IStats
|
|
112
112
|
|
113
113
|
Settings.addSensor(key, sensors)
|
114
114
|
|
115
|
-
puts "#{key} #{sensors['name']} #{t}#{
|
115
|
+
puts "#{key} #{sensors['name']} #{Printer.format_temperature(t)} #{Printer.gen_sparkline(t, sensors['thresholds'])}"
|
116
116
|
end
|
117
117
|
}
|
118
118
|
}
|
data/lib/iStats/utils.rb
ADDED
data/lib/iStats/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iStats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris911
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sparkr
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/iStats/settings.rb
|
112
112
|
- lib/iStats/smc.rb
|
113
113
|
- lib/iStats/symbols.rb
|
114
|
+
- lib/iStats/utils.rb
|
114
115
|
- lib/iStats/version.rb
|
115
116
|
homepage: https://github.com/Chris911/iStats
|
116
117
|
licenses:
|