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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33a6d723a5681ed0a09d2dd811cbb81bed6e59cf
4
- data.tar.gz: 0736df68f79f62ca94beb0e8f614e4461952efb2
3
+ metadata.gz: 4b45e70eb0370ee7850e58e83a61752f20f7a960
4
+ data.tar.gz: 4b25bcc182eee39aea18b1b1a60edf950da5c448
5
5
  SHA512:
6
- metadata.gz: deb4cb3f62e2861aef25e6191686c3a0af9ba1418af18f1c4ac0227edaae40a05276b00e363027abdc4e1dee0640edcfbfd17e0f20ace442c94b8aca4be1d380
7
- data.tar.gz: 77b6ab9c9c650d340d4d1db2f721ea8dc73ca1d0434baa0dce8920a942664144ac99a02e21da4a8ba018faede8dcead0a56ec9c305fd95cf80570e2464e3f1a6
6
+ metadata.gz: 5b8fc7c39eb5d1561dab24f6626d3f86916bf74ca2961b18834d6303c091632412868f150559685b37f2239c319c1c2a00f52f68e0474e59f8f8d2f912336ef8
7
+ data.tar.gz: e860a9a2ad60ad402040a9459884d7650f96f198324b99b1de2824cd4c62af801268319c5fe87e4cf99dcc4b82c705cb7b566b1f73c0c586533ebd3e9719f0c8
@@ -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 NAP_TIME
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
@@ -1,5 +1,4 @@
1
1
  require 'firebase'
2
- require 'pry'
3
2
  require 'yaml'
4
3
 
5
4
  module MilkMaid
@@ -1,3 +1,3 @@
1
1
  module MilkMaid
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-07-30 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor