fluent-plugin-nicorepo 0.0.1 → 0.0.2

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: 4c6ca92549a94b550f0d65129bba174327f43dfc
4
- data.tar.gz: 8c3b31a53a4c87e6be506eea425b6f5351bbe552
3
+ metadata.gz: 0a2dc10e30236f3ea0cea6b6742f035203c4230e
4
+ data.tar.gz: ea3c862aadb8c497c17223add433c8e4db47fb89
5
5
  SHA512:
6
- metadata.gz: 8ac7f885deaec8c8d28569ce9051f891183c4b4d3d611c409edd3d6e08212b855dc17690245d35107065706a2d532109eddcbc2370627cb33b5220be69b6a526
7
- data.tar.gz: 3035143e15b74ed99e7481ab14c0ae3f6c02db9729345af867c4b4fd2b977a8b459a533a5680a08ae257743596f4c022fd07d191e7e3b9057adf747f8f0f2565
6
+ metadata.gz: 5d024c75ca6d5911636597d92e8633e6983d967b0a9590cdcf1a0d6ce50c225a479218262d58dfc8c85094e605ed1b890c4ab4d903d36cad83e75a6bc6682d89
7
+ data.tar.gz: d1ab68a85d62481453d751b0acb4300a83e6f51e39f98fb9fc9281cd4bc18a5c1a56b19cf1a07e71fb8ac7872ad78aa88bee0b48f9526f4c90c65ee205f40873
data/Rakefile CHANGED
@@ -1,10 +1,17 @@
1
+ #!/usr/bin/env rake
1
2
  require "bundler/gem_tasks"
3
+
4
+ require 'fileutils'
2
5
  require 'rake/testtask'
3
- Rake::TestTask.new(:test) do |test|
4
- test.libs << 'lib' << 'test'
5
- test.pattern = 'test/**/test_*.rb'
6
- test.verbose = true
6
+
7
+ task test: [:base_test]
8
+
9
+ desc 'Run test_unit based test'
10
+ Rake::TestTask.new(:base_test) do |t|
11
+ t.libs << "test"
12
+ t.test_files = Dir["test/**/test_*.rb"].sort
13
+ t.verbose = true
14
+ t.warning = false
7
15
  end
8
16
 
9
17
  task :default => :test
10
-
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "fluent-plugin-nicorepo"
8
8
  spec.version = Fluent::Plugin::Nicorepo::VERSION
9
9
  spec.authors = ["upinetree"]
10
- spec.email = ["essequake@gmail.com"]
10
+ spec.email = ["upinetree@gmail.com"]
11
11
  spec.summary = %q{Fluent input plugin for Nicorepo}
12
12
  spec.description = %q{Fluent input plugin for Nicorepo.}
13
13
  spec.homepage = ""
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "fluentd"
22
- spec.add_runtime_dependency "nicorepo"
23
- spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_runtime_dependency "fluentd", "~> 0.12.37"
22
+ spec.add_runtime_dependency "nicorepo", "~> 0.0.8"
23
+ spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "test-unit", "~> 3.0"
26
27
  end
@@ -1,15 +1,23 @@
1
1
  require 'nicorepo'
2
+ require "fluent/input"
2
3
 
3
4
  module Fluent
4
5
  class NicorepoInput < Fluent::Input
5
- Plugin.register_input 'nicorepo', self
6
+ Plugin.register_input("nicorepo", self)
6
7
 
8
+ desc 'The tag of the event'
7
9
  config_param :tag, :string
10
+ desc 'The login main address for nicovideo'
8
11
  config_param :mail, :string
12
+ desc 'The login password for nicovideo'
9
13
  config_param :pass, :string
14
+ desc 'The interval of each fetching'
10
15
  config_param :interval, :time, default: 600
16
+ desc 'Max logs number at once fetch'
11
17
  config_param :limit_num, :integer, default: 50
18
+ desc 'Max pages number at once fetch'
12
19
  config_param :limit_page, :integer, default: 30
20
+ desc 'Acceptable log kind for the log filter'
13
21
  config_param :kind, :string, default: 'all'
14
22
 
15
23
  def configure(conf)
@@ -39,7 +47,7 @@ module Fluent
39
47
  reports.each do |report|
40
48
  time = Time.now
41
49
  record = report_to_hash(report)
42
- Engine.emit(@tag, time, record)
50
+ router.emit(@tag, time, record)
43
51
  end
44
52
  rescue => e
45
53
  log.error "unexpected error", error: e
@@ -66,12 +74,11 @@ module Fluent
66
74
 
67
75
  def report_to_hash(report)
68
76
  {
69
- body: report.body,
70
- title: report.title,
71
- url: report.url,
72
- date: report.date
77
+ 'body' => report.body,
78
+ 'title' => report.title,
79
+ 'url' => report.url,
80
+ 'date' => report.date
73
81
  }
74
82
  end
75
83
  end
76
84
  end
77
-
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Nicorepo
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
data/test/helper.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  require 'bundler'
2
2
  Bundler.setup
3
3
 
4
- require 'minitest/unit'
5
- require 'minitest/autorun'
6
-
7
4
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- require 'fluent/test'
10
- require 'fluent/plugin/in_nicorepo'
11
6
 
7
+ require 'pry'
8
+
9
+ require "fluent/test"
@@ -1,9 +1,7 @@
1
1
  require 'helper'
2
+ require 'fluent/plugin/in_nicorepo'
2
3
 
3
4
  class NicorepoDouble
4
- def initialize
5
- end
6
-
7
5
  def login(*)
8
6
  puts 'logined'
9
7
  end
@@ -18,7 +16,7 @@ class NicorepoDouble
18
16
  end
19
17
  end
20
18
 
21
- class NicorepoInputTest < MiniTest::Unit::TestCase
19
+ class NicorepoInputTest < Test::Unit::TestCase
22
20
  def setup
23
21
  Fluent::Test.setup
24
22
  Fluent::NicorepoInput.send(:const_set, :Nicorepo, NicorepoDouble)
@@ -38,7 +36,7 @@ class NicorepoInputTest < MiniTest::Unit::TestCase
38
36
  }
39
37
 
40
38
  def create_driver(conf = CONFIG)
41
- Fluent::Test::InputTestDriver.new(Fluent::NicorepoInput).configure(conf)
39
+ Fluent::Test::InputTestDriver.new(Fluent::NicorepoInput).configure(conf, true)
42
40
  end
43
41
 
44
42
  def test_configure
@@ -54,17 +52,14 @@ class NicorepoInputTest < MiniTest::Unit::TestCase
54
52
 
55
53
  def test_emit
56
54
  expected_record = {
57
- body: "report body",
58
- title: "report title",
59
- url: "report url",
60
- date: "report date"
55
+ 'body' => "report body",
56
+ 'title' => "report title",
57
+ 'url' => "report url",
58
+ 'date' => "report date"
61
59
  }
62
60
 
63
61
  d = create_driver
64
62
  d.run
65
- d.run
66
- # TODO: 2回runしないとemitsに反映されない原因を調べる
67
- # Fluent::Engine.emitは正しく実行されていることを確認
68
63
 
69
64
  assert_equal(expected_record, d.emits.first[2])
70
65
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-nicorepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - upinetree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2017-07-13 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'
19
+ version: 0.12.37
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'
26
+ version: 0.12.37
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nicorepo
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.0.8
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
- version: '0'
40
+ version: 0.0.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.6'
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
- version: '1.6'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,9 +80,23 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: test-unit
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
83
97
  description: Fluent input plugin for Nicorepo.
84
98
  email:
85
- - essequake@gmail.com
99
+ - upinetree@gmail.com
86
100
  executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
@@ -117,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
131
  version: '0'
118
132
  requirements: []
119
133
  rubyforge_project:
120
- rubygems_version: 2.2.2
134
+ rubygems_version: 2.6.11
121
135
  signing_key:
122
136
  specification_version: 4
123
137
  summary: Fluent input plugin for Nicorepo