fluent-plugin-yo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2a372296e78efcb43ceb89b430274462a2b3670a
4
+ data.tar.gz: 84e9335525a81a06d062b2283e3e1f0ff6dc3f9e
5
+ SHA512:
6
+ metadata.gz: 1c4da6797873fd6587c1831882c4f99b6a3d419d15df9e683adb17d5afb849b20022aad1a01e60bdabec01f66115dec73b112cc0d0eb17c5bf9a826bb0b1f150
7
+ data.tar.gz: 2f9494a979e68fde745828c0b7832f0f47f1b664da5f0a21af924a3072be9d6cc9a1aa4902aae10fe87eeae9e5c19dbd727294ecc4e9204a458ba708183d7834
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
4
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fluent-plugin-yo.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Uchio KONDO
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ # fluent-plugin-yo
2
+
3
+ A fluentd plugin to send Yo
4
+
5
+ ## Component
6
+
7
+ ### YoOutput
8
+
9
+ [Yo!](http://www.justyo.co/)
10
+
11
+ ## Configuration
12
+
13
+ * Registrer Yo API via http://yoapi.justyo.co/
14
+ * Register your account to API account in Yo app
15
+ * Configure as below:
16
+
17
+ ```xml
18
+ <match yo.**>
19
+ type yo
20
+ api_key foobarbuz
21
+ </match>
22
+ ```
23
+
24
+ * And then, it is useful to use [fluent-plugin-notifier](https://github.com/tagomoris/fluent-plugin-notifier) to emit yo tag.
25
+
26
+ ## See Also
27
+
28
+ - https://github.com/tagomoris/fluent-plugin-ikachan
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ end
6
+
7
+ task :test => :spec
8
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fluent-plugin-yo"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["Uchio KONDO"]
9
+ spec.email = ["udzura@udzura.jp"]
10
+ spec.description = "A fluentd plugin to send Yo"
11
+ spec.summary = "A fluentd plugin to send Yo"
12
+ spec.homepage = "https://github.com/udzura/fluent-plugin-yo"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "fluentd"
21
+ spec.add_dependency "yo-api"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "webmock"
27
+ end
@@ -0,0 +1,31 @@
1
+ require 'fluent/output'
2
+ module Fluent
3
+ class YoOutput < Fluent::Output
4
+ Fluent::Plugin.register_output('yo', self)
5
+
6
+ config_param :api_key, :string, :default => nil
7
+
8
+ def initialize
9
+ super
10
+ require 'yo'
11
+ end
12
+
13
+ def configure(conf)
14
+ super
15
+ raise Fluent::ConfigError, 'Visit http://yoapi.justyo.co/ and get an api key' if !@api_key or @api_key.empty?
16
+ @yo = Yo.new(@api_key)
17
+ end
18
+
19
+ def start; end
20
+ def shutdown; end
21
+
22
+ def emit(tag, es, chain)
23
+ begin
24
+ @yo.yo
25
+ rescue => e
26
+ raise Fluent::ConfigError, "Maybe Yo config is mistaken: #{e.class}, #{e.message}"
27
+ end
28
+ chain.next
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,40 @@
1
+ describe 'Fluent::YoOutput' do
2
+ before do
3
+ Fluent::Test.setup
4
+ end
5
+
6
+ let(:config) do
7
+ <<-EOC
8
+ api_key foobar
9
+ EOC
10
+ end
11
+
12
+ let(:tag) { 'testing.yo' }
13
+
14
+ let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::YoOutput, tag).configure(config) }
15
+
16
+ context 'configuration' do
17
+ it 'should be configured' do
18
+ expect(driver.instance.api_key).to eq 'foobar'
19
+ end
20
+
21
+ context 'when empty api key' do
22
+ let(:config) { 'api_key ' }
23
+ it {
24
+ expect { driver }.to raise_error(Fluent::ConfigError)
25
+ }
26
+ end
27
+ end
28
+
29
+ context 'send yo' do
30
+ it 'should send you yo' do
31
+ expected_request = stub_request(:post, "http://api.justyo.co/yoall/").
32
+ with(:body => {"api_token" => "foobar"})
33
+ driver.run do
34
+ driver.emit({'yo' => 'yo'})
35
+ end
36
+
37
+ expect(expected_request).to have_been_made.once
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,34 @@
1
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
2
+
3
+ RSpec.configure do |config|
4
+ config.run_all_when_everything_filtered = true
5
+ config.order = :random
6
+
7
+ config.expect_with :rspec do |expectations|
8
+ # http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
9
+ expectations.syntax = :expect
10
+ end
11
+
12
+ config.mock_with :rspec do |mocks|
13
+ # http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
14
+ mocks.syntax = :expect
15
+
16
+ # Prevents you from mocking or stubbing a method that does not exist on
17
+ # a real object. This is generally recommended.
18
+ mocks.verify_partial_doubles = true
19
+ end
20
+ end
21
+
22
+ require 'fluent/test'
23
+ unless ENV.has_key?('VERBOSE')
24
+ nulllogger = Object.new
25
+ nulllogger.instance_eval {|obj|
26
+ def method_missing(method, *args)
27
+ # pass
28
+ end
29
+ }
30
+ $log = nulllogger
31
+ end
32
+
33
+ require 'fluent/plugin/out_yo'
34
+ require 'webmock/rspec'
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-yo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Uchio KONDO
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: yo-api
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A fluentd plugin to send Yo
98
+ email:
99
+ - udzura@udzura.jp
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - fluent-plugin-yo.gemspec
111
+ - lib/fluent/plugin/out_yo.rb
112
+ - spec/lib/fluent/plugin/out_yo_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/udzura/fluent-plugin-yo
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.0.14
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: A fluentd plugin to send Yo
138
+ test_files:
139
+ - spec/lib/fluent/plugin/out_yo_spec.rb
140
+ - spec/spec_helper.rb