freezerwatch 0.1.2 → 0.2.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 +4 -4
- data/README.md +12 -0
- data/circle.yml +8 -0
- data/lib/freezerwatch/version.rb +1 -1
- data/node_modules/.bin/freezerwatch +29 -10
- data/node_modules/freezerwatch/Dockerfile +5 -0
- data/node_modules/freezerwatch/README.md +1 -1
- data/node_modules/freezerwatch/Rakefile +1 -1
- data/node_modules/freezerwatch/freezerwatch.js +29 -10
- data/node_modules/freezerwatch/metrics/bigfiles_high_water_mark +1 -1
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/index.js +1 -1
- data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/package.json +10 -11
- data/node_modules/freezerwatch/package.json +6 -6
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 864aa6af31496d130a51488b604a4fa1c993c7ca
|
4
|
+
data.tar.gz: 74c4de0a1b7204cbc1ab3d9f1afb3761f3b326ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2555abc832ed62c4da0a544ac63e5ac9696a3c0a7490fb012e53da62812fd01ba902dd3dc91f1f24069fad099e0db51d0ad66b45f4072ddf049f7a86fc86d703
|
7
|
+
data.tar.gz: 942bab6d104b66dce6faa44e12873019dc8b31e4f4fb27dd6112a8e70f80942b90b716d0b379158ab1de169968241d6e337779fcd3e7e3b94b3cec0c70dd4f49
|
data/README.md
CHANGED
@@ -34,8 +34,20 @@ Thanks to this post, which made this a relatively painless operation: http://mok
|
|
34
34
|
|
35
35
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
36
|
|
37
|
+
To update the node module, run 'npm update freezerwatch'.
|
38
|
+
|
37
39
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
40
|
|
41
|
+
## Releasing (maintainers)
|
42
|
+
|
43
|
+
Check in changes.
|
44
|
+
|
45
|
+
Update lib/freezerwatch/version.rb, bearing in mind semver.org.
|
46
|
+
|
47
|
+
git commit -m "Prepare release" lib/freezerwatch/version.rb
|
48
|
+
|
49
|
+
rake release
|
50
|
+
|
39
51
|
## Contributing
|
40
52
|
|
41
53
|
Bug reports and pull requests are welcome on GitHub at https://github.com/apiology/freezerwatch-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
data/circle.yml
ADDED
data/lib/freezerwatch/version.rb
CHANGED
@@ -8,7 +8,8 @@ var osenv = require('osenv');
|
|
8
8
|
|
9
9
|
var homedir = osenv.home();
|
10
10
|
|
11
|
-
var config = JSON.parse(fs.readFileSync(homedir + '/private/freezerwatch.json',
|
11
|
+
var config = JSON.parse(fs.readFileSync(homedir + '/private/freezerwatch.json',
|
12
|
+
'utf8'));
|
12
13
|
|
13
14
|
var client = new lacrosse.Client(config);
|
14
15
|
|
@@ -34,15 +35,24 @@ function parseDeviceIds() {
|
|
34
35
|
var mode;
|
35
36
|
var switches = [
|
36
37
|
['-h', '--help', 'Shows help sections'],
|
37
|
-
['-l', '--live',
|
38
|
+
['-l', '--live',
|
39
|
+
'Report on liveness of the sensor system. ' +
|
40
|
+
'Returns 0 exit code if all sensors are reading ' +
|
41
|
+
'within the last day and have full batteries.'],
|
38
42
|
['-v', '--verbose', 'Report debugging information.'],
|
39
|
-
['-d
|
43
|
+
['-d', '--device STRING',
|
44
|
+
"Which device to monitor--specify this argument multiple times to " +
|
45
|
+
"monitor multiple devices. You can find device IDs by logging into " +
|
46
|
+
"lacrossealerts.com/login and looking at the link that your " +
|
47
|
+
"'Download' button points to."],
|
40
48
|
];
|
41
49
|
|
42
50
|
// Create a new OptionParser.
|
43
51
|
var parser = new optparse.OptionParser(switches);
|
44
52
|
|
45
|
-
parser.banner =
|
53
|
+
parser.banner =
|
54
|
+
"Usage: freezerwatch --live " +
|
55
|
+
"--device \"123\" --device \"456\" --device \"789\"";
|
46
56
|
|
47
57
|
var help = parser.toString();
|
48
58
|
|
@@ -72,6 +82,13 @@ function parseDeviceIds() {
|
|
72
82
|
|
73
83
|
var options = parseDeviceIds(process.argv);
|
74
84
|
|
85
|
+
debug("options is " + JSON.stringify(options));
|
86
|
+
debug("deviceIds is " + JSON.stringify(options.deviceIds));
|
87
|
+
|
88
|
+
if (options.deviceIds.length == 0) {
|
89
|
+
usage(options.help, 1);
|
90
|
+
}
|
91
|
+
|
75
92
|
if (!options.mode) {
|
76
93
|
usage(options.help, 1);
|
77
94
|
}
|
@@ -94,6 +111,8 @@ function isLive(reading) {
|
|
94
111
|
!reading.lowBattery;
|
95
112
|
}
|
96
113
|
|
114
|
+
debug("Device IDs is " + options.deviceIds);
|
115
|
+
|
97
116
|
async.map(options.deviceIds,
|
98
117
|
function(deviceId, cb) {
|
99
118
|
debug("Pulling data for " + deviceId);
|
@@ -117,9 +136,11 @@ async.map(options.deviceIds,
|
|
117
136
|
throw err;
|
118
137
|
} else {
|
119
138
|
debug("result is " + JSON.stringify(result));
|
120
|
-
|
121
|
-
|
122
|
-
|
139
|
+
debug("err is " + JSON.stringify(err));
|
140
|
+
everythingIsLive = result.map(isLive)
|
141
|
+
.reduce(function(everythingElseLive, thisItemLive) {
|
142
|
+
return everythingElseLive && thisItemLive;
|
143
|
+
});
|
123
144
|
if (everythingIsLive) {
|
124
145
|
process.exit(0);
|
125
146
|
} else {
|
@@ -132,8 +153,6 @@ async.map(options.deviceIds,
|
|
132
153
|
|
133
154
|
// XXX: Brainstorm errors to handle, add (manual) tests
|
134
155
|
|
135
|
-
// XXX: Crib style hints from optparse
|
136
|
-
|
137
156
|
// XXX: get gulp-file with node-quality to replace Rakefile with Quality
|
138
157
|
|
139
|
-
// XXX: Figure out style help tool
|
158
|
+
// XXX: Figure out style help tool
|
@@ -8,7 +8,8 @@ var osenv = require('osenv');
|
|
8
8
|
|
9
9
|
var homedir = osenv.home();
|
10
10
|
|
11
|
-
var config = JSON.parse(fs.readFileSync(homedir + '/private/freezerwatch.json',
|
11
|
+
var config = JSON.parse(fs.readFileSync(homedir + '/private/freezerwatch.json',
|
12
|
+
'utf8'));
|
12
13
|
|
13
14
|
var client = new lacrosse.Client(config);
|
14
15
|
|
@@ -34,15 +35,24 @@ function parseDeviceIds() {
|
|
34
35
|
var mode;
|
35
36
|
var switches = [
|
36
37
|
['-h', '--help', 'Shows help sections'],
|
37
|
-
['-l', '--live',
|
38
|
+
['-l', '--live',
|
39
|
+
'Report on liveness of the sensor system. ' +
|
40
|
+
'Returns 0 exit code if all sensors are reading ' +
|
41
|
+
'within the last day and have full batteries.'],
|
38
42
|
['-v', '--verbose', 'Report debugging information.'],
|
39
|
-
['-d
|
43
|
+
['-d', '--device STRING',
|
44
|
+
"Which device to monitor--specify this argument multiple times to " +
|
45
|
+
"monitor multiple devices. You can find device IDs by logging into " +
|
46
|
+
"lacrossealerts.com/login and looking at the link that your " +
|
47
|
+
"'Download' button points to."],
|
40
48
|
];
|
41
49
|
|
42
50
|
// Create a new OptionParser.
|
43
51
|
var parser = new optparse.OptionParser(switches);
|
44
52
|
|
45
|
-
parser.banner =
|
53
|
+
parser.banner =
|
54
|
+
"Usage: freezerwatch --live " +
|
55
|
+
"--device \"123\" --device \"456\" --device \"789\"";
|
46
56
|
|
47
57
|
var help = parser.toString();
|
48
58
|
|
@@ -72,6 +82,13 @@ function parseDeviceIds() {
|
|
72
82
|
|
73
83
|
var options = parseDeviceIds(process.argv);
|
74
84
|
|
85
|
+
debug("options is " + JSON.stringify(options));
|
86
|
+
debug("deviceIds is " + JSON.stringify(options.deviceIds));
|
87
|
+
|
88
|
+
if (options.deviceIds.length == 0) {
|
89
|
+
usage(options.help, 1);
|
90
|
+
}
|
91
|
+
|
75
92
|
if (!options.mode) {
|
76
93
|
usage(options.help, 1);
|
77
94
|
}
|
@@ -94,6 +111,8 @@ function isLive(reading) {
|
|
94
111
|
!reading.lowBattery;
|
95
112
|
}
|
96
113
|
|
114
|
+
debug("Device IDs is " + options.deviceIds);
|
115
|
+
|
97
116
|
async.map(options.deviceIds,
|
98
117
|
function(deviceId, cb) {
|
99
118
|
debug("Pulling data for " + deviceId);
|
@@ -117,9 +136,11 @@ async.map(options.deviceIds,
|
|
117
136
|
throw err;
|
118
137
|
} else {
|
119
138
|
debug("result is " + JSON.stringify(result));
|
120
|
-
|
121
|
-
|
122
|
-
|
139
|
+
debug("err is " + JSON.stringify(err));
|
140
|
+
everythingIsLive = result.map(isLive)
|
141
|
+
.reduce(function(everythingElseLive, thisItemLive) {
|
142
|
+
return everythingElseLive && thisItemLive;
|
143
|
+
});
|
123
144
|
if (everythingIsLive) {
|
124
145
|
process.exit(0);
|
125
146
|
} else {
|
@@ -132,8 +153,6 @@ async.map(options.deviceIds,
|
|
132
153
|
|
133
154
|
// XXX: Brainstorm errors to handle, add (manual) tests
|
134
155
|
|
135
|
-
// XXX: Crib style hints from optparse
|
136
|
-
|
137
156
|
// XXX: get gulp-file with node-quality to replace Rakefile with Quality
|
138
157
|
|
139
|
-
// XXX: Figure out style help tool
|
158
|
+
// XXX: Figure out style help tool
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
300
|
@@ -15,7 +15,7 @@ function homedir() {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
if (process.platform === 'linux') {
|
18
|
-
return home || (
|
18
|
+
return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null));
|
19
19
|
}
|
20
20
|
|
21
21
|
return home || null;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "os-homedir",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
4
|
"description": "io.js 2.3.0 os.homedir() ponyfill",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
8
|
-
"url": "
|
8
|
+
"url": "https://github.com/sindresorhus/os-homedir"
|
9
9
|
},
|
10
10
|
"author": {
|
11
11
|
"name": "Sindre Sorhus",
|
@@ -40,23 +40,23 @@
|
|
40
40
|
"ava": "0.0.4",
|
41
41
|
"path-exists": "^1.0.0"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "13ff83fbd13ebe286a6092286b2c634ab4534c5f",
|
44
44
|
"bugs": {
|
45
45
|
"url": "https://github.com/sindresorhus/os-homedir/issues"
|
46
46
|
},
|
47
47
|
"homepage": "https://github.com/sindresorhus/os-homedir",
|
48
|
-
"_id": "os-homedir@1.0.
|
49
|
-
"_shasum": "
|
48
|
+
"_id": "os-homedir@1.0.1",
|
49
|
+
"_shasum": "0d62bdf44b916fd3bbdcf2cab191948fb094f007",
|
50
50
|
"_from": "os-homedir@>=1.0.0 <2.0.0",
|
51
|
-
"_npmVersion": "2.11.
|
52
|
-
"_nodeVersion": "
|
51
|
+
"_npmVersion": "2.11.2",
|
52
|
+
"_nodeVersion": "0.12.5",
|
53
53
|
"_npmUser": {
|
54
54
|
"name": "sindresorhus",
|
55
55
|
"email": "sindresorhus@gmail.com"
|
56
56
|
},
|
57
57
|
"dist": {
|
58
|
-
"shasum": "
|
59
|
-
"tarball": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.
|
58
|
+
"shasum": "0d62bdf44b916fd3bbdcf2cab191948fb094f007",
|
59
|
+
"tarball": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz"
|
60
60
|
},
|
61
61
|
"maintainers": [
|
62
62
|
{
|
@@ -65,6 +65,5 @@
|
|
65
65
|
}
|
66
66
|
],
|
67
67
|
"directories": {},
|
68
|
-
"_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.
|
69
|
-
"readme": "ERROR: No README data found!"
|
68
|
+
"_resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz"
|
70
69
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "freezerwatch",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.2",
|
4
4
|
"description": "Checks whether Lacrosse Alert sensors are giving data",
|
5
5
|
"preferGlobal": true,
|
6
6
|
"bin": {
|
@@ -27,11 +27,11 @@
|
|
27
27
|
"async": "~1.2",
|
28
28
|
"osenv": "~0.1"
|
29
29
|
},
|
30
|
-
"readme": "freezerwatch\n============\n\nWant to monitor a fridge/freezer and make sure the door isn't left open or it doesn't die or lose power? La Crosse Technology sells alarms that do that.\n\nWant a quick command-line way to make sure those alarms are up and working? This utility can help.\n\nThe --live option will exit with a zero status if all of the devices you passed in are found and registered, we have readings within te last day, and all devices have adequate battery.\n\nConfig\n------\n\nCreate a file called freezerwatch.json with the login information you use for lacrossealerts.com:\n```json\n{\n \"username\": \"my@email.com\",\n \"password\": \"my_password\"\n}\n```\n\nUsage\n-----\nnpm install freezerwatch\n\n```sh\nif freezerwatch --live --device
|
30
|
+
"readme": "freezerwatch\n============\n\nWant to monitor a fridge/freezer and make sure the door isn't left open or it doesn't die or lose power? La Crosse Technology sells alarms that do that.\n\nWant a quick command-line way to make sure those alarms are up and working? This utility can help.\n\nThe --live option will exit with a zero status if all of the devices you passed in are found and registered, we have readings within te last day, and all devices have adequate battery.\n\nConfig\n------\n\nCreate a file called freezerwatch.json with the login information you use for lacrossealerts.com:\n```json\n{\n \"username\": \"my@email.com\",\n \"password\": \"my_password\"\n}\n```\n\nUsage\n-----\nnpm install freezerwatch\n\n```sh\nif freezerwatch --live --device \"123\" --device \"456\" --device \"789\"\nthen\n echo \"All monitoring is live and working!\"\nelse\n echo \"Check your sensors!\"\nfi\n```\n\nDevice IDs\n----------\n\nYou can find device IDs by logging into lacrossealerts.com/login and looking at the link that your 'Download' button points to.\n\nNote\n----\nLa Crosse Technology and La Crosse Alerts are registered trademarks of La Crosse Technology Ltd. I use their products but am not employed by or connected to them in any other way.\n",
|
31
31
|
"readmeFilename": "README.md",
|
32
|
-
"gitHead": "
|
33
|
-
"_id": "freezerwatch@0.0.
|
32
|
+
"gitHead": "cc624f3db47677c2a29b0258db0244bec1de3fef",
|
33
|
+
"_id": "freezerwatch@0.0.2",
|
34
34
|
"scripts": {},
|
35
|
-
"_shasum": "
|
36
|
-
"_from": "freezerwatch
|
35
|
+
"_shasum": "e0e35733b1bf1b25c612876c75714c834d1b1cf9",
|
36
|
+
"_from": "freezerwatch@0.0.2"
|
37
37
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freezerwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- Rakefile
|
55
55
|
- bin/console
|
56
56
|
- bin/setup
|
57
|
+
- circle.yml
|
57
58
|
- exe/freezerwatch
|
58
59
|
- freezerwatch.gemspec
|
59
60
|
- lib/freezerwatch.rb
|
@@ -61,6 +62,7 @@ files:
|
|
61
62
|
- node_modules/.bin/freezerwatch
|
62
63
|
- node_modules/freezerwatch/.npmignore
|
63
64
|
- node_modules/freezerwatch/.ruby-version
|
65
|
+
- node_modules/freezerwatch/Dockerfile
|
64
66
|
- node_modules/freezerwatch/Gemfile
|
65
67
|
- node_modules/freezerwatch/Gemfile.lock
|
66
68
|
- node_modules/freezerwatch/LICENSE
|