brewer 0.0.71 → 0.0.74

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: dd9b1df8720156b66f88424e65d7ebd530440ecf
4
- data.tar.gz: 98e6e8df275b44be023a37cff481fced3ac20888
3
+ metadata.gz: 8aa172acc226aadb16fb03b06b575210280922b9
4
+ data.tar.gz: c96b3a8880704a56dc86788fbc67dd829cd2f430
5
5
  SHA512:
6
- metadata.gz: a6d1f4a460c83ee94be5ec03fdcba1460c2fcdd196409412c5b690e9032ea2977b15f869995a36a62f9c8da1d8cf73b2c61f410d3642eae7249e97e2244a3ab2
7
- data.tar.gz: 2163b804379374756c9ed1161bca468dae3993ae3cd079d6da16474cec2150b36ce8c6c6d9dda858c9eddafe0665c65403059e3c75e9cb17b378079e7f6a1425
6
+ metadata.gz: dd81a20b19545d25ccdd75758c54155d5123a90e7b96e400866e04bc7a80bf9c3d371d5b6c5a0ccdb6c53e4a891c1a096467c6ca90ba9561250852ea436c55ef
7
+ data.tar.gz: 68d0ae3b51235a0760cd49c7b4586afe381092898f72c6eba83d9aa83f52554af148997b7fb0355532dd215da50c942785b6bd609787f6625c2fbbc38135d753
data/Gemfile CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/bin/brewer CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative "../lib/autoload"
3
3
 
4
+ com = Communicator.new
4
5
  brewer = Brewer.new
5
6
  adaptibrew = Adaptibrew.new.refresh
6
- com = Communicator.new
7
7
  procedures = Procedures.new
8
8
 
9
9
  puts "🍺 have fun 🍺"
@@ -7,6 +7,7 @@ class Adaptibrew
7
7
 
8
8
  def initialize
9
9
  @install_dir = Dir.home + "/.brewer/"
10
+ refresh
10
11
  end
11
12
 
12
13
  # If used in IRB, Ripl, etc. it will clone into the directory IRB was started in
@@ -8,6 +8,7 @@ require 'net/ping'
8
8
  require 'ripl'
9
9
  require 'wannabe_bool'
10
10
  require 'terminal-table'
11
+ require "rainbow"
11
12
 
12
13
  require_all 'lib'
13
14
 
File without changes
@@ -10,14 +10,14 @@ class Communicator
10
10
  end
11
11
 
12
12
  def configure_slack
13
- slack_file = Dir.home + "/.brewer/.slack.yml"
14
- if !File.file?(slack_file)
15
- store = YAML::Store.new slack_file
13
+ raise "settings.rb must be called before slack is configured" unless $settings
14
+ unless File.readlines($settings['settings_cache']).grep(/webhook_url/).size > 0
15
+ store = YAML::Store.new $settings['settings_cache']
16
16
  print "Enter your Slack webhook url: "
17
17
  webhook_url = gets.chomp
18
18
  store.transaction { store['webhook_url'] = webhook_url }
19
19
  end
20
- return Slack::Notifier.new YAML.load(File.open(slack_file))['webhook_url']
20
+ return Slack::Notifier.new YAML.load(File.open($settings['settings_cache']))['webhook_url']
21
21
  end
22
22
 
23
23
  def ping(message="ping at #{Time.now}")
File without changes
@@ -63,7 +63,7 @@ class Procedures
63
63
  end
64
64
 
65
65
  def boot
66
- puts "booting..."
66
+ puts Rainbow("booting...").yellow
67
67
  @brewer.pid(0)
68
68
  @brewer.pump(0)
69
69
  @brewer.rims_to('mash')
@@ -72,9 +72,9 @@ class Procedures
72
72
  puts @brewer.pid
73
73
 
74
74
  @brewer.clear
75
- puts "Boot successful!"
75
+ puts Rainbow("Boot finished!").green
76
76
  @brewer.out.unshift("successful boot at #{Time.now}")
77
- @com.ping("🍺 boot successful 🍺")
77
+ @com.ping("🍺 boot finished 🍺")
78
78
  true
79
79
  end
80
80
 
@@ -83,16 +83,16 @@ class Procedures
83
83
  puts "heat-strike-water procedure started"
84
84
 
85
85
  # Confirm strike water is in the mash tun
86
- print "Is the strike water in the mash tun? "
86
+ print Rainbow("Is the strike water in the mash tun? ").yellow
87
87
  # -> response
88
88
  confirm ? nil : abort
89
89
 
90
90
  # confirm return manifold is in the mash tun
91
- print "Is the return manifold in the mash tun? "
91
+ print Rainbow("Is the return manifold in the mash tun? ").yellow
92
92
  # -> response
93
93
  confirm ? nil : abort
94
94
 
95
- print "Is the mash tun valve open? "
95
+ print Rainbow("Is the mash tun valve open? ").yellow
96
96
  confirm ? nil : abort
97
97
 
98
98
  # confirm RIMS relay is on
@@ -103,7 +103,8 @@ class Procedures
103
103
  @brewer.pump(1)
104
104
  puts "Pump is now on"
105
105
 
106
- puts "Is the pump running properly? "
106
+ puts Rainbow("Is the pump running properly? ").yellow
107
+ # TODO: Test this
107
108
  until confirm
108
109
  puts "restarting pump"
109
110
  @brewer.pump(0)
@@ -112,7 +113,7 @@ class Procedures
112
113
  end
113
114
 
114
115
  # confirm that strike water is circulating well
115
- print "Is the strike water circulating well? "
116
+ print Rainbow("Is the strike water circulating well? ").yellow
116
117
  # -> response
117
118
  confirm ? nil : abort
118
119
 
@@ -134,10 +135,7 @@ class Procedures
134
135
  # when strike temp is reached, @com.ping slack
135
136
  @brewer.watch
136
137
  @com.ping("Strike water heated to #{@brewer.pv}. Maintaining temperature.")
137
- @com.ping("Next step: dough in")
138
- puts "Next step: dough in"
139
- puts "command: brewer.dough_in"
140
-
138
+ puts Rainbow("Strike water heated. Maintaining temp.").green
141
139
  true
142
140
  end
143
141
  # :nocov:
@@ -149,11 +147,11 @@ class Procedures
149
147
  @brewer.pid(0)
150
148
  @brewer.wait(3)
151
149
  @com.ping("Ready to dough in")
152
- puts "Ready to dough in"
150
+ puts Rainbow("Ready to dough in").green
153
151
 
154
152
  # pour in grain
155
153
 
156
- print "Confirm when you're done with dough-in (y): "
154
+ print Rainbow("Confirm when you're done with dough-in (y): ").yellow
157
155
  confirm ? nil : abort
158
156
  true
159
157
  end
@@ -161,7 +159,7 @@ class Procedures
161
159
  def mash
162
160
  @brewer.sv(@recipe['mash_temp'])
163
161
 
164
- puts "mash stated. This will take a while."
162
+ puts Rainbow("mash stated. This will take a while.").green
165
163
  @com.ping("Mash started. This will take a while.")
166
164
 
167
165
  @brewer.rims_to('mash')
@@ -173,7 +171,7 @@ class Procedures
173
171
  @com.ping("Mash temp (#{@brewer.pv} F) reached. Starting timer for #{@recipe['mash_time']} minutes.")
174
172
  @brewer.wait(@recipe['mash_time'])
175
173
  @com.ping("🍺 Mash complete 🍺. Check for starch conversion.")
176
- puts "Mash complete"
174
+ puts Rainbow("Mash complete").green
177
175
  puts "Check for starch conversion"
178
176
  end
179
177
 
@@ -191,13 +189,14 @@ class Procedures
191
189
  end
192
190
 
193
191
  def sparge
194
- print "Is the sparge water heated to the correct temperature? "
192
+ print Rainbow("Is the sparge water heated to the correct temperature? ").yellow
195
193
  confirm ? nil : abort
196
194
 
197
195
  @brewer.hlt_to('mash')
198
196
  @brewer.hlt(1)
199
197
 
200
- puts "Waiting for 10 seconds. Regulate sparge balance."
198
+ print "Waiting for 10 seconds. "
199
+ puts Rainbow("Regulate sparge balance.").yellow
201
200
  puts "(ctrl-c to abort proccess)"
202
201
  @brewer.wait(30)
203
202
 
@@ -206,7 +205,7 @@ class Procedures
206
205
 
207
206
  @com.ping("Please check the sparge balance and ignite boil tun burner")
208
207
 
209
- puts "Waiting until intervention to turn off pump (y): "
208
+ puts Rainbow("Waiting until intervention to turn off pump (y): ").yellow
210
209
  confirm ? nil : abort
211
210
 
212
211
  @brewer.pid(0)
@@ -220,12 +219,13 @@ class Procedures
220
219
 
221
220
  @brewer.hlt(1)
222
221
 
223
- print "waiting for intervention to turn off hlt (y): "
222
+ print Rainbow("waiting for intervention to turn off hlt (y): ").yellow
224
223
  confirm ? nil : abort
225
224
 
226
225
  @brewer.hlt(0)
227
226
 
228
- @com.ping('Topping off completed')
227
+ @com.ping('Topping off complete')
228
+ puts Rainbow("Topping off complete").green
229
229
  end
230
230
 
231
231
  def boil
@@ -237,7 +237,8 @@ class Procedures
237
237
  @brewer.wait(to_seconds(13))
238
238
  @com.ping("Add finishing hops")
239
239
  @brewer.wait(30)
240
- @com.ping("All done")
240
+ @com.ping("Done.")
241
+ puts Rainbow("Done.").green
241
242
  end
242
243
 
243
244
  end
@@ -1,25 +1,49 @@
1
1
  require_relative "autoload"
2
2
 
3
- adaptibrew = Adaptibrew.new
3
+ $settings = {}
4
4
 
5
+ adaptibrew = Adaptibrew.new
5
6
  # This might not make sense, its for tests
6
7
  def get_repo_for_settings(adaptibrew)
7
8
  adaptibrew.clone
8
9
  end
9
-
10
10
  if !adaptibrew.present?
11
11
  get_repo_for_settings(adaptibrew)
12
12
  end
13
+ # End nonsense
13
14
 
14
- $settings = {}
15
+ $settings['settings_cache'] = Dir.home + "/.brewer/.settings.yml"
16
+ adaptibrew_settings_file = Dir.home + '/.brewer/adaptibrew/settings.py'
17
+
18
+ if !File.exists?($settings['settings_cache'])
19
+ File.open($settings['settings_cache'], 'w')
20
+ end
15
21
 
16
- File.open(Dir.home + '/.brewer/adaptibrew/settings.py') do |file|
17
- file.each_line do |line|
18
- if line.match(/=/) == nil
22
+ def parse_setting_from_line(line)
23
+ key, value = line.match(/(.+)=(.+)/).captures
24
+ value.slice!(/#.+/)
25
+ $settings[key.strip.chomp] = value.strip.chomp
26
+ end
27
+
28
+ unless File.readlines(adaptibrew_settings_file).grep(/DEBUG/).size > 0
29
+ File.readlines(adaptibrew_settings_file) do |line|
30
+ if !line.include? "="
31
+ next
32
+ end
33
+ parse_setting_from_line(line)
34
+ end
35
+
36
+ store = YAML::Store.new $settings['settings_cache']
37
+ store.transaction {
38
+ $settings.each do |k, v|
39
+ store[k] = v
40
+ end
41
+ }
42
+ else
43
+ File.readlines(adaptibrew_settings_file).each do |line|
44
+ if !line.include? "="
19
45
  next
20
46
  end
21
- key, value = line.match(/(.+)=(.+)/).captures
22
- value.slice!(/#.+/)
23
- $settings[key.strip.chomp] = value.strip.chomp
47
+ parse_setting_from_line(line)
24
48
  end
25
49
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.71
4
+ version: 0.0.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Sweeney
@@ -62,16 +62,16 @@ dependencies:
62
62
  name: wannabe_bool
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '1.7'
67
+ version: '0'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - "~>"
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '1.7'
74
+ version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: slack-notifier
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,20 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rainbow
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: rake
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -230,11 +244,9 @@ extensions: []
230
244
  extra_rdoc_files: []
231
245
  files:
232
246
  - Gemfile
233
- - Gemfile.lock
234
247
  - README.md
235
248
  - Rakefile
236
249
  - bin/brewer
237
- - brewer.gemspec
238
250
  - lib/adaptibrew.rb
239
251
  - lib/autoload.rb
240
252
  - lib/brewer.rb
@@ -242,7 +254,6 @@ files:
242
254
  - lib/helpers.rb
243
255
  - lib/procedures.rb
244
256
  - lib/settings.rb
245
- - notes.md
246
257
  - spec/adaptibrew_spec.rb
247
258
  - spec/brewer_spec.rb
248
259
  - spec/hardware_spec.rb
@@ -270,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
281
  version: '0'
271
282
  requirements: []
272
283
  rubyforge_project:
273
- rubygems_version: 2.4.8
284
+ rubygems_version: 2.2.2
274
285
  signing_key:
275
286
  specification_version: 4
276
287
  summary: A shell interface for adaptibrew
@@ -1,61 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- brewer (0.0.40)
5
- git (~> 1.3, >= 1.3.0)
6
- net-ping (~> 1.7)
7
- ripl (~> 0.7.0)
8
- slack-notifier
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.5.0)
14
- public_suffix (~> 2.0, >= 2.0.2)
15
- bond (0.5.1)
16
- diff-lcs (1.2.5)
17
- docile (1.1.5)
18
- git (1.3.0)
19
- json (2.0.3)
20
- launchy (2.4.3)
21
- addressable (~> 2.3)
22
- net-ping (1.7.8)
23
- public_suffix (2.0.4)
24
- rake (12.0.0)
25
- rdoc (5.1.0)
26
- ripl (0.7.1)
27
- bond (~> 0.5.1)
28
- rspec (3.5.0)
29
- rspec-core (~> 3.5.0)
30
- rspec-expectations (~> 3.5.0)
31
- rspec-mocks (~> 3.5.0)
32
- rspec-core (3.5.4)
33
- rspec-support (~> 3.5.0)
34
- rspec-expectations (3.5.0)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.5.0)
37
- rspec-mocks (3.5.0)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.5.0)
40
- rspec-support (3.5.0)
41
- simplecov (0.13.0)
42
- docile (~> 1.1.0)
43
- json (>= 1.8, < 3)
44
- simplecov-html (~> 0.10.0)
45
- simplecov-html (0.10.0)
46
- slack-notifier (2.1.0)
47
-
48
- PLATFORMS
49
- ruby
50
-
51
- DEPENDENCIES
52
- brewer!
53
- launchy (~> 2.4, >= 2.4.0)
54
- rake (~> 12.0, >= 12.0.0)
55
- rdoc (~> 5.1, >= 5.1.0)
56
- rspec (~> 3.5.0, >= 3.5.0)
57
- simplecov (~> 0.13.0)
58
- simplecov-html (~> 0.10.0)
59
-
60
- BUNDLED WITH
61
- 1.12.5
@@ -1,40 +0,0 @@
1
- require 'rake'
2
-
3
- Gem::Specification.new do |s|
4
- s.name = "brewer"
5
- s.version = "0.0.71"
6
- s.default_executable = "brewer"
7
-
8
- s.authors = ["Luke Sweeney"]
9
- s.date = %q{2017-03-08}
10
- s.description = %q{A Ruby API for adaptiman/adaptibrew}
11
- s.post_install_message = "🍺 have fun 🍺"
12
- s.email = %q{luke@thesweeneys.org}
13
- s.files = FileList.new(['lib/*.rb', 'bin/*', '[A-Z]*', 'spec/*.rb']).to_a
14
- s.executables = ['brewer']
15
- s.bindir = 'bin'
16
- s.test_files = FileList.new(["spec/*.rb"]).to_a
17
- s.homepage = %q{https://rubygems.org/gems/brewer}
18
- s.require_paths = ["lib", "lib"]
19
- s.rubygems_version = %q{1.6.2}
20
- s.summary = %q{A shell interface for adaptibrew}
21
- s.license = 'MIT'
22
-
23
- # Runtime dependencies
24
- s.add_runtime_dependency 'git', '~> 1.3', '>= 1.3.0'
25
- s.add_runtime_dependency 'ripl', '~> 0.7.0'
26
- s.add_runtime_dependency 'net-ping', '~> 1.7'
27
- s.add_runtime_dependency 'wannabe_bool', '~> 1.7'
28
- s.add_runtime_dependency 'slack-notifier'
29
- s.add_runtime_dependency 'require_all'
30
- s.add_runtime_dependency 'terminal-table'
31
-
32
-
33
- # Dev dependencies
34
- s.add_development_dependency 'rake', '~> 12.0', '>= 12.0.0'
35
- s.add_development_dependency 'rspec', '~> 3.5.0', '>= 3.5.0'
36
- s.add_development_dependency 'launchy', '~> 2.4', '>= 2.4.0'
37
- s.add_development_dependency 'simplecov', '~> 0.13.0'
38
- s.add_development_dependency 'simplecov-html', '~> 0.10.0'
39
- s.add_development_dependency 'rdoc', '~> 5.1', '>= 5.1.0'
40
- end
data/notes.md DELETED
@@ -1,16 +0,0 @@
1
- class roles:
2
- Brewer:
3
- - Directly control each component of the physical brew rig
4
-
5
- Procedures:
6
- - compile brewer methods into scripted procedures
7
-
8
- Helpers:
9
- - assorted methods, helpers module
10
-
11
- Adaptibrew:
12
- - Clone and maintain the adaptibrew directory
13
-
14
- Communicator:
15
- - Communicates the status of the brew rig
16
- - Communicates actions the brew rig is doing/actions that the brewer class does