iStats 0.0.9 → 1.0.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: 13a2f312a29bf4d7fb4afbe20dc1c805411e7ef2
4
- data.tar.gz: 2faa9e60b56008e5a0ed526e7e90f941bc99cd9c
3
+ metadata.gz: 46b672f385914695c84c7b0039a9936194185d08
4
+ data.tar.gz: d683d69c2094a1c16a810f48af5f16d0ccb2a71d
5
5
  SHA512:
6
- metadata.gz: 3ddd5d18c2c7a3d00e5e7cc9095d1f1485ca2825f8116c95429b5b7b69bd83b6ce6b8bed74db718bb61fe4a0c5ad2d0f3efef333f899feb9d2fcfc21ccc0e6cf
7
- data.tar.gz: 16e47c3fdb34e28de1f12b4ecc51a1f6858f2b4a76bad29f0fb816570472a4500eed2e3c3952d24c1d3eebd089c86737a60228b2bcd389d31fa8bf7d4c64952e
6
+ metadata.gz: 69fc87975d1584f76b7d898ec03dfadecc7103d2957a8e55f720d10383ec88fb51b55da4953e915aea0bdf0afb610b5b98d40a34bd8702a835884136db17af30
7
+ data.tar.gz: ab1565ffba4602dd28557cb14ff4607c26d886192d03f325fb6691edeea47184574bc196b9a406922b8dc58665a5f5e712623cc34b7fb14fc605087af4151e8a
data/README.md CHANGED
@@ -55,5 +55,5 @@ If you are using RVM or homebrew to manage your Ruby installation you should be
55
55
 
56
56
  #### Tested on
57
57
  MacBook Pro 2012<br>
58
- OS X 10.9.2<br>
58
+ OS X 10.9.3<br>
59
59
  Ruby: 1.9.3, 2.0.0, 2.1.1<br>
data/ext/osx_stats/smc.c CHANGED
@@ -413,21 +413,26 @@ VALUE method_get_battery_charge(VALUE self) {
413
413
  }
414
414
  }
415
415
 
416
+ #ifdef SMC_MAIN_TEST
416
417
  /* Main method used for test */
417
- // int main(int argc, char *argv[])
418
- // {
419
- // //SMCOpen();
420
- // //printf("%0.1f°C\n", SMCGetTemperature(SMC_KEY_CPU_TEMP));
421
- // //printf("%0.1f\n", SMCGetFanSpeed(0));
422
- // //printf("%0.1f\n", SMCGetFanSpeed(3));
423
- // //printf("%i\n", SMCGetFanNumber(SMC_KEY_FAN_NUM));
424
- // //SMCClose();
425
- //
426
- // int designCycleCount = getDesignCycleCount();
427
- // const char* batteryHealth = getBatteryHealth();
428
- //
429
- // if (designCycleCount) printf ("%i\n", designCycleCount);
430
- // if (batteryHealth) printf ("%s\n", batteryHealth);
431
- //
432
- // return 0;
433
- // }
418
+ int main(int argc, char *argv[])
419
+ {
420
+ SMCOpen();
421
+ int i = 0, fans = SMCGetFanNumber(SMC_KEY_FAN_NUM);
422
+ float bat_temp = SMCGetTemperature(SMC_KEY_BATTERY_TEMP);
423
+ printf("CPU\t%0.1f\t°C\n", SMCGetTemperature(SMC_KEY_CPU_TEMP));
424
+ printf("FAN_NUM\t%i\n", fans);
425
+ for (i = 0; i < fans; i++)
426
+ printf ("FAN_%i\t%0.1f\tRPM\n", i, SMCGetFanSpeed(i));
427
+ SMCClose();
428
+
429
+ printf ("HasBatt\t%i\n", hasBattery());
430
+ printf ("Battery\t%0.1f\t°C\n", bat_temp);
431
+ printf ("Health\t%s\n", getBatteryHealth());
432
+ printf ("DCycle\t%i\n", getDesignCycleCount());
433
+ printf ("Remain\t%0.0f\tmAh\n", IOPSGetTimeRemainingEstimate());
434
+ printf ("Charge\t%i\t%%\n", getBatteryCharge());
435
+
436
+ return 0;
437
+ }
438
+ #endif
data/iStats.gemspec CHANGED
@@ -28,6 +28,6 @@ spec = Gem::Specification.new do |s|
28
28
  s.add_dependency "sparkr", "~> 0.4"
29
29
 
30
30
  s.add_development_dependency "bundler", "~> 1.3"
31
- s.add_development_dependency "rake"
32
- s.add_development_dependency "rake-compiler"
31
+ s.add_development_dependency "rake", "~> 1.8"
32
+ s.add_development_dependency "rake-compiler", "~> 1.8"
33
33
  end
@@ -46,8 +46,8 @@ module IStats
46
46
  # Prints the battery cycle count info
47
47
  #
48
48
  def cycle_count
49
- data = %x( ioreg -l | grep "CycleCount" )
50
- cycle_count = data[/"CycleCount" = ([0-9]*)/, 1]
49
+ @ioreg_out ||= %x( ioreg -rn AppleSmartBattery )
50
+ cycle_count = @ioreg_out[/"CycleCount" = ([0-9]*)/, 1]
51
51
  if cycle_count == nil
52
52
  puts "Cycle count: unknown"
53
53
  else
@@ -62,8 +62,8 @@ module IStats
62
62
  # Get information from ioreg
63
63
  #
64
64
  def grep_ioreg(keyword)
65
- data = %x( ioreg -l | grep "#{keyword}" )
66
- capacity = data[/"#{keyword}" = ([0-9]*)/, 1]
65
+ @ioreg_out ||= %x( ioreg -rn AppleSmartBattery )
66
+ capacity = @ioreg_out[/"#{keyword}" = ([0-9]*)/, 1]
67
67
  end
68
68
 
69
69
  # Original max capacity
@@ -89,7 +89,9 @@ module IStats
89
89
  def print_capacity_info
90
90
  percentage = (cur_max_capacity.to_f/ori_max_capacity.to_f)*100
91
91
  thresholds = [45, 65, 85, 95]
92
- puts "Current charge: #{cur_capacity} mAh"
92
+ charge = get_battery_charge
93
+ charge = charge ? " #{charge}%" : ""
94
+ puts "Current charge: #{cur_capacity} mAh#{charge}"
93
95
  puts "Maximum charge: #{cur_max_capacity} mAh " + Printer.gen_sparkline(100-percentage, thresholds) + " #{percentage.round(1)}%"
94
96
  puts "Design capacity: #{ori_max_capacity} mAh"
95
97
  end
@@ -1,3 +1,3 @@
1
1
  module IStats
2
- VERSION = '0.0.9'
2
+ VERSION = '1.0.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: 0.0.9
4
+ version: 1.0.0
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-30 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sparkr
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.8'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.8'
69
69
  description: iStats is a command-line tool that allows you to easily grab the CPU
70
70
  temperature, fan speeds and battery information on OS X.
71
71
  email:
@@ -78,7 +78,6 @@ extra_rdoc_files: []
78
78
  files:
79
79
  - ".gitignore"
80
80
  - Gemfile
81
- - Gemfile.lock
82
81
  - LICENSE
83
82
  - README.md
84
83
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,22 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- iStats (0.0.9)
5
- sparkr (~> 0.4)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- rake (10.3.1)
11
- rake-compiler (0.9.2)
12
- rake
13
- sparkr (0.4.1)
14
-
15
- PLATFORMS
16
- ruby
17
-
18
- DEPENDENCIES
19
- bundler (~> 1.3)
20
- iStats!
21
- rake
22
- rake-compiler