alerty 0.1.1 → 0.2.0

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: f3aefd93f293e597e994789dc114fcc562cbe734
4
- data.tar.gz: 0d233745290cafd7738d9bb38681caf668b38556
3
+ metadata.gz: 453543dbd00954cb81e72e140fdfc4e032ff69db
4
+ data.tar.gz: 49224e75b73369a2b943c87d3973aacfa6a123bb
5
5
  SHA512:
6
- metadata.gz: 8f692ddec011a57dcd0c40a477cece6b927e9623b3b0f85db287c49625fb1ea1a6d294d16e1efd9a62ab86a6786a1fa25db2fea0fb48019bbd154eb675efaf40
7
- data.tar.gz: 2f307d1be4774da9cf5d5576f617928dff211be0648f44b39efc984073f8774d1bdbf551d29931a2607bc03cd8140066c9184756f6d5266cceac4d97b98ab117
6
+ metadata.gz: 53f44b191c4e84f232fd795284f8893b13e594f8e32f2366866bc47542df9027c4ec360a32175e70a4e093d0fe85d85ec593a10a4403877247bc95dc47eb6abc
7
+ data.tar.gz: ad6dc6757731631ef8967c334fc810758984d139134003ea839f5dabd8dcfbc132df4cf37b8debae8ff3ba865006310a64ee14af9ba5afffff9d505d96871423
@@ -1,4 +1,10 @@
1
- # 0.1.1 (2016/09/25)
1
+ # 0.2.0 (2016/09/25)
2
+
3
+ Enhancements:
4
+
5
+ * Allow erb in config yaml
6
+
7
+ # 0.1.1 (2016/09/05)
2
8
 
3
9
  Enhancements:
4
10
 
data/README.md CHANGED
@@ -54,7 +54,7 @@ Usage: alerty [options] -- command
54
54
  --lock LOCK_FILE exclusive lock file to prevent running a command duplicatedly (default: no lock)
55
55
  --retry-limit NUMBER number of retries (default: 0)
56
56
  --retry-wait SECONDS retry interval = retry wait +/- 12.5% randomness (default: 1.0)
57
- -d, --debug debug mode (same with --log-level debug)
57
+ -d, --debug debug mode
58
58
  ```
59
59
 
60
60
  ## Plugins
@@ -66,6 +66,7 @@ Following plugins are available:
66
66
  * [exec](./lib/alerty/plugin/exec.rb)
67
67
  * [sonots/alerty-plugin-ikachan](https://github.com/sonots/alerty-plugin-ikachan)
68
68
  * [sonots/alerty-plugin-amazon_sns](https://github.com/sonots/alerty-plugin-amazon_sns)
69
+ * [sonots/alerty-plugin-slack](https://github.com/sonots/alerty-plugin-slack)
69
70
  * [civitaspo/alerty-plugin-mail](https://github.com/civitaspo/alerty-plugin-mail)
70
71
  * [inokappa/alerty-plugin-datadog_event](https://github.com/inokappa/alerty-plugin-datadog_event)
71
72
  * [inokappa/alerty-plugin-amazon_cloudwatch_logs](https://github.com/inokappa/alerty-plugin-amazon_cloudwatch_logs)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "alerty"
3
- gem.version = '0.1.1'
3
+ gem.version = '0.2.0'
4
4
  gem.author = ['Naotoshi Seo']
5
5
  gem.email = ['sonots@gmail.com']
6
6
  gem.homepage = 'https://github.com/sonots/alerty'
@@ -5,6 +5,6 @@ lock_path: log/lock
5
5
  plugins:
6
6
  - type: stdout
7
7
  - type: file
8
- path: log/file.log
8
+ path: log/<%= ENV['FILE'] || 'file' %>.log
9
9
  - type: exec
10
10
  command: cat > log/exec.log
@@ -43,8 +43,8 @@ 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('-d', '--debug', "debug mode (same with --log-level debug)") {|v|
47
- opts[:log_level] = 'debug'
46
+ op.on('-d', '--debug', "debug mode") {|v|
47
+ opts[:debug] = true
48
48
  }
49
49
 
50
50
  op.parse!(argv)
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'erb'
2
3
  require 'hashie/mash'
3
4
 
4
5
  class Alerty
@@ -15,7 +16,14 @@ class Alerty
15
16
  end
16
17
 
17
18
  def config
18
- @config ||= Hashie::Mash.new(YAML.load_file(config_path))
19
+ @config ||=
20
+ begin
21
+ content = File.read(config_path)
22
+ erb = ERB.new(content, nil, '-')
23
+ erb_content = erb.result
24
+ puts erb_content if debug?
25
+ Hashie::Mash.new(YAML.load(erb_content))
26
+ end
19
27
  end
20
28
 
21
29
  def log_path
@@ -50,6 +58,10 @@ class Alerty
50
58
  opts[:retry_wait] || config.retry_wait || 1.0
51
59
  end
52
60
 
61
+ def debug?
62
+ !!opts[:debug]
63
+ end
64
+
53
65
  def retry_interval
54
66
  @random ||= Random.new
55
67
  randomness = retry_wait * 0.125
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alerty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie