brewer 0.0.40 → 0.0.42
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 +4 -4
- data/Gemfile.lock +1 -1
- data/brewer.gemspec +1 -1
- data/lib/brewer.rb +27 -5
- data/lib/slacker.rb +6 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3cb31ac65770f2293137cc4372d64a970b25019
|
4
|
+
data.tar.gz: 2db00786e0399850e5629eb8293050c01a684c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47164796b3a4e50e70189b1108c7bbb8fbe6af86fcb484c00167a46a79648065ed6a32a6b0ff8514c7429035efb723619d0eb5073a7ceb07ef2b6ac3282e9e71
|
7
|
+
data.tar.gz: 56aa351300d8b0d1ecefafad8fd57d157d78ad8789493b683a71e391cf796a22764cee238345600202ef7043e7e7e2426d3008caee781c5dc9a4d157ce4ce8b2
|
data/Gemfile.lock
CHANGED
data/brewer.gemspec
CHANGED
data/lib/brewer.rb
CHANGED
@@ -68,13 +68,21 @@ class Brewer
|
|
68
68
|
self
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
# Turns PID on or off, or gets state if no arg is provided
|
72
|
+
def pid(state="status")
|
73
|
+
if state == "status"
|
74
|
+
script("is_pid_running")
|
75
|
+
puts @out.first
|
76
|
+
end
|
77
|
+
|
72
78
|
if state == 1
|
73
|
-
|
79
|
+
script('set_pid_on')
|
80
|
+
puts "PID is now on"
|
74
81
|
else
|
75
|
-
|
82
|
+
script("set_pid_off")
|
83
|
+
puts "PID is now off"
|
76
84
|
end
|
77
|
-
|
85
|
+
|
78
86
|
self
|
79
87
|
end
|
80
88
|
|
@@ -86,16 +94,30 @@ class Brewer
|
|
86
94
|
end
|
87
95
|
|
88
96
|
def relay_status(relay)
|
97
|
+
raise "Relay number needs to be an integer" unless relay.is_a? Integer
|
89
98
|
script("get_relay_status", "#{relay}")
|
90
99
|
puts @out.first
|
91
100
|
self
|
92
101
|
end
|
93
102
|
|
103
|
+
def sv(temp=nil)
|
104
|
+
if temp
|
105
|
+
raise "Temperature input needs to be an integer" unless temp.is_a? Integer
|
106
|
+
script('set_sv', temp)
|
107
|
+
puts "SV set to #{temp}"
|
108
|
+
else
|
109
|
+
script('get_sv')
|
110
|
+
puts "SV is currently " + @out.first
|
111
|
+
end
|
112
|
+
self
|
113
|
+
end
|
114
|
+
|
94
115
|
# Procedures
|
95
116
|
|
96
117
|
def boot
|
97
118
|
# These are the states required for starting. Should be called on boot.
|
98
|
-
|
119
|
+
# Print PID status at end
|
120
|
+
pid(0).pump(0).relay(2, 1).all_relays_status
|
99
121
|
|
100
122
|
@out.shift(4)
|
101
123
|
@out.unshift("Boot successful")
|
data/lib/slacker.rb
CHANGED
@@ -15,14 +15,15 @@ if !File.file?('.slack.yml')
|
|
15
15
|
store.transaction do
|
16
16
|
store['webhook_url'] = webhook_url
|
17
17
|
end
|
18
|
-
end
|
19
18
|
|
20
|
-
# Here's a
|
21
|
-
File.open(".slack.yml", 'a') do |file|
|
22
|
-
|
23
|
-
|
19
|
+
# Here's a comment in .slack.yml so if you find it by accident you'll know what it does
|
20
|
+
File.open(".slack.yml", 'a') do |file|
|
21
|
+
file.puts "# This is the slack configuration file for the brewer gem"
|
22
|
+
file.puts "# You can delete this file and brewer will re-create it on start-up"
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
|
+
|
26
27
|
# finally, start up a global variable for the brewer class to use
|
27
28
|
# A full `Slacker` class is not needed, since this only does one thing
|
28
29
|
$slack = Slack::Notifier.new YAML.load(File.open('.slack.yml'))['webhook_url']
|