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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f926cdcaa4991ec047200693a400944e4923e26
4
- data.tar.gz: 1739fde8a212c22dee1a2c2fb11c5dbbe4d5a67f
3
+ metadata.gz: a900ba214e37a066dfc4407d2e4dc2419dd856e0
4
+ data.tar.gz: c52fc0febe3102354115b46c3c691d0fe55be08e
5
5
  SHA512:
6
- metadata.gz: 30e6c199b116df31de4235e51b689879e00ec01f3951eb754589250c534c4034a75ea14250eefda4bd4c790f9e4fef6508144db45c31e29a7e5c6cd716c2f43a
7
- data.tar.gz: ecbe7d88dede8e5cfd9f217883da8125c0ed796c2f0cad64949b62d9d75ec06896a6f9ed3deb8ad1cb0f5976f6faf05ea865cd8d234d268f3a31f8b2db450afe
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 parser
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 << (v unless v.is_a? TrueClass)
88
+ argv << v unless v.is_a? TrueClass
88
89
  end
89
90
  parser = Tailstrom::OptionParser.new
90
91
  parser.parse argv
@@ -1,3 +1,3 @@
1
1
  module Tailstrom
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailstrom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Issei Naruta