iStats 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -3
- data/lib/iStats/battery.rb +42 -4
- data/lib/iStats/command.rb +1 -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: 13a2f312a29bf4d7fb4afbe20dc1c805411e7ef2
|
4
|
+
data.tar.gz: 2faa9e60b56008e5a0ed526e7e90f941bc99cd9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ddd5d18c2c7a3d00e5e7cc9095d1f1485ca2825f8116c95429b5b7b69bd83b6ce6b8bed74db718bb61fe4a0c5ad2d0f3efef333f899feb9d2fcfc21ccc0e6cf
|
7
|
+
data.tar.gz: 16e47c3fdb34e28de1f12b4ecc51a1f6858f2b4a76bad29f0fb816570472a4500eed2e3c3952d24c1d3eebd089c86737a60228b2bcd389d31fa8bf7d4c64952e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
iStats [![Gem Version](https://badge.fury.io/rb/iStats.svg)](http://badge.fury.io/rb/iStats)
|
2
2
|
======
|
3
3
|
|
4
|
-
iStats is a command-line tool that allows you to easily grab the CPU temperature, fan speeds and battery information on OS X. If you'd like to see more data available feel free to open an issue.
|
4
|
+
iStats is a command-line tool that allows you to easily grab the CPU temperature, fan speeds and battery information on OS X. If you'd like to see more data available feel free to open an issue.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
8
|
$ gem install iStats
|
9
|
-
|
9
|
+
|
10
10
|
#### Warning
|
11
11
|
**This is now fixed with the release of OS X 10.9.3**<br>
|
12
12
|
A [bug in Ruby](https://bugs.ruby-lang.org/issues/9624) and Apple XCode 5.1 onwards (new CLANG version) might make it impossible to install this gem if you are using Ruby from the Xcode command-line tools package. If you see an error when the gem is building the native extension try to use this command to install iStats: <br>
|
@@ -16,7 +16,7 @@ If you are using RVM or homebrew to manage your Ruby installation you should be
|
|
16
16
|
|
17
17
|
## Screenshot
|
18
18
|
#### All Stats
|
19
|
-
![](http://i.imgur.com/
|
19
|
+
![](http://i.imgur.com/c4xLB8u.png)
|
20
20
|
|
21
21
|
#### Sparkline levels
|
22
22
|
![](http://i.imgur.com/ht2NZCL.gif)
|
@@ -40,6 +40,7 @@ If you are using RVM or homebrew to manage your Ruby installation you should be
|
|
40
40
|
istats battery [temp | temperature] Print battery temperature
|
41
41
|
istats battery [time | remain] Print battery time remaining
|
42
42
|
istats battery [charge] Print battery charge
|
43
|
+
istats battery [capacity] Print battery capacity info
|
43
44
|
|
44
45
|
for more help see: https://github.com/Chris911/iStats
|
45
46
|
```
|
data/lib/iStats/battery.rb
CHANGED
@@ -25,6 +25,8 @@ module IStats
|
|
25
25
|
battery_time_remaining
|
26
26
|
when 'charge'
|
27
27
|
battery_charge
|
28
|
+
when 'capacity'
|
29
|
+
print_capacity_info
|
28
30
|
else
|
29
31
|
Command.help "Unknown stat for Battery: #{stat}"
|
30
32
|
end
|
@@ -36,26 +38,62 @@ module IStats
|
|
36
38
|
return unless validate_battery
|
37
39
|
|
38
40
|
battery_health
|
39
|
-
battery_temperature
|
40
41
|
cycle_count
|
42
|
+
print_capacity_info
|
43
|
+
battery_temperature
|
41
44
|
end
|
42
45
|
|
43
46
|
# Prints the battery cycle count info
|
44
47
|
#
|
45
48
|
def cycle_count
|
46
|
-
data = %x( ioreg -l | grep
|
47
|
-
cycle_count = data[/"
|
49
|
+
data = %x( ioreg -l | grep "CycleCount" )
|
50
|
+
cycle_count = data[/"CycleCount" = ([0-9]*)/, 1]
|
48
51
|
if cycle_count == nil
|
49
52
|
puts "Cycle count: unknown"
|
50
53
|
else
|
51
54
|
max_cycle_count = design_cycle_count
|
52
55
|
percentage = (cycle_count.to_f/max_cycle_count.to_f)*100
|
53
56
|
thresholds = [45, 65, 85, 95]
|
54
|
-
puts "Cycle count: #{cycle_count} " + Printer.gen_sparkline(percentage, thresholds)
|
57
|
+
puts "Cycle count: #{cycle_count} " + Printer.gen_sparkline(percentage, thresholds) + " #{percentage.round(1)}%"
|
55
58
|
puts "Max cycle count: #{max_cycle_count}"
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
62
|
+
# Get information from ioreg
|
63
|
+
#
|
64
|
+
def grep_ioreg(keyword)
|
65
|
+
data = %x( ioreg -l | grep "#{keyword}" )
|
66
|
+
capacity = data[/"#{keyword}" = ([0-9]*)/, 1]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Original max capacity
|
70
|
+
#
|
71
|
+
def ori_max_capacity
|
72
|
+
grep_ioreg("DesignCapacity")
|
73
|
+
end
|
74
|
+
|
75
|
+
# Current max capacity
|
76
|
+
#
|
77
|
+
def cur_max_capacity
|
78
|
+
grep_ioreg("MaxCapacity")
|
79
|
+
end
|
80
|
+
|
81
|
+
# Current capacity
|
82
|
+
#
|
83
|
+
def cur_capacity
|
84
|
+
grep_ioreg("CurrentCapacity")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Print battery capacity info
|
88
|
+
#
|
89
|
+
def print_capacity_info
|
90
|
+
percentage = (cur_max_capacity.to_f/ori_max_capacity.to_f)*100
|
91
|
+
thresholds = [45, 65, 85, 95]
|
92
|
+
puts "Current charge: #{cur_capacity} mAh"
|
93
|
+
puts "Maximum charge: #{cur_max_capacity} mAh " + Printer.gen_sparkline(100-percentage, thresholds) + " #{percentage.round(1)}%"
|
94
|
+
puts "Design capacity: #{ori_max_capacity} mAh"
|
95
|
+
end
|
96
|
+
|
59
97
|
# Get the battery temperature
|
60
98
|
#
|
61
99
|
def battery_temperature
|
data/lib/iStats/command.rb
CHANGED
@@ -95,6 +95,7 @@ module IStats
|
|
95
95
|
istats battery [cycleCount | cc] Print battery cycle count info
|
96
96
|
istats battery [temp | temperature] Print battery temperature
|
97
97
|
istats battery [charge] Print battery charge
|
98
|
+
istats battery [capacity] Print battery capacity info
|
98
99
|
|
99
100
|
for more help see: https://github.com/Chris911/iStats
|
100
101
|
".gsub(/^ {8}/, '') # strip the first eight spaces of every line
|
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: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris911
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sparkr
|