tailstrom 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tailstrom/option_parser.rb +4 -3
- data/lib/tailstrom/version.rb +1 -1
- 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: a900ba214e37a066dfc4407d2e4dc2419dd856e0
|
4
|
+
data.tar.gz: c52fc0febe3102354115b46c3c691d0fe55be08e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 809722b51d215de0861f9745d0e494c93846621205af3d53285d012504c88d8fe2030505b2b0eb812967b25e9aaa571c585ffd9a7bc5a736b19f8e54ef51b9c4
|
7
|
+
data.tar.gz: d46b7ff7ec44ba051895e04f56d1626ec6688490b7f1c9eaa8484af097924ddf88c04400c9ac1cd6b6b461d41c69ab6d55b7bb45f3e4d163e343f6c8c8649334
|
@@ -15,6 +15,7 @@ module Tailstrom
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def parse(argv)
|
18
|
+
parser = generate_parser
|
18
19
|
parser.order! argv
|
19
20
|
if infile = argv.shift
|
20
21
|
@options[:static_infile] = open(infile, 'r')
|
@@ -23,14 +24,13 @@ module Tailstrom
|
|
23
24
|
DEFAULTS.merge @options
|
24
25
|
end
|
25
26
|
|
26
|
-
def
|
27
|
+
def generate_parser
|
27
28
|
::OptionParser.new do |opt|
|
28
29
|
opt.banner = <<-END
|
29
30
|
tail -f access.log | #{$0} [OPTIONS]
|
30
31
|
#{$0} [OPTIONS] [file]
|
31
32
|
END
|
32
33
|
opt.on('-c file', '--config file', String, 'config file') do |v|
|
33
|
-
require 'tailstrom/config_loader'
|
34
34
|
@options_from_file = load_config v
|
35
35
|
end
|
36
36
|
opt.on('-f num', Integer, 'value field') do |v|
|
@@ -80,11 +80,12 @@ tail -f access.log | #{$0} [OPTIONS]
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def load_config(file)
|
83
|
+
require 'yaml'
|
83
84
|
argv = []
|
84
85
|
hash = YAML.load File.read(file)
|
85
86
|
hash.each do |k, v|
|
86
87
|
argv << (k.length > 1 ? "--#{k}" : "-#{k}")
|
87
|
-
argv <<
|
88
|
+
argv << v unless v.is_a? TrueClass
|
88
89
|
end
|
89
90
|
parser = Tailstrom::OptionParser.new
|
90
91
|
parser.parse argv
|
data/lib/tailstrom/version.rb
CHANGED