brewby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +112 -0
- data/Rakefile +6 -0
- data/brewby.gemspec +20 -0
- data/examples/basic_control.rb +24 -0
- data/examples/brewby_recipe.rb +35 -0
- data/examples/config.json +21 -0
- data/examples/recipe_loader.rb +28 -0
- data/lib/brewby.rb +6 -0
- data/lib/brewby/application.rb +88 -0
- data/lib/brewby/heating_element.rb +61 -0
- data/lib/brewby/inputs.rb +15 -0
- data/lib/brewby/inputs/ds18b20.rb +51 -0
- data/lib/brewby/inputs/test.rb +14 -0
- data/lib/brewby/outputs.rb +15 -0
- data/lib/brewby/outputs/gpio.rb +40 -0
- data/lib/brewby/outputs/test.rb +23 -0
- data/lib/brewby/step_loader.rb +27 -0
- data/lib/brewby/steps.rb +8 -0
- data/lib/brewby/steps/dsl/step.rb +48 -0
- data/lib/brewby/steps/temp_control.rb +111 -0
- data/lib/brewby/temp_sensor.rb +13 -0
- data/lib/brewby/timed.rb +50 -0
- data/lib/brewby/version.rb +3 -0
- data/spec/application_spec.rb +49 -0
- data/spec/heating_element_spec.rb +44 -0
- data/spec/inputs/ds18b20_spec.rb +39 -0
- data/spec/inputs_spec.rb +8 -0
- data/spec/outputs/gpio_spec.rb +65 -0
- data/spec/outputs_spec.rb +8 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/step_loader_spec.rb +18 -0
- data/spec/steps/dsl/step_spec.rb +61 -0
- data/spec/steps/temp_control_spec.rb +187 -0
- data/spec/support/sample_recipe.rb +32 -0
- data/spec/support/virtual_view.rb +31 -0
- data/spec/timed_spec.rb +110 -0
- metadata +151 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
recipe 'Honey Ale' do
|
2
|
+
step 'Strike Water' do
|
3
|
+
type :temp_control
|
4
|
+
mode :auto
|
5
|
+
target 168.0
|
6
|
+
hold_duration 5
|
7
|
+
input :hlt
|
8
|
+
output :hlt
|
9
|
+
end
|
10
|
+
|
11
|
+
step 'Infusion Mash Step' do
|
12
|
+
type :temp_control, mode: :auto, target: 150.0, duration: 60
|
13
|
+
input :mlt
|
14
|
+
output :hlt
|
15
|
+
end
|
16
|
+
|
17
|
+
step 'Fly Sparge' do
|
18
|
+
type :temp_control
|
19
|
+
mode :auto
|
20
|
+
target 168.0
|
21
|
+
hold_duration 45
|
22
|
+
input :hlt
|
23
|
+
output :mlt
|
24
|
+
end
|
25
|
+
|
26
|
+
step 'Boil' do
|
27
|
+
type :temp_control
|
28
|
+
mode :manual
|
29
|
+
input :bk
|
30
|
+
output :bk
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
module Brewby
|
4
|
+
class VirtualView
|
5
|
+
def initialize
|
6
|
+
@output = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def move row, col
|
10
|
+
@output[row] ||= StringIO.new("".ljust(70))
|
11
|
+
@output[row].pos = col
|
12
|
+
@current_row = row
|
13
|
+
end
|
14
|
+
|
15
|
+
def addstr string
|
16
|
+
@output[@current_row].write string
|
17
|
+
end
|
18
|
+
|
19
|
+
def readline lineno
|
20
|
+
@output[lineno].string
|
21
|
+
end
|
22
|
+
|
23
|
+
def refresh
|
24
|
+
# no-op
|
25
|
+
end
|
26
|
+
|
27
|
+
def getch
|
28
|
+
# no-op. this will get stubbed by a test
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/spec/timed_spec.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class FakeStep
|
4
|
+
include Brewby::Timed
|
5
|
+
end
|
6
|
+
|
7
|
+
describe Brewby::Timed do
|
8
|
+
before do
|
9
|
+
@step = FakeStep.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has a start time' do
|
13
|
+
@step.start_time.should be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'has an end time' do
|
17
|
+
@step.end_time.should be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'unstarted' do
|
21
|
+
it 'is unstarted' do
|
22
|
+
@step.started?.should be_false
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'is unended' do
|
26
|
+
@step.ended?.should be_false
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is not in progress' do
|
30
|
+
@step.in_progress?.should be_false
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'has no elapsed time' do
|
34
|
+
@step.elapsed.should == 0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'started' do
|
39
|
+
before do
|
40
|
+
@step.start_timer
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is started' do
|
44
|
+
@step.started?.should be_true
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'is not ended' do
|
48
|
+
@step.ended?.should be_false
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'is in progress' do
|
52
|
+
@step.in_progress?.should be_true
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'has an elapsed time' do
|
56
|
+
elapsed = Time.now - @step.start_time
|
57
|
+
@step.elapsed.should be_within(1).of(elapsed)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'ended' do
|
62
|
+
before do
|
63
|
+
@step.start_timer
|
64
|
+
@step.stop_timer
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'is started' do
|
68
|
+
@step.started?.should be_true
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'is ended' do
|
72
|
+
@step.ended?.should be_true
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'is not in progress' do
|
76
|
+
@step.in_progress?.should be_false
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'has an elapsed time' do
|
80
|
+
elapsed = @step.end_time - @step.start_time
|
81
|
+
@step.elapsed.should == elapsed
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'timer display' do
|
86
|
+
context 'time is greater than zero' do
|
87
|
+
let(:time_remaining) { 3750 }
|
88
|
+
|
89
|
+
it 'gives a formatted timer' do
|
90
|
+
@step.timer_for(time_remaining).should == "01:02:30"
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'gives a formatted countdown' do
|
94
|
+
@step.countdown_for(time_remaining).should == "01:02:30"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'time is less than zero' do
|
99
|
+
let(:time_remaining) { -95 }
|
100
|
+
|
101
|
+
it 'gives a zeroed counter for timers' do
|
102
|
+
@step.timer_for(time_remaining).should == "00:00:00"
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'gives a negative counter countdown' do
|
106
|
+
@step.countdown_for(time_remaining).should == "+00:01:35"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brewby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Nordman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: temper-control
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- cadwallion@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- brewby.gemspec
|
82
|
+
- examples/basic_control.rb
|
83
|
+
- examples/brewby_recipe.rb
|
84
|
+
- examples/config.json
|
85
|
+
- examples/recipe_loader.rb
|
86
|
+
- lib/brewby.rb
|
87
|
+
- lib/brewby/application.rb
|
88
|
+
- lib/brewby/heating_element.rb
|
89
|
+
- lib/brewby/inputs.rb
|
90
|
+
- lib/brewby/inputs/ds18b20.rb
|
91
|
+
- lib/brewby/inputs/test.rb
|
92
|
+
- lib/brewby/outputs.rb
|
93
|
+
- lib/brewby/outputs/gpio.rb
|
94
|
+
- lib/brewby/outputs/test.rb
|
95
|
+
- lib/brewby/step_loader.rb
|
96
|
+
- lib/brewby/steps.rb
|
97
|
+
- lib/brewby/steps/dsl/step.rb
|
98
|
+
- lib/brewby/steps/temp_control.rb
|
99
|
+
- lib/brewby/temp_sensor.rb
|
100
|
+
- lib/brewby/timed.rb
|
101
|
+
- lib/brewby/version.rb
|
102
|
+
- spec/application_spec.rb
|
103
|
+
- spec/heating_element_spec.rb
|
104
|
+
- spec/inputs/ds18b20_spec.rb
|
105
|
+
- spec/inputs_spec.rb
|
106
|
+
- spec/outputs/gpio_spec.rb
|
107
|
+
- spec/outputs_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/step_loader_spec.rb
|
110
|
+
- spec/steps/dsl/step_spec.rb
|
111
|
+
- spec/steps/temp_control_spec.rb
|
112
|
+
- spec/support/sample_recipe.rb
|
113
|
+
- spec/support/virtual_view.rb
|
114
|
+
- spec/timed_spec.rb
|
115
|
+
homepage: ''
|
116
|
+
licenses: []
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.0.14
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: The core components of the Brewby brewing system
|
138
|
+
test_files:
|
139
|
+
- spec/application_spec.rb
|
140
|
+
- spec/heating_element_spec.rb
|
141
|
+
- spec/inputs/ds18b20_spec.rb
|
142
|
+
- spec/inputs_spec.rb
|
143
|
+
- spec/outputs/gpio_spec.rb
|
144
|
+
- spec/outputs_spec.rb
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
- spec/step_loader_spec.rb
|
147
|
+
- spec/steps/dsl/step_spec.rb
|
148
|
+
- spec/steps/temp_control_spec.rb
|
149
|
+
- spec/support/sample_recipe.rb
|
150
|
+
- spec/support/virtual_view.rb
|
151
|
+
- spec/timed_spec.rb
|