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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60b61c742362d8e47611594ae8d749eb21c0e196
4
- data.tar.gz: e30619de06cb423bfb20929b45b6e39a2d45086d
3
+ metadata.gz: d22d7f7fbfeff5542f75ff130712c0c31c903582
4
+ data.tar.gz: 25262a33f15e665b6a650e1e6aa5d7d13d5fbdad
5
5
  SHA512:
6
- metadata.gz: fc59278709740c167a7e3167586b02b5d2829ae33f92f3699dc1d897b23363a47bec834e7cb2c9002c7a2811c98873b46a8c57224c3c6c72c3572c2d7f351cd5
7
- data.tar.gz: 9ee3ce7b156b4902cd29abd5ca0327571666f3256619ae9cfd3b68af6087643ed850e6d6f39655013e225a5ec92e68bb163ad9fbd3ea6b3cd6bb5c9aaa4bb362
6
+ metadata.gz: e2c99425376b2d6fe0410b9d0e2f86b3cd3af807eb9e0207ae7a619868f1412a8aecd1b596e1f37e07f4638f599c99caceb030833aaf7b16c75152f8e3b450d4
7
+ data.tar.gz: 4f0a939212d00d8f5768c482d3cdc77c0009ad84f3063fded04186407a85ef08d4d0092b3ec8791d0059f1dc561e78e42cdf5351ad3a8466690122a1c9f23e74
data/bin/milk_maid ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'milk_maid'
4
+
5
+ MilkMaid::CLI.start( ARGV )
@@ -1,4 +1,4 @@
1
- module Milkmaid
1
+ module MilkMaid
2
2
  class Batch
3
3
  attr_accessor :name, :batch_guid, :temperature, :duration, :size, :notifier, :sensor
4
4
 
@@ -1,8 +1,8 @@
1
1
  require 'thor'
2
2
 
3
- module Milkmaid
3
+ module MilkMaid
4
4
  class CLI < Thor
5
- desc 'monitor_batch BATCH_NAME', "Start Monitoring a 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 = ::Milkmaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor)
26
+ batch = ::MilkMaid::Batch.new(name: batch_name, temperature: temperature, duration: duration, notifier: notifier, sensor: sensor)
27
27
 
28
28
  batch.start
29
- rescue ::Milkmaid::SensorException => e
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 ? ::Milkmaid::TemperatureSensor.new : ::Milkmaid::MockTemperatureSensor.new(options[:temperature].to_i - 20, options[:temperature].to_i + 30)
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
- ::Milkmaid::ConsoleNotifier.new
41
+ ::MilkMaid::ConsoleNotifier.new
42
42
  when 'WEB'
43
- ::Milkmaid::ParseNotifier.new
43
+ ::MilkMaid::ParseNotifier.new
44
44
  end
45
45
  end
46
46
  end
@@ -1,4 +1,4 @@
1
- module Milkmaid
1
+ module MilkMaid
2
2
  class ConsoleNotifier
3
3
  def batch_completed
4
4
  puts "#{Time.now} - Batch Completed"
@@ -1,7 +1,7 @@
1
1
  require 'firebase'
2
2
  require 'yaml'
3
3
 
4
- module Milkmaid
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 << ::Milkmaid::FirebaseNotifier::Event.new(event_name_from_type(event_type), data, timestamp)
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 Milkmaid
2
- class FirebaseNotifier < ::Milkmaid::ConsoleNotifier
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 = ::Milkmaid::FirebaseNotifier::BatchRecord.new(batch_data)
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 Milkmaid
2
- class ParseNotifier < ::Milkmaid::ConsoleNotifier
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 ||= ::Milkmaid::FirebaseNotifier::BatchRecord.new
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 Milkmaid
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 << ::Milkmaid::RemoteNotifier::Event.new(name: event_name_from_type(event_type), data: data, timestamp: timestamp)
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 Milkmaid
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 ::Milkmaid::SensorException.new 'Sensor not available' unless @sensor.name
10
+ fail ::MilkMaid::SensorException.new 'Sensor not available' unless @sensor.name
11
11
  end
12
12
 
13
13
  def name
@@ -0,0 +1,3 @@
1
+ module MilkMaid
2
+ VERSION = "0.2.0"
3
+ end
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 'milkmaid/version'
4
+ require 'milk_maid/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "milk_maid"
8
- spec.version = Milkmaid::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.1.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
- type: :runtime
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
- type: :runtime
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
- type: :runtime
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
- type: :runtime
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
- type: :development
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
- type: :development
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
- type: :development
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
- type: :development
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
- - console
130
- - milkmaid
131
- - setup
129
+ - milk_maid
132
130
  extensions: []
133
131
  extra_rdoc_files: []
134
132
  files:
135
- - ".gitignore"
136
- - ".rspec"
137
- - ".ruby-version"
138
- - ".travis.yml"
133
+ - .gitignore
134
+ - .rspec
135
+ - .ruby-version
136
+ - .travis.yml
139
137
  - Gemfile
140
138
  - README.md
141
139
  - Rakefile
142
- - bin/console
143
- - bin/milkmaid
144
- - bin/setup
140
+ - bin/milk_maid
145
141
  - config/firebase.yml.sample
146
- - lib/milkmaid.rb
147
- - lib/milkmaid/batch.rb
148
- - lib/milkmaid/cli.rb
149
- - lib/milkmaid/console_notifier.rb
150
- - lib/milkmaid/firebase_notifier.rb
151
- - lib/milkmaid/firebase_notifier/batch_record.rb
152
- - lib/milkmaid/parse_notifier.rb
153
- - lib/milkmaid/remote_notifier/batch_record.rb
154
- - lib/milkmaid/temperature_sensor.rb
155
- - lib/milkmaid/version.rb
156
- - milkmaid.gemspec
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.6
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
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'milkmaid'
4
-
5
- Milkmaid::CLI.start( ARGV )
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,3 +0,0 @@
1
- module Milkmaid
2
- VERSION = "0.1.0"
3
- end
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