fluent-plugin-stdout-pp 0.0.2 → 0.1.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: 6f7bff42d1c162e390a521c287cf50c4950db51e
4
- data.tar.gz: d961d6f14ce6a579d6591e2696cc5da5e2b35ee1
3
+ metadata.gz: b61c7757d5d658aa171a9026b8102f5b4a2b8d23
4
+ data.tar.gz: f16d7c86c25ac86659c629260bd64d18a3df38cf
5
5
  SHA512:
6
- metadata.gz: f1a71475e69be0fe37c6d1d36904af6165911505a35f1b185de5add9001aa650582797e528ccc3bfce82ab041b2cd43b54cebdd6267d932d24a8dae6109ec2f0
7
- data.tar.gz: 021a35f9649f758254cf8ef0bea1e3cc4b8127df67a1ec8c7ab051728980590b4dbba8f5ace4b00556ff426a8c16fd855418ece4943e146494675f8fe7282107
6
+ metadata.gz: 357e69f7a0adcbe3c83b5a3d71b96dede94d2f05406ac276f884ec6339aeae38494f578abe5f5a23806ef4524e1f2e5286bef180dbbf42c3836a408ff83b5343
7
+ data.tar.gz: cb1980091799ed9712942829c7d778612a4ca7d4fb1073c5f9ab741fcc8bd5714b8b17a39d51ea05e4156eb1c968efec665d43e447465c7c1e023ff3009ea585
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ /vendor/
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # fluent-plugin-stdout-pp
2
2
 
3
+ [![Build Status](https://travis-ci.org/sabottenda/fluent-plugin-stdout-pp.svg)](https://travis-ci.org/sabottenda/fluent-plugin-stdout-pp)
4
+
3
5
  A fluentd plugin to pretty print json with color to stdout
4
6
 
5
7
  ## Installation
data/Rakefile CHANGED
@@ -1 +1,12 @@
1
+ require "bundler"
1
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |test|
7
+ test.libs << 'lib' << 'test'
8
+ test.pattern = 'test/**/test_*.rb'
9
+ test.verbose = true
10
+ end
11
+
12
+ task :default => [:test]
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-stdout-pp"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.1.0"
8
8
  spec.authors = ["Masahiro Sano"]
9
9
  spec.email = ["sabottenda@gmail.com"]
10
10
  spec.description = %q{A fluentd plugin to pretty print json with color to stdout}
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "fluentd", "~> 0.10.0"
20
+ spec.add_dependency "fluentd"
21
21
  spec.add_dependency "coderay"
22
22
  spec.add_development_dependency "rake"
23
23
  end
data/test/helper.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'test/unit'
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ require 'fluent/test'
6
+
7
+ def capture(&block)
8
+ old = $log
9
+ $log = StringIO.new
10
+ yield
11
+ return $log.string
12
+ ensure
13
+ $log = old
14
+ end
15
+
16
+ # def capture
17
+ # old = $stdout
18
+ # $stdout = StringIO.new('','w')
19
+ # yield
20
+ # $stdout.string
21
+ # ensure
22
+ # $stdout = old
23
+ # end
@@ -0,0 +1,46 @@
1
+ require_relative '../helper'
2
+ require 'fluent/plugin/out_stdout_pp'
3
+
4
+ class StdoutOutputPPTest < Test::Unit::TestCase
5
+ def setup
6
+ Fluent::Test.setup
7
+ end
8
+
9
+ CONFIG = %[
10
+ ]
11
+
12
+ def create_driver(conf = CONFIG)
13
+ Fluent::Test::OutputTestDriver.new(Fluent::StdoutPPOutput).configure(conf)
14
+ end
15
+
16
+ def test_configure
17
+ d = create_driver
18
+ assert_equal Symbol, d.instance.time_color.class
19
+ assert_equal Symbol, d.instance.tag_color.class
20
+ end
21
+
22
+ def test_emit
23
+ d = create_driver
24
+ time = Time.now
25
+ out = capture { d.emit({'test' => 'test'}, time) }
26
+ assert_equal "\e[1;34m#{time.localtime}\e[0;39m \e[1;33mtest\e[0;39m: {\n \e[35m\e[1;35m\"\e[0m\e[35mtest\e[1;35m\"\e[0m\e[35m\e[0m: \e[31m\e[1;31m\"\e[0m\e[31mtest\e[1;31m\"\e[0m\e[31m\e[0m\n}\n", out
27
+ end
28
+
29
+ def test_emit_no_color
30
+ d = create_driver(CONFIG + "record_colored false\n")
31
+ time = Time.now
32
+ record = {'test' => 'test'}
33
+ out = capture { d.emit(record, time) }
34
+ assert_equal "\e[1;34m#{time.localtime}\e[0;39m \e[1;33mtest\e[0;39m: #{JSON.pretty_generate(record)}\n", out
35
+ end
36
+
37
+ def test_emit_without_pp
38
+ d = create_driver(CONFIG + "pp false\n")
39
+ time = Time.now
40
+ record = {'test' => 'test'}
41
+ out = capture { d.emit(record, time) }
42
+
43
+ assert_equal "\e[1;34m#{time.localtime}\e[0;39m \e[1;33mtest\e[0;39m: {\e[35m\e[1;35m\"\e[0m\e[35mtest\e[1;35m\"\e[0m\e[35m\e[0m:\e[31m\e[1;31m\"\e[0m\e[31mtest\e[1;31m\"\e[0m\e[31m\e[0m}\n", out
44
+ end
45
+ end
46
+
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-stdout-pp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coderay
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: A fluentd plugin to pretty print json with color to stdout
@@ -59,13 +59,15 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
66
66
  - Rakefile
67
67
  - fluent-plugin-stdout-pp.gemspec
68
68
  - lib/fluent/plugin/out_stdout_pp.rb
69
+ - test/helper.rb
70
+ - test/plugin/test_out_stdout_pp.rb
69
71
  homepage: https://github.com/sabottenda/fluent-plugin-stdout-pp
70
72
  licenses:
71
73
  - MIT
@@ -76,18 +78,20 @@ require_paths:
76
78
  - lib
77
79
  required_ruby_version: !ruby/object:Gem::Requirement
78
80
  requirements:
79
- - - '>='
81
+ - - ">="
80
82
  - !ruby/object:Gem::Version
81
83
  version: '0'
82
84
  required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  requirements:
84
- - - '>='
86
+ - - ">="
85
87
  - !ruby/object:Gem::Version
86
88
  version: '0'
87
89
  requirements: []
88
90
  rubyforge_project:
89
- rubygems_version: 2.0.7
91
+ rubygems_version: 2.2.2
90
92
  signing_key:
91
93
  specification_version: 4
92
94
  summary: A fluentd plugin to pretty print json with color to stdout
93
- test_files: []
95
+ test_files:
96
+ - test/helper.rb
97
+ - test/plugin/test_out_stdout_pp.rb