iStats 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a2eb06ddde880e36b03cf31038ddff22ca21488
4
- data.tar.gz: 3c2079b2b812dbcc117688c5c680ae8f08853ab1
3
+ metadata.gz: f4a03b4b826a3677a7d9a4cfe1a2e4cb4d82a5be
4
+ data.tar.gz: 9b75eaf35c248fce0c9d1edcc36e9ed1735bab05
5
5
  SHA512:
6
- metadata.gz: 91ede5007967a1929e0a31216a9b1c0be2b116e62c8466162249ff287b45a2172b8cddca4580dfb916766e81d4af43f7a9878ad59a3790e2277c890c10770fb3
7
- data.tar.gz: add07f319d4f174a38da7fbcd64408240a48abe427fecdab5395906e65e1a1ae2ba5de0fe6800a7da3444fa8ff19907d14d0695b3f65fc5af6f5656d7b724f62
6
+ metadata.gz: d412be9240b14e9c977e0490b480a44d5dfcb2d3b1301b70db1025d80e1f67f31b2b1682757eaf369d09e3fe94fcb70b78e9dd17c66e3f81ce7e42279fcfa54c
7
+ data.tar.gz: 2865be544f5d2202e2dedc54acf8de8fefb908e5fc36a2ff7ff9dc9fab0b83c8bf8bd4e533238b9caa972d2257619fca07621da17d085d4ff520d6e255040f6e
data/.gitignore CHANGED
@@ -34,3 +34,9 @@ build/
34
34
  .rvmrc
35
35
 
36
36
  Makefile.ori
37
+
38
+ # Compiled files
39
+ ext/osx_stats/Makefile
40
+ ext/osx_stats/osx_stats.bundle
41
+ ext/osx_stats/smc.o
42
+ lib/osx_stats.bundle
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
@@ -5,4 +5,4 @@ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
5
 
6
6
  require 'iStats'
7
7
 
8
- IStats::Command.execute(*ARGV)
8
+ IStats::Command.execute()
@@ -6,16 +6,26 @@ module IStats
6
6
 
7
7
  # Executes a command
8
8
  #
9
- # args - Command line arguments
10
- #
11
- def execute(*args)
9
+ def execute
10
+ Settings.load
11
+
12
+ options = parse_options
13
+
12
14
  # Default command is 'all'
13
- category = args.empty? ? 'all' : args.shift
14
- stat = args.empty? ? 'all' : args.shift
15
+ category = ARGV.empty? ? 'all' : ARGV.shift
16
+ stat = ARGV.empty? ? 'all' : ARGV.shift
17
+
18
+ setup options
15
19
 
16
- Settings.load;
17
- parse_options
18
- delegate(category, stat)
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
- o = OptionParser.new do |opts|
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
- o.parse!
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 This help text
104
- istats --version Print current version
105
-
106
- istats all Print all stats
107
- istats cpu Print all CPU stats
108
- istats cpu [temp | temperature] Print CPU temperature
109
- istats fan Print all fan stats
110
- istats fan [speed] Print fan speed
111
- istats battery Print all battery stats
112
- istats battery [health] Print battery health
113
- istats battery [time | remain] Print battery time remaining
114
- istats battery [cycle_count | cc] Print battery cycle count info
115
- istats battery [temp | temperature] Print battery temperature
116
- istats battery [charge] Print battery charge
117
- istats battery [capacity] Print battery capacity info
118
-
119
- istats scan Scans and print temperatures
120
- istats scan [key] Print single SMC temperature key
121
- istats enable [key | all] Enables key
122
- istats disable [key | all] Disable key
123
- istats list List available keys
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
@@ -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]
@@ -1,3 +1,3 @@
1
1
  module IStats
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
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.2.0
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: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sparkr