milk_maid 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/milk_maid +5 -0
- data/lib/{milkmaid → milk_maid}/batch.rb +1 -1
- data/lib/{milkmaid → milk_maid}/cli.rb +7 -7
- data/lib/{milkmaid → milk_maid}/console_notifier.rb +1 -1
- data/lib/{milkmaid → milk_maid}/firebase_notifier/batch_record.rb +2 -2
- data/lib/{milkmaid → milk_maid}/firebase_notifier.rb +3 -3
- data/lib/{milkmaid → milk_maid}/parse_notifier.rb +3 -3
- data/lib/{milkmaid → milk_maid}/remote_notifier/batch_record.rb +2 -2
- data/lib/{milkmaid → milk_maid}/temperature_sensor.rb +2 -2
- data/lib/milk_maid/version.rb +3 -0
- data/lib/milk_maid.rb +13 -0
- data/{milkmaid.gemspec → milk_maid.gemspec} +2 -2
- metadata +58 -62
- data/bin/console +0 -14
- data/bin/milkmaid +0 -5
- data/bin/setup +0 -7
- data/lib/milkmaid/version.rb +0 -3
- data/lib/milkmaid.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d22d7f7fbfeff5542f75ff130712c0c31c903582
|
4
|
+
data.tar.gz: 25262a33f15e665b6a650e1e6aa5d7d13d5fbdad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c99425376b2d6fe0410b9d0e2f86b3cd3af807eb9e0207ae7a619868f1412a8aecd1b596e1f37e07f4638f599c99caceb030833aaf7b16c75152f8e3b450d4
|
7
|
+
data.tar.gz: 4f0a939212d00d8f5768c482d3cdc77c0009ad84f3063fded04186407a85ef08d4d0092b3ec8791d0059f1dc561e78e42cdf5351ad3a8466690122a1c9f23e74
|
data/bin/milk_maid
ADDED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'thor'
|
2
2
|
|
3
|
-
module
|
3
|
+
module MilkMaid
|
4
4
|
class CLI < Thor
|
5
|
-
desc 'monitor_batch
|
5
|
+
desc 'monitor_batch', "Start Monitoring a batch"
|
6
6
|
long_desc <<-DESC
|
7
7
|
|
8
8
|
`monitor_batch BATCH_NAME` will create a batch called BATCH_NAME
|
@@ -23,24 +23,24 @@ module Milkmaid
|
|
23
23
|
|
24
24
|
sensor = get_sensor(sensor_type)
|
25
25
|
notifier = get_logger(logger_type)
|
26
|
-
batch = ::
|
26
|
+
batch = ::MilkMaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor)
|
27
27
|
|
28
28
|
batch.start
|
29
|
-
rescue ::
|
29
|
+
rescue ::MilkMaid::SensorException => e
|
30
30
|
puts e.message
|
31
31
|
end
|
32
32
|
|
33
33
|
no_commands do
|
34
34
|
def get_sensor(sensor_type)
|
35
|
-
sensor_type ? ::
|
35
|
+
sensor_type ? ::MilkMaid::TemperatureSensor.new : ::MilkMaid::MockTemperatureSensor.new(options[:temperature].to_i - 20, options[:temperature].to_i + 30)
|
36
36
|
end
|
37
37
|
|
38
38
|
def get_logger(logger_type)
|
39
39
|
case logger_type.upcase
|
40
40
|
when 'CONSOLE'
|
41
|
-
::
|
41
|
+
::MilkMaid::ConsoleNotifier.new
|
42
42
|
when 'WEB'
|
43
|
-
::
|
43
|
+
::MilkMaid::ParseNotifier.new
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'firebase'
|
2
2
|
require 'yaml'
|
3
3
|
|
4
|
-
module
|
4
|
+
module MilkMaid
|
5
5
|
module FirebaseNotifier
|
6
6
|
class BatchRecord
|
7
7
|
attr_accessor :name, :guid, :duration, :base_temperature, :batch_size, :status, :record
|
@@ -31,7 +31,7 @@ module Milkmaid
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def add_event(event_type, data = 0)
|
34
|
-
events << ::
|
34
|
+
events << ::MilkMaid::FirebaseNotifier::Event.new(event_name_from_type(event_type), data, timestamp)
|
35
35
|
return if cache_event(event_type)
|
36
36
|
send_events!
|
37
37
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
class FirebaseNotifier < ::
|
1
|
+
module MilkMaid
|
2
|
+
class FirebaseNotifier < ::MilkMaid::ConsoleNotifier
|
3
3
|
attr_accessor :batch_record
|
4
4
|
|
5
5
|
def batch_completed
|
@@ -9,7 +9,7 @@ module Milkmaid
|
|
9
9
|
|
10
10
|
def batch_started(batch_data = {})
|
11
11
|
super(batch_data)
|
12
|
-
batch_record = ::
|
12
|
+
batch_record = ::MilkMaid::FirebaseNotifier::BatchRecord.new(batch_data)
|
13
13
|
end
|
14
14
|
|
15
15
|
def log_temperature(temperature)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
class ParseNotifier < ::
|
1
|
+
module MilkMaid
|
2
|
+
class ParseNotifier < ::MilkMaid::ConsoleNotifier
|
3
3
|
attr_accessor :batch_record
|
4
4
|
|
5
5
|
def batch_completed
|
@@ -8,7 +8,7 @@ module Milkmaid
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def batch_record
|
11
|
-
@batch_record ||= ::
|
11
|
+
@batch_record ||= ::MilkMaid::FirebaseNotifier::BatchRecord.new
|
12
12
|
end
|
13
13
|
|
14
14
|
def batch_started(batch_data = {})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'parse-ruby-client'
|
2
2
|
|
3
|
-
module
|
3
|
+
module MilkMaid
|
4
4
|
module RemoteNotifier
|
5
5
|
class BatchRecord
|
6
6
|
attr_accessor :name, :guid, :duration, :base_temperature, :batch_size, :status, :record
|
@@ -31,7 +31,7 @@ module Milkmaid
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def add_event(event_type, data = 0)
|
34
|
-
events << ::
|
34
|
+
events << ::MilkMaid::RemoteNotifier::Event.new(name: event_name_from_type(event_type), data: data, timestamp: timestamp)
|
35
35
|
return if event_type == :temperature
|
36
36
|
send_events!
|
37
37
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'w1temp'
|
2
2
|
|
3
|
-
module
|
3
|
+
module MilkMaid
|
4
4
|
class SensorException < RuntimeError; end
|
5
5
|
|
6
6
|
class TemperatureSensor
|
7
7
|
def initialize
|
8
8
|
@sensor = Temperature.new
|
9
9
|
|
10
|
-
fail ::
|
10
|
+
fail ::MilkMaid::SensorException.new 'Sensor not available' unless @sensor.name
|
11
11
|
end
|
12
12
|
|
13
13
|
def name
|
data/lib/milk_maid.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'milk_maid/batch'
|
2
|
+
require 'milk_maid/cli'
|
3
|
+
require 'milk_maid/console_notifier'
|
4
|
+
require 'milk_maid/parse_notifier'
|
5
|
+
require 'milk_maid/remote_notifier/batch_record'
|
6
|
+
require 'milk_maid/firebase_notifier/batch_record'
|
7
|
+
require 'milk_maid/temperature_sensor'
|
8
|
+
require 'milk_maid/version'
|
9
|
+
|
10
|
+
CONFIG_DIR = File.join(File.dirname(__FILE__), '..', 'config')
|
11
|
+
|
12
|
+
module MilkMaid
|
13
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'milk_maid/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "milk_maid"
|
8
|
-
spec.version =
|
8
|
+
spec.version = MilkMaid::VERSION
|
9
9
|
spec.authors = ["Steve Newell"]
|
10
10
|
spec.email = ["steve.newell@mx.com"]
|
11
11
|
|
metadata
CHANGED
@@ -1,181 +1,177 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milk_maid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Newell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: thor
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- -
|
16
|
+
- - '>='
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '0'
|
20
|
-
|
19
|
+
name: thor
|
21
20
|
prerelease: false
|
21
|
+
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: w1temp
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
|
-
- -
|
30
|
+
- - '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
|
-
|
33
|
+
name: w1temp
|
35
34
|
prerelease: false
|
35
|
+
type: :runtime
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: parse-ruby-client
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
|
-
- -
|
44
|
+
- - '>='
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '0'
|
48
|
-
|
47
|
+
name: parse-ruby-client
|
49
48
|
prerelease: false
|
49
|
+
type: :runtime
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: firebase
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
|
-
- -
|
58
|
+
- - '>='
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
62
|
-
|
61
|
+
name: firebase
|
63
62
|
prerelease: false
|
63
|
+
type: :runtime
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: bundler
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
72
71
|
requirements:
|
73
|
-
- -
|
72
|
+
- - ~>
|
74
73
|
- !ruby/object:Gem::Version
|
75
74
|
version: '1.10'
|
76
|
-
|
75
|
+
name: bundler
|
77
76
|
prerelease: false
|
77
|
+
type: :development
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.10'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
86
85
|
requirements:
|
87
|
-
- -
|
86
|
+
- - ~>
|
88
87
|
- !ruby/object:Gem::Version
|
89
88
|
version: '10.0'
|
90
|
-
|
89
|
+
name: rake
|
91
90
|
prerelease: false
|
91
|
+
type: :development
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '10.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
99
98
|
requirement: !ruby/object:Gem::Requirement
|
100
99
|
requirements:
|
101
|
-
- -
|
100
|
+
- - '>='
|
102
101
|
- !ruby/object:Gem::Version
|
103
102
|
version: '0'
|
104
|
-
|
103
|
+
name: rspec
|
105
104
|
prerelease: false
|
105
|
+
type: :development
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard-rspec
|
113
112
|
requirement: !ruby/object:Gem::Requirement
|
114
113
|
requirements:
|
115
|
-
- -
|
114
|
+
- - '>='
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: '0'
|
118
|
-
|
117
|
+
name: guard-rspec
|
119
118
|
prerelease: false
|
119
|
+
type: :development
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Reads data from Raspberry PI sensor and posts to Firebase
|
126
126
|
email:
|
127
127
|
- steve.newell@mx.com
|
128
128
|
executables:
|
129
|
-
-
|
130
|
-
- milkmaid
|
131
|
-
- setup
|
129
|
+
- milk_maid
|
132
130
|
extensions: []
|
133
131
|
extra_rdoc_files: []
|
134
132
|
files:
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
133
|
+
- .gitignore
|
134
|
+
- .rspec
|
135
|
+
- .ruby-version
|
136
|
+
- .travis.yml
|
139
137
|
- Gemfile
|
140
138
|
- README.md
|
141
139
|
- Rakefile
|
142
|
-
- bin/
|
143
|
-
- bin/milkmaid
|
144
|
-
- bin/setup
|
140
|
+
- bin/milk_maid
|
145
141
|
- config/firebase.yml.sample
|
146
|
-
- lib/
|
147
|
-
- lib/
|
148
|
-
- lib/
|
149
|
-
- lib/
|
150
|
-
- lib/
|
151
|
-
- lib/
|
152
|
-
- lib/
|
153
|
-
- lib/
|
154
|
-
- lib/
|
155
|
-
- lib/
|
156
|
-
-
|
157
|
-
homepage:
|
142
|
+
- lib/milk_maid.rb
|
143
|
+
- lib/milk_maid/batch.rb
|
144
|
+
- lib/milk_maid/cli.rb
|
145
|
+
- lib/milk_maid/console_notifier.rb
|
146
|
+
- lib/milk_maid/firebase_notifier.rb
|
147
|
+
- lib/milk_maid/firebase_notifier/batch_record.rb
|
148
|
+
- lib/milk_maid/parse_notifier.rb
|
149
|
+
- lib/milk_maid/remote_notifier/batch_record.rb
|
150
|
+
- lib/milk_maid/temperature_sensor.rb
|
151
|
+
- lib/milk_maid/version.rb
|
152
|
+
- milk_maid.gemspec
|
153
|
+
homepage:
|
158
154
|
licenses: []
|
159
155
|
metadata:
|
160
156
|
allowed_push_host: https://rubygems.org
|
161
|
-
post_install_message:
|
157
|
+
post_install_message:
|
162
158
|
rdoc_options: []
|
163
159
|
require_paths:
|
164
160
|
- lib
|
165
161
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
162
|
requirements:
|
167
|
-
- -
|
163
|
+
- - '>='
|
168
164
|
- !ruby/object:Gem::Version
|
169
165
|
version: '0'
|
170
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
167
|
requirements:
|
172
|
-
- -
|
168
|
+
- - '>='
|
173
169
|
- !ruby/object:Gem::Version
|
174
170
|
version: '0'
|
175
171
|
requirements: []
|
176
|
-
rubyforge_project:
|
177
|
-
rubygems_version: 2.4.
|
178
|
-
signing_key:
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.4.8
|
174
|
+
signing_key:
|
179
175
|
specification_version: 4
|
180
176
|
summary: Reads data from Raspberry PI sensor and posts to Firebase
|
181
177
|
test_files: []
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "milkmaid"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/milkmaid
DELETED
data/bin/setup
DELETED
data/lib/milkmaid/version.rb
DELETED
data/lib/milkmaid.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'milkmaid/batch'
|
2
|
-
require 'milkmaid/cli'
|
3
|
-
require 'milkmaid/console_notifier'
|
4
|
-
require 'milkmaid/parse_notifier'
|
5
|
-
require 'milkmaid/remote_notifier/batch_record'
|
6
|
-
require 'milkmaid/firebase_notifier/batch_record'
|
7
|
-
require 'milkmaid/temperature_sensor'
|
8
|
-
require 'milkmaid/version'
|
9
|
-
|
10
|
-
CONFIG_DIR = File.join(File.dirname(__FILE__), '..', 'config')
|
11
|
-
|
12
|
-
module Milkmaid
|
13
|
-
end
|