arvicco-avalon 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/avalon.gemspec +1 -1
- data/lib/avalon/config.rb +9 -1
- data/lib/avalon/miner.rb +2 -1
- data/lib/avalon/utils.rb +16 -12
- data/lib/avalon/version.rb +1 -1
- metadata +4 -2
data/avalon.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Avalon miners monitor}
|
12
12
|
gem.summary = %q{Avalon miners monitor and set of helper scripts}
|
13
13
|
gem.homepage = "https://github.com/arvicco/avalon"
|
14
|
+
gem.licenses = ['MIT', 'GPL-2']
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -18,5 +19,4 @@ Gem::Specification.new do |gem|
|
|
18
19
|
gem.require_paths = ["lib"]
|
19
20
|
|
20
21
|
gem.add_dependency 'faraday', '~> 0.8'
|
21
|
-
|
22
22
|
end
|
data/lib/avalon/config.rb
CHANGED
@@ -25,7 +25,15 @@ module Avalon
|
|
25
25
|
File.expand_path('~/.avalon/blocks.yml')
|
26
26
|
|
27
27
|
# Setting defaults
|
28
|
-
@config[:alert_sounds] =
|
28
|
+
@config[:alert_sounds] =
|
29
|
+
case @config[:alert_sounds]
|
30
|
+
when Symbol, false
|
31
|
+
@config[:alert_sounds]
|
32
|
+
when Hash
|
33
|
+
DEFAULT_SOUNDS.merge @config[:alert_sounds]
|
34
|
+
when true, nil
|
35
|
+
DEFAULT_SOUNDS
|
36
|
+
end
|
29
37
|
@config[:alert_last_share] ||= 2
|
30
38
|
@config[:alert_after] ||= @config[:status_fails_to_alarm] || 2
|
31
39
|
@config[:alert_temp_high] ||= @config[:alert_temp] || 55
|
data/lib/avalon/miner.rb
CHANGED
@@ -154,7 +154,8 @@ module Avalon
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def to_s
|
157
|
-
|
157
|
+
num.to_s.rjust(3) + ": " +
|
158
|
+
FIELDS.map {|key, (width, _, _ )| @data[key].to_s.rjust(width)}.join(" ")
|
158
159
|
end
|
159
160
|
|
160
161
|
end
|
data/lib/avalon/utils.rb
CHANGED
@@ -11,17 +11,21 @@ module Avalon
|
|
11
11
|
|
12
12
|
# Helper method: play a sound file
|
13
13
|
def play what
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
case Avalon::Config[:alert_sounds]
|
15
|
+
when false, :none, :no
|
16
|
+
when Hash
|
17
|
+
tunes = [Avalon::Config[:alert_sounds][what] || what].compact.flatten
|
18
|
+
|
19
|
+
tunes.each do |tune|
|
20
|
+
file = find_file( tune, "../../../sound/#{tune}",
|
21
|
+
"~/.avalon/sound/#{tune}", "/System/Library/Sounds/#{tune}")
|
22
|
+
case system
|
23
|
+
when 'Darwin'
|
24
|
+
`afplay #{file}`
|
25
|
+
when 'Linux'
|
26
|
+
raise 'Please install sox package: sudo apt-get install sox' if `which sox`.empty?
|
27
|
+
`play -q #{file}`
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -29,7 +33,7 @@ module Avalon
|
|
29
33
|
# Helper method: sound alarm with message
|
30
34
|
def alarm message, sound=:failure
|
31
35
|
puts message
|
32
|
-
play sound
|
36
|
+
play sound
|
33
37
|
end
|
34
38
|
|
35
39
|
# Helper method: from time string 'hh:mm:ss' to duration in minutes
|
data/lib/avalon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvicco-avalon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.27
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -69,7 +69,9 @@ files:
|
|
69
69
|
- sound/Ping.aiff
|
70
70
|
- sound/Purr.aiff
|
71
71
|
homepage: https://github.com/arvicco/avalon
|
72
|
-
licenses:
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
- GPL-2
|
73
75
|
post_install_message:
|
74
76
|
rdoc_options: []
|
75
77
|
require_paths:
|