alerty 0.2.2 → 0.2.3

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: 5fc316a256dd8602e31c41ef562ed53cfc0a258b
4
- data.tar.gz: ff1605bba990d182928b595f01bd81293323b815
3
+ metadata.gz: 4dc317e075c9f5dbdf24fd431e6b7dddd3f68d1a
4
+ data.tar.gz: 6288a780b49cbac9d68b662bd5381430270547de
5
5
  SHA512:
6
- metadata.gz: 101536294726ed307ffca6fbe18df13686dbab8f5b025ec1e8f4f86db2f840fbae940434a40eb1ed684a5cdcf29db29f1d8db50952109e3b162dab4de2989005
7
- data.tar.gz: 3af90a92c88c7e7cda3a891432c37c88fb407b0d72891c7ed196db79aaa7959afd1b9a3b78ec241ffcd59b9ec874605b4f478a90887ce2ffbfd9e291656dc8cd
6
+ metadata.gz: 3ea49ad7c8ab76fa41268896872061bc2c826d42cae620c8cd900c1b29f6b33afb82a7d6f3b871fbf50b7bd7eaea1e23d3450bfba91a046fb0906016b35df775
7
+ data.tar.gz: f29f8d6cb14926057761e55e5e0bc1d78ff62375ab9780529f4a94b518a7c825b9f06a646d299227d2f58acc315b6cea173e1b49c2c859806b94851e57927ad9
@@ -1,3 +1,10 @@
1
+ # 0.2.3 (2017/01/20)
2
+
3
+ Enhancements:
4
+
5
+ * Enrich debug print
6
+ * Add --version option
7
+
1
8
  # 0.2.2 (2017/01/20)
2
9
 
3
10
  Fixes:
@@ -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 = '0.2.2'
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'
@@ -1,5 +1,7 @@
1
1
  log_path: STDOUT
2
2
  log_level: debug
3
+ log_shift_age: 5
4
+ log_shift_size: 10485760
3
5
  timeout: 10
4
6
  lock_path: log/lock
5
7
  plugins:
@@ -1,3 +1,4 @@
1
+ require_relative 'alerty/version'
1
2
  require_relative 'alerty/error'
2
3
  require_relative 'alerty/config'
3
4
  require_relative 'alerty/command'
@@ -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('--dotenv', "Load environment variables from .env file with dotenv") {|v|
50
- opts[:dotenv] = true
52
+ op.on('-v', '--version', "print version") {|v|
53
+ puts Alerty::VERSION
54
+ exit 0
51
55
  }
52
56
 
53
57
  op.parse!(argv)
@@ -16,18 +16,35 @@ class Alerty
16
16
  end
17
17
 
18
18
  def config
19
- @config ||=
20
- begin
21
- if dotenv?
22
- require 'dotenv'
23
- Dotenv.load
24
- end
25
- content = File.read(config_path)
26
- erb = ERB.new(content, nil, '-')
27
- erb_content = erb.result
28
- puts erb_content if debug?
29
- Hashie::Mash.new(YAML.load(erb_content))
30
- end
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
@@ -0,0 +1,3 @@
1
+ class Alerty
2
+ VERSION = '0.2.3'
3
+ end
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.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