alerty 0.2.2 → 0.2.3
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/CHANGELOG.md +7 -0
- data/alerty.gemspec +3 -1
- data/example.yml +2 -0
- data/lib/alerty.rb +1 -0
- data/lib/alerty/cli.rb +6 -2
- data/lib/alerty/config.rb +29 -12
- data/lib/alerty/version.rb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dc317e075c9f5dbdf24fd431e6b7dddd3f68d1a
|
4
|
+
data.tar.gz: 6288a780b49cbac9d68b662bd5381430270547de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea49ad7c8ab76fa41268896872061bc2c826d42cae620c8cd900c1b29f6b33afb82a7d6f3b871fbf50b7bd7eaea1e23d3450bfba91a046fb0906016b35df775
|
7
|
+
data.tar.gz: f29f8d6cb14926057761e55e5e0bc1d78ff62375ab9780529f4a94b518a7c825b9f06a646d299227d2f58acc315b6cea173e1b49c2c859806b94851e57927ad9
|
data/CHANGELOG.md
CHANGED
data/alerty.gemspec
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require_relative 'lib/alerty/version'
|
2
|
+
|
1
3
|
Gem::Specification.new do |gem|
|
2
4
|
gem.name = "alerty"
|
3
|
-
gem.version =
|
5
|
+
gem.version = Alerty::VERSION
|
4
6
|
gem.author = ['Naotoshi Seo']
|
5
7
|
gem.email = ['sonots@gmail.com']
|
6
8
|
gem.homepage = 'https://github.com/sonots/alerty'
|
data/example.yml
CHANGED
data/lib/alerty.rb
CHANGED
data/lib/alerty/cli.rb
CHANGED
@@ -43,11 +43,15 @@ class Alerty
|
|
43
43
|
op.on('--retry-wait SECONDS', "retry interval = retry wait +/- 12.5% randomness (default: 1.0)") {|v|
|
44
44
|
opts[:retry_wait] = v.to_f
|
45
45
|
}
|
46
|
+
op.on('--dotenv', "Load environment variables from .env file with dotenv") {|v|
|
47
|
+
opts[:dotenv] = true
|
48
|
+
}
|
46
49
|
op.on('-d', '--debug', "debug mode") {|v|
|
47
50
|
opts[:debug] = true
|
48
51
|
}
|
49
|
-
op.on('--
|
50
|
-
|
52
|
+
op.on('-v', '--version', "print version") {|v|
|
53
|
+
puts Alerty::VERSION
|
54
|
+
exit 0
|
51
55
|
}
|
52
56
|
|
53
57
|
op.parse!(argv)
|
data/lib/alerty/config.rb
CHANGED
@@ -16,18 +16,35 @@ class Alerty
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def config
|
19
|
-
@config
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
return @config if @config
|
20
|
+
if dotenv?
|
21
|
+
require 'dotenv'
|
22
|
+
Dotenv.load
|
23
|
+
end
|
24
|
+
content = File.read(config_path)
|
25
|
+
erb = ERB.new(content, nil, '-')
|
26
|
+
erb_content = erb.result
|
27
|
+
if debug?
|
28
|
+
puts '=== Erb evaluated config ==='
|
29
|
+
puts erb_content
|
30
|
+
end
|
31
|
+
yaml = YAML.load(erb_content)
|
32
|
+
@config = Hashie::Mash.new(yaml)
|
33
|
+
if debug?
|
34
|
+
puts '=== Recognized config ==='
|
35
|
+
puts({
|
36
|
+
'log_path' => log_path,
|
37
|
+
'log_level' => log_level,
|
38
|
+
'log_shift_age' => log_shift_age,
|
39
|
+
'log_shift_size' => log_shift_size,
|
40
|
+
'timeout' => timeout,
|
41
|
+
'lock_path' => lock_path,
|
42
|
+
'retry_limit' => retry_limit,
|
43
|
+
'retry_wait' => retry_wait,
|
44
|
+
'plugin' => yaml['plugins'],
|
45
|
+
}.to_yaml)
|
46
|
+
end
|
47
|
+
@config
|
31
48
|
end
|
32
49
|
|
33
50
|
def log_path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alerty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- lib/alerty/plugin/stdout.rb
|
165
165
|
- lib/alerty/plugin_factory.rb
|
166
166
|
- lib/alerty/string_util.rb
|
167
|
+
- lib/alerty/version.rb
|
167
168
|
- log/.gitkeep
|
168
169
|
- spec/cli_spec.rb
|
169
170
|
- spec/cli_spec.yml
|