iStats 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/README.md +5 -0
- data/bin/istats +1 -1
- data/lib/iStats/command.rb +55 -32
- data/lib/iStats/printer.rb +9 -0
- data/lib/iStats/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4a03b4b826a3677a7d9a4cfe1a2e4cb4d82a5be
|
4
|
+
data.tar.gz: 9b75eaf35c248fce0c9d1edcc36e9ed1735bab05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d412be9240b14e9c977e0490b480a44d5dfcb2d3b1301b70db1025d80e1f67f31b2b1682757eaf369d09e3fe94fcb70b78e9dd17c66e3f81ce7e42279fcfa54c
|
7
|
+
data.tar.gz: 2865be544f5d2202e2dedc54acf8de8fefb908e5fc36a2ff7ff9dc9fab0b83c8bf8bd4e533238b9caa972d2257619fca07621da17d085d4ff520d6e255040f6e
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -65,6 +65,11 @@ iStats now supports extra sensors for advanced users. Here's how to enable that
|
|
65
65
|
5. Create new Pull Request
|
66
66
|
|
67
67
|
#### Tested on
|
68
|
+
|
69
|
+
MacBook Pro 2011
|
70
|
+
OS X: 10.11.6
|
71
|
+
Ruby: 2.0.0
|
72
|
+
|
68
73
|
MacBook Pro 2012
|
69
74
|
OS X: 10.9.3
|
70
75
|
Ruby: 1.9.3, 2.0.0, 2.1.1
|
data/bin/istats
CHANGED
data/lib/iStats/command.rb
CHANGED
@@ -6,16 +6,26 @@ module IStats
|
|
6
6
|
|
7
7
|
# Executes a command
|
8
8
|
#
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def execute
|
10
|
+
Settings.load
|
11
|
+
|
12
|
+
options = parse_options
|
13
|
+
|
12
14
|
# Default command is 'all'
|
13
|
-
category =
|
14
|
-
stat =
|
15
|
+
category = ARGV.empty? ? 'all' : ARGV.shift
|
16
|
+
stat = ARGV.empty? ? 'all' : ARGV.shift
|
17
|
+
|
18
|
+
setup options
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
delegate(category, stat, options)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Setup execution by applying global settings
|
24
|
+
#
|
25
|
+
# options - command line options
|
26
|
+
#
|
27
|
+
def setup(options)
|
28
|
+
Printer.disable_graphs unless options[:display_graphs]
|
19
29
|
end
|
20
30
|
|
21
31
|
# Delegate command to proper class
|
@@ -23,7 +33,7 @@ module IStats
|
|
23
33
|
# category - Hardware we are targeting (CPU, fan, etc.)
|
24
34
|
# stat - The stat we want
|
25
35
|
#
|
26
|
-
def delegate(category, stat)
|
36
|
+
def delegate(category, stat, options)
|
27
37
|
case category
|
28
38
|
when 'all'
|
29
39
|
all
|
@@ -71,18 +81,27 @@ module IStats
|
|
71
81
|
#
|
72
82
|
# returns nothing
|
73
83
|
def parse_options
|
74
|
-
|
84
|
+
options = {:display_graphs => true}
|
85
|
+
|
86
|
+
opt_parser = OptionParser.new do |opts|
|
75
87
|
opts.on('-v', '--version', 'Print Version') do
|
76
88
|
puts "iStats v#{IStats::VERSION}"
|
77
89
|
quit
|
78
90
|
end
|
91
|
+
|
79
92
|
opts.on('-h', '--help', 'Print Help') do
|
80
93
|
help
|
81
94
|
quit
|
82
95
|
end
|
96
|
+
|
97
|
+
opts.on('--no-graphs', 'Don\'t display graphs') do
|
98
|
+
options[:display_graphs] = false
|
99
|
+
end
|
83
100
|
end
|
101
|
+
|
84
102
|
begin
|
85
|
-
|
103
|
+
opt_parser.parse!
|
104
|
+
options
|
86
105
|
rescue OptionParser::MissingArgument => e
|
87
106
|
help e.message
|
88
107
|
quit
|
@@ -100,27 +119,31 @@ module IStats
|
|
100
119
|
" #{error.nil? ? '' : red("\n[Error] #{error}\n")}
|
101
120
|
- iStats: help ---------------------------------------------------
|
102
121
|
|
103
|
-
istats --help
|
104
|
-
istats --version
|
105
|
-
|
106
|
-
|
107
|
-
istats
|
108
|
-
istats cpu
|
109
|
-
istats
|
110
|
-
istats fan
|
111
|
-
istats
|
112
|
-
istats battery
|
113
|
-
istats battery [
|
114
|
-
istats battery [
|
115
|
-
istats battery [
|
116
|
-
istats battery [
|
117
|
-
istats battery [
|
118
|
-
|
119
|
-
|
120
|
-
istats scan
|
121
|
-
istats
|
122
|
-
istats
|
123
|
-
istats
|
122
|
+
istats --help This help text
|
123
|
+
istats --version Print current version
|
124
|
+
|
125
|
+
# Commands
|
126
|
+
istats all Print all stats
|
127
|
+
istats cpu Print all CPU stats
|
128
|
+
istats cpu [temp | temperature] Print CPU temperature
|
129
|
+
istats fan Print all fan stats
|
130
|
+
istats fan [speed] Print fan speed
|
131
|
+
istats battery Print all battery stats
|
132
|
+
istats battery [health] Print battery health
|
133
|
+
istats battery [time | remain] Print battery time remaining
|
134
|
+
istats battery [cycle_count | cc] Print battery cycle count info
|
135
|
+
istats battery [temp | temperature] Print battery temperature
|
136
|
+
istats battery [charge] Print battery charge
|
137
|
+
istats battery [capacity] Print battery capacity info
|
138
|
+
|
139
|
+
istats scan Scans and print temperatures
|
140
|
+
istats scan [key] Print single SMC temperature key
|
141
|
+
istats enable [key | all] Enables key
|
142
|
+
istats disable [key | all] Disable key
|
143
|
+
istats list List available keys
|
144
|
+
|
145
|
+
# Arguments
|
146
|
+
--no-graphs Don't display sparklines graphs
|
124
147
|
|
125
148
|
for more help see: https://github.com/Chris911/iStats
|
126
149
|
".gsub(/^ {8}/, '') # strip the first eight spaces of every line
|
data/lib/iStats/printer.rb
CHANGED
@@ -1,14 +1,23 @@
|
|
1
1
|
module IStats
|
2
2
|
class Printer
|
3
|
+
@display_graphs = true
|
4
|
+
|
3
5
|
class << self
|
4
6
|
include IStats::Color
|
5
7
|
|
8
|
+
def disable_graphs
|
9
|
+
@display_graphs = false
|
10
|
+
end
|
11
|
+
|
6
12
|
# Create colored sparkline
|
7
13
|
# value - The stat value
|
8
14
|
# thresholds - must be an array of size 4 containing the threshold values
|
9
15
|
# for the sparkline colors
|
10
16
|
#
|
11
17
|
def gen_sparkline(value, thresholds)
|
18
|
+
# Graphs can be disabled globally
|
19
|
+
return '' unless @display_graphs
|
20
|
+
|
12
21
|
return if thresholds.count < 4
|
13
22
|
|
14
23
|
list = [0, 30, 55, 80, 100, 130]
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris911
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sparkr
|