milk_maid 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/milk_maid/batch.rb +2 -4
- data/lib/milk_maid/cli.rb +4 -2
- data/lib/milk_maid/firebase_notifier/batch_record.rb +0 -1
- data/lib/milk_maid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b45e70eb0370ee7850e58e83a61752f20f7a960
|
4
|
+
data.tar.gz: 4b25bcc182eee39aea18b1b1a60edf950da5c448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8fc7c39eb5d1561dab24f6626d3f86916bf74ca2961b18834d6303c091632412868f150559685b37f2239c319c1c2a00f52f68e0474e59f8f8d2f912336ef8
|
7
|
+
data.tar.gz: e860a9a2ad60ad402040a9459884d7650f96f198324b99b1de2824cd4c62af801268319c5fe87e4cf99dcc4b82c705cb7b566b1f73c0c586533ebd3e9719f0c8
|
data/lib/milk_maid/batch.rb
CHANGED
@@ -2,9 +2,7 @@ require 'securerandom'
|
|
2
2
|
|
3
3
|
module MilkMaid
|
4
4
|
class Batch
|
5
|
-
attr_accessor :name, :batch_guid, :temperature, :duration, :size, :notifier, :sensor
|
6
|
-
|
7
|
-
NAP_TIME = 5
|
5
|
+
attr_accessor :name, :batch_guid, :temperature, :duration, :size, :notifier, :sensor, :nap_time
|
8
6
|
|
9
7
|
def initialize(options = {})
|
10
8
|
options.each { |key, value| send("#{key}=", value) }
|
@@ -47,7 +45,7 @@ module MilkMaid
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def take_a_nap
|
50
|
-
sleep
|
48
|
+
sleep nap_time
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
data/lib/milk_maid/cli.rb
CHANGED
@@ -14,16 +14,18 @@ module MilkMaid
|
|
14
14
|
option :duration, :type => :numeric, :required => false, :default => 30, :aliases => '-d'
|
15
15
|
option :logger, :type => :string, :required => false, :default => 'Console', :aliases => '-l'
|
16
16
|
option :sensor, :type => :boolean, :required => false, :default => true, :aliases => '-s'
|
17
|
+
option :nap, :type => :numeric, :required => false, :default => 5, :aliases => '-n'
|
17
18
|
def monitor_batch
|
18
19
|
batch_name = options.fetch(:batch_name, default_batch_name)
|
19
20
|
temperature = options[:temperature].to_i
|
20
|
-
duration = options[:duration].to_i
|
21
|
+
duration = options[:duration].to_i * 60
|
21
22
|
logger_type = options[:logger]
|
22
23
|
sensor_type = options[:sensor]
|
24
|
+
nap_time = options[:nap].to_i
|
23
25
|
|
24
26
|
sensor = get_sensor(sensor_type)
|
25
27
|
notifier = get_logger(logger_type)
|
26
|
-
batch = ::MilkMaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor)
|
28
|
+
batch = ::MilkMaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor, nap_time: nap_time)
|
27
29
|
|
28
30
|
batch.start
|
29
31
|
rescue ::MilkMaid::SensorException => e
|
data/lib/milk_maid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milk_maid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Newell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|