state_mate 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/README.md +6 -0
- data/lib/state_mate/adapters/pmset.rb +66 -50
- data/lib/state_mate/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: 6355ffa118f223af88b6bef332d050d13e8c92b3
|
4
|
+
data.tar.gz: 9c003e9a2275ce30df419d0425740380bd698046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75855da6213f689af881a4241045fa865db8f17f8cf26a19b0fe920fee9325da0ba6e4971ad585887f04be59d369c1d57437478de3e1c03388154ac97172efdf
|
7
|
+
data.tar.gz: de8882e2f325ded54a07c7ec4c0d47c765bac082f740b6149a67167129e0da25c9484321d718548cf10f59daf34ce7610cd160cf1f6ede19f224d930cbfd64a7
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# StateMate
|
2
2
|
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/state_mate.svg)][gem]
|
4
|
+
[![Build Status](http://img.shields.io/travis/nrser/state_mate.svg)][travis]
|
5
|
+
|
6
|
+
[gem]: https://rubygems.org/gems/state_mate
|
7
|
+
[travis]: http://travis-ci.org/nrser/state_mate
|
8
|
+
|
3
9
|
i heard it's meant to help you with your state, mate!
|
4
10
|
|
5
11
|
## Installation
|
@@ -38,7 +38,7 @@ module StateMate::Adapters::PMSet
|
|
38
38
|
# or 0 to disable)
|
39
39
|
'displaysleep',
|
40
40
|
|
41
|
-
# disk spindown timer; replaces 'spindown' argument in 10.4 (value in
|
41
|
+
# disk spindown timer; replaces 'spindown' argument in 10.4 (value in
|
42
42
|
# minutes, or 0 to dis-able)
|
43
43
|
'disksleep',
|
44
44
|
|
@@ -65,7 +65,7 @@ module StateMate::Adapters::PMSet
|
|
65
65
|
# (value = 0/1)
|
66
66
|
'lessbright',
|
67
67
|
|
68
|
-
# display sleep will use an intermediate half-brightness state between full
|
68
|
+
# display sleep will use an intermediate half-brightness state between full
|
69
69
|
# brightness and fully off (value = 0/1)
|
70
70
|
'halfdim',
|
71
71
|
|
@@ -76,17 +76,17 @@ module StateMate::Adapters::PMSet
|
|
76
76
|
# change hibernation mode. Please use caution. (value = integer)
|
77
77
|
'hibernatemode',
|
78
78
|
|
79
|
-
# change hibernation image file location. Image may only be located on the
|
79
|
+
# change hibernation image file location. Image may only be located on the
|
80
80
|
# root volume. Please use caution. (value = path)
|
81
81
|
'hibernatefile',
|
82
82
|
|
83
|
-
# prevent idle system sleep when any tty (e.g. remote login session) is
|
84
|
-
# 'active'. A tty is 'inactive' only when its idle time exceeds the system
|
83
|
+
# prevent idle system sleep when any tty (e.g. remote login session) is
|
84
|
+
# 'active'. A tty is 'inactive' only when its idle time exceeds the system
|
85
85
|
# sleep timer. (value = 0/1)
|
86
|
-
'ttyskeepawake',
|
86
|
+
'ttyskeepawake',
|
87
87
|
|
88
|
-
# this setting affects how OS X networking presents shared network services
|
89
|
-
# during system sleep. This setting is not used by all platforms; changing
|
88
|
+
# this setting affects how OS X networking presents shared network services
|
89
|
+
# during system sleep. This setting is not used by all platforms; changing
|
90
90
|
# its value is unsupported.
|
91
91
|
#
|
92
92
|
# ...so we won't support it
|
@@ -98,12 +98,12 @@ module StateMate::Adapters::PMSet
|
|
98
98
|
# of standby mode.(value: 1 - Destroy, 0 - Retain)
|
99
99
|
'destroyfvkeyonstandby',
|
100
100
|
|
101
|
-
# Where supported, enabled per default as an implementation of Lot 6 to the
|
102
|
-
# European Energy-related Products Directive. After sleeping for
|
103
|
-
# <autopoweroffdelay> minutes, the system will write a hibernation image
|
101
|
+
# Where supported, enabled per default as an implementation of Lot 6 to the
|
102
|
+
# European Energy-related Products Directive. After sleeping for
|
103
|
+
# <autopoweroffdelay> minutes, the system will write a hibernation image
|
104
104
|
# and go into a lower power chipset sleep. Wakeups from this state will take
|
105
105
|
# longer than wakeups from regular sleep. The system will not auto power
|
106
|
-
# off if any external devices are connected, if the system is on battery
|
106
|
+
# off if any external devices are connected, if the system is on battery
|
107
107
|
# power, or if the system is bound to a network and wake for net-work
|
108
108
|
# network work access is enabled.
|
109
109
|
'autopoweroff',
|
@@ -116,14 +116,17 @@ module StateMate::Adapters::PMSet
|
|
116
116
|
# standby causes kernel power management to automatically hibernate a
|
117
117
|
# machine after it has slept for a specified time period. This saves power
|
118
118
|
# while asleep. This setting defaults to ON for supported hardware.
|
119
|
-
# The setting standby will be visible in pmset -g if the feature is
|
119
|
+
# The setting standby will be visible in pmset -g if the feature is
|
120
120
|
# supported on this machine.
|
121
121
|
#
|
122
122
|
# only works if hibernation is turned on to hibernatemode 3 or 25.
|
123
|
-
'standby',
|
123
|
+
'standby',
|
124
124
|
|
125
125
|
# specifies the delay, in seconds, before writing the hibernation image
|
126
126
|
# to disk and powering off memory for Standby.
|
127
|
+
#
|
128
|
+
# NOTE Not always present... at least not on Travis CI's OSX VMs
|
129
|
+
#
|
127
130
|
'standbydelay',
|
128
131
|
|
129
132
|
# UNDOCUMENTED ARGUMENTS
|
@@ -149,6 +152,7 @@ module StateMate::Adapters::PMSet
|
|
149
152
|
# `pmset -g custom`
|
150
153
|
SETTING_RE = /^\s(#{ SETTINGS.map {|_| Regexp.escape _ }.join '|' })\s+(.*)$/
|
151
154
|
|
155
|
+
|
152
156
|
# @api util
|
153
157
|
# *pure*
|
154
158
|
#
|
@@ -204,7 +208,7 @@ module StateMate::Adapters::PMSet
|
|
204
208
|
# halfdim 1
|
205
209
|
# disksleep 10
|
206
210
|
#
|
207
|
-
# @return [Hash<String, Hash<String, String>>] hash of section titles
|
211
|
+
# @return [Hash<String, Hash<String, String>>] hash of section titles
|
208
212
|
# (like "Battery Power") to hashes of string keys to *sting* values
|
209
213
|
# (does not turn numeric strings into integers).
|
210
214
|
def self.parse input
|
@@ -224,49 +228,60 @@ module StateMate::Adapters::PMSet
|
|
224
228
|
sections
|
225
229
|
end
|
226
230
|
|
231
|
+
|
227
232
|
# @api adapter
|
228
233
|
#
|
229
|
-
#
|
234
|
+
# Reads pm settings.
|
230
235
|
#
|
231
|
-
# @param
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
# ...},
|
241
|
-
# "AC Power"=>
|
242
|
-
# {"lidwake"=>"1",
|
243
|
-
# "autopoweroff"=>"1",
|
244
|
-
# ...}}
|
245
|
-
#
|
246
|
-
#
|
247
|
-
# - `[<mode>]` gets a hash of `{<setting> => <value>}` for that mode.
|
248
|
-
#
|
249
|
-
# `PMSet.read ["AC Power"]` looks something like:
|
250
|
-
#
|
236
|
+
# @param [Array<String>] key
|
237
|
+
# Key path to read:
|
238
|
+
#
|
239
|
+
# - `[]` gets everything, returning a hash
|
240
|
+
# `{<mode> => {<setting> => <value>}}`.
|
241
|
+
#
|
242
|
+
# `PMSet.read []` looks something like:
|
243
|
+
#
|
244
|
+
# {"Battery Power"=>
|
251
245
|
# {"lidwake"=>"1",
|
252
246
|
# "autopoweroff"=>"1",
|
253
|
-
# ...}
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
247
|
+
# ...},
|
248
|
+
# "AC Power"=>
|
249
|
+
# {"lidwake"=>"1",
|
250
|
+
# "autopoweroff"=>"1",
|
251
|
+
# ...}}
|
252
|
+
#
|
253
|
+
#
|
254
|
+
# - `[<mode>]` gets a hash of `{<setting> => <value>}` for that mode.
|
255
|
+
#
|
256
|
+
# `PMSet.read ["AC Power"]` looks something like:
|
257
|
+
#
|
258
|
+
# {"lidwake"=>"1",
|
259
|
+
# "autopoweroff"=>"1",
|
260
|
+
# ...}
|
261
|
+
#
|
262
|
+
# - `[<mode>, <setting>]` gets a string value.
|
263
|
+
#
|
264
|
+
# `PMSet.read ["AC Power", "lidwake"]` looks something like `"1"`
|
265
|
+
#
|
266
|
+
# In addition:
|
267
|
+
#
|
268
|
+
# - `<mode>` must be in the keys of {.MODES}
|
269
|
+
# - `<setting>` must be in {.SETTINGS}
|
270
|
+
#
|
271
|
+
# @param [Hash] options
|
272
|
+
# Unused (part of adapter `.read` method signature).
|
258
273
|
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
# - `<setting>` must be in {.SETTINGS}
|
274
|
+
# @return [Hash<String, Hash<String, String>>]
|
275
|
+
# Hash of everything when `key` is `[]`.
|
262
276
|
#
|
263
|
-
# @return [Hash<String,
|
264
|
-
#
|
265
|
-
# @return [Hash<String, String>] hash of values for mode when `key` is
|
266
|
-
# `[<mode>]`
|
267
|
-
# @return [String] value when `key` is `[<mode>, <setting>]`
|
277
|
+
# @return [Hash<String, String>]
|
278
|
+
# Hash of values for mode when `key` is `[<mode>]`.
|
268
279
|
#
|
269
|
-
# @
|
280
|
+
# @return [String]
|
281
|
+
# Value when `key` is `[<mode>, <setting>]`.
|
282
|
+
#
|
283
|
+
# @raise [ArgumentError]
|
284
|
+
# If the key is not found.
|
270
285
|
#
|
271
286
|
def self.read key, options = {}
|
272
287
|
# read all the settings.
|
@@ -289,6 +304,7 @@ module StateMate::Adapters::PMSet
|
|
289
304
|
value
|
290
305
|
end
|
291
306
|
|
307
|
+
|
292
308
|
# @api adapter
|
293
309
|
#
|
294
310
|
# writes pm settings.
|
data/lib/state_mate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_mate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nrser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ extra_rdoc_files: []
|
|
159
159
|
files:
|
160
160
|
- ".gitignore"
|
161
161
|
- ".rspec"
|
162
|
+
- ".travis.yml"
|
162
163
|
- ".yardopts"
|
163
164
|
- Gemfile
|
164
165
|
- LICENSE.txt
|