freezerwatch 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c505476d0fd6b0cb7e1cad8982e8b39a6da75ab1
4
- data.tar.gz: 2e38824c54b16044e6a713c960dbce2ff14549d6
3
+ metadata.gz: 864aa6af31496d130a51488b604a4fa1c993c7ca
4
+ data.tar.gz: 74c4de0a1b7204cbc1ab3d9f1afb3761f3b326ce
5
5
  SHA512:
6
- metadata.gz: 49799a30430a97991c4e6c339b99cd738a9fd2bf2345391b0d90bfe251cc272c4ae4e8592c3dd3a34ae460735df7cb49058008cfc02def464f4c2d684d8fe247
7
- data.tar.gz: 9afef417c841e59beed38041cac553f1ac6cc4f3323fe85c5a249c1f7ae226d09fef6167062469fa198bf774f7515d27fa9ec5a98f83b59fb9c49f8ea4ccc497
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.
@@ -0,0 +1,8 @@
1
+ test:
2
+ override:
3
+ - 'true' # no tests for now
4
+ dependencies:
5
+ pre:
6
+ - gem install bundler --pre
7
+
8
+
@@ -1,3 +1,3 @@
1
1
  module Freezerwatch
2
- VERSION = "0.1.2"
2
+ VERSION = '0.2.0'
3
3
  end
@@ -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', 'utf8'));
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', 'Report on liveness of the sensor system. Returns 0 exit code if all sensors are reading within the last day and have full batteries.'],
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 STRING', '--device STRING', "Which device to monitor--specify this argument multiple times to monitor multiple devices. You can find device IDs by logging into lacrossealerts.com/login and looking at the link that your 'Download' button points to."],
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 = "Usage: freezerwatch --live --device=\"123\" --device=\"456\" --device=\"789\"";
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
- everythingIsLive = result.map(isLive).reduce(function(everythingElseLive, thisItemLive) {
121
- return everythingElseLive && thisItemLive;
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
@@ -0,0 +1,5 @@
1
+ FROM node
2
+ MAINTAINER apiology
3
+ RUN npm install -g freezerwatch
4
+ ADD ~/private/freezerwatch.json /root/private/freezerwatch.json
5
+ CMD ["freezerwatch", "-d", "your-id-here", "-d", "and-maybe-another"]
@@ -23,7 +23,7 @@ Usage
23
23
  npm install freezerwatch
24
24
 
25
25
  ```sh
26
- if freezerwatch --live --device="123" --device="456" --device="789"
26
+ if freezerwatch --live --device "123" --device "456" --device "789"
27
27
  then
28
28
  echo "All monitoring is live and working!"
29
29
  else
@@ -7,7 +7,7 @@ Quality::Rake::Task.new do |t|
7
7
  #
8
8
  # extra_files are assumed to be Ruby files, for starters
9
9
  t.extra_files = ['*.js', 'Rakefile']
10
- t.skip_tools = %w(rubocop reek flog)
10
+ t.skip_tools = %w(rubocop reek flog flay)
11
11
  end
12
12
 
13
13
  task default: :quality
@@ -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', 'utf8'));
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', 'Report on liveness of the sensor system. Returns 0 exit code if all sensors are reading within the last day and have full batteries.'],
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 STRING', '--device STRING', "Which device to monitor--specify this argument multiple times to monitor multiple devices. You can find device IDs by logging into lacrossealerts.com/login and looking at the link that your 'Download' button points to."],
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 = "Usage: freezerwatch --live --device=\"123\" --device=\"456\" --device=\"789\"";
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
- everythingIsLive = result.map(isLive).reduce(function(everythingElseLive, thisItemLive) {
121
- return everythingElseLive && thisItemLive;
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
@@ -15,7 +15,7 @@ function homedir() {
15
15
  }
16
16
 
17
17
  if (process.platform === 'linux') {
18
- return home || (user ? (process.getuid() === 0 ? '/root' : '/home/' + user) : null);
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.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": "git+https://github.com/sindresorhus/os-homedir.git"
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": "7e39e2e049de404f06233fa617ecf46fed997a78",
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.0",
49
- "_shasum": "e37078bc61b5869063053897257e39ec1261b702",
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.1",
52
- "_nodeVersion": "2.3.0",
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": "e37078bc61b5869063053897257e39ec1261b702",
59
- "tarball": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.0.tgz"
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.0.tgz",
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.1",
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=\"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",
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": "16c4d584b8d900b2d1f3543a2df7d6172e60f3fa",
33
- "_id": "freezerwatch@0.0.1",
32
+ "gitHead": "cc624f3db47677c2a29b0258db0244bec1de3fef",
33
+ "_id": "freezerwatch@0.0.2",
34
34
  "scripts": {},
35
- "_shasum": "956c25dd75fec6d629f2243a75f5b1040b611c94",
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.1.2
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-09 00:00:00.000000000 Z
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