miu 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.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
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
18
+ vendor
19
+ db/*.db*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in miu.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 mashiro
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.
data/Procfile ADDED
@@ -0,0 +1,3 @@
1
+ store: bundle exec bin/miu store
2
+ fluentd: bundle exec fluentd -c config/fluent.conf
3
+
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Miu
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'miu'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install miu
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/miu ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+ require 'miu/cli'
4
+ require 'miu/store/cli'
5
+
6
+ Miu::CLI.start
@@ -0,0 +1,84 @@
1
+
2
+ ## built-in TCP input
3
+ ## $ echo <json> | fluent-cat <tag>
4
+ <source>
5
+ type forward
6
+ </source>
7
+
8
+ ## built-in UNIX socket input
9
+ #<source>
10
+ # type unix
11
+ #</source>
12
+
13
+ # HTTP input
14
+ # http://localhost:8888/<tag>?json=<json>
15
+ <source>
16
+ type http
17
+ port 8888
18
+ </source>
19
+
20
+ ## File input
21
+ ## read apache logs with tag=apache.access
22
+ #<source>
23
+ # type tail
24
+ # format apache
25
+ # path /var/log/httpd-access.log
26
+ # tag apache.access
27
+ #</source>
28
+
29
+ # Listen DRb for debug
30
+ <source>
31
+ type debug_agent
32
+ port 24230
33
+ </source>
34
+
35
+
36
+ ## match tag=apache.access and write to file
37
+ #<match apache.access>
38
+ # type file
39
+ # path /var/log/fluent/access
40
+ #</match>
41
+
42
+ ## match tag=debug.** and dump to console
43
+ <match debug.**>
44
+ type stdout
45
+ </match>
46
+
47
+ ## match tag=system.** and forward to another fluent server
48
+ #<match system.**>
49
+ # type forward
50
+ # host 192.168.0.11
51
+ # <secondary>
52
+ # host 192.168.0.12
53
+ # </secondary>
54
+ #</match>
55
+
56
+ ## match tag=myapp.** and forward and write to file
57
+ #<match myapp.**>
58
+ # type copy
59
+ # <store>
60
+ # type forward
61
+ # host 192.168.0.13
62
+ # buffer_type file
63
+ # buffer_path /var/log/fluent/myapp-forward
64
+ # retry_limit 50
65
+ # flush_interval 10s
66
+ # </store>
67
+ # <store>
68
+ # type file
69
+ # path /var/log/fluent/myapp
70
+ # </store>
71
+ #</match>
72
+
73
+ ## match fluent's internal events
74
+ #<match fluent.**>
75
+ # type null
76
+ #</match>
77
+
78
+ ## match not matched logs and write to file
79
+ #<match **>
80
+ # type file
81
+ # path /var/log/fluent/else
82
+ # compress gz
83
+ #</match>
84
+
data/config/store.rb ADDED
@@ -0,0 +1,3 @@
1
+ # options.database = '0.0.0.0'
2
+ # options.port = 30301
3
+
data/db/.gitkeep ADDED
File without changes
data/lib/miu/cli.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require 'miu'
3
+
4
+ module Miu
5
+ class CLI < Thor
6
+ map ['--version', '-v'] => :version
7
+
8
+ desc 'version', 'Show version'
9
+ def version
10
+ say "Miu #{Miu::VERSION}"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ require 'miu'
2
+ require 'miu/store'
3
+ require 'miu/cli'
4
+
5
+ module Miu
6
+ module Store
7
+ class CLI < Thor
8
+ include Thor::Actions
9
+
10
+ namespace :store
11
+
12
+ class << self
13
+ def source_root
14
+ Miu.root
15
+ end
16
+ end
17
+
18
+ desc 'start', 'Start miu store'
19
+ option :config, :type => :string, :desc => 'config file', :aliases => '-c'
20
+ option :address, :type => :string, :default => '0.0.0.0', :desc => 'bind address', :aliases => '-a'
21
+ option :port, :type => :numeric, :default => 30301, :desc => 'listen port', :aliases => '-p'
22
+ option :type, :type => :string, :default => 'groonga', :desc => 'store type', :aliases => '-t'
23
+ option :database, :type => :string, :default => 'db/miu.db', :desc => 'database'
24
+ def start
25
+ apply options[:config] if options[:config]
26
+ Miu::Store.start options
27
+ end
28
+ end
29
+ end
30
+
31
+ Miu::CLI.register Miu::Store::CLI, 'store', 'store [COMMAND]', 'Miu store'
32
+ end
@@ -0,0 +1,16 @@
1
+ require 'miu/store/strategy'
2
+
3
+ module Miu
4
+ module Store
5
+ module Strategies
6
+ class Null
7
+ include Miu::Store::Strategy
8
+
9
+ def log(tag, time, record)
10
+ end
11
+ end
12
+ end
13
+
14
+ register :null, Strategies::Null
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ require 'miu/store'
2
+
3
+ module Miu
4
+ module Store
5
+ module Strategy
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ end
12
+
13
+ def log(tag, time, record)
14
+ raise NotImplementedError
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/miu/store.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'msgpack/rpc'
2
+
3
+ module Miu
4
+ module Store
5
+ class << self
6
+ def strategies
7
+ @@strategies ||= {}
8
+ end
9
+
10
+ def register(name, type)
11
+ strategies[name.to_sym] = type
12
+ end
13
+
14
+ def start(options = {})
15
+ address = options[:address]
16
+ port = options[:port]
17
+ type = options[:type]
18
+
19
+ klass = Miu::Store.strategies[type.to_sym]
20
+
21
+ server = MessagePack::RPC::Server.new
22
+ server.listen address, port, klass.new(options)
23
+
24
+ [:TERM, :INT].each do |sig|
25
+ Signal.trap(sig) { server.stop }
26
+ end
27
+
28
+ server.run
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ require 'miu/store/strategies/null'
@@ -0,0 +1,3 @@
1
+ module Miu
2
+ VERSION = "0.0.1"
3
+ end
data/lib/miu.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'miu/version'
2
+ require 'miu/store'
3
+ require 'pathname'
4
+
5
+ module Miu
6
+ class << self
7
+ def root
8
+ Pathname.new(File.expand_path('../../', __FILE__))
9
+ end
10
+ end
11
+ end
data/miu.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'miu/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "miu"
8
+ gem.version = Miu::VERSION
9
+ gem.authors = ["mashiro"]
10
+ gem.email = ["mail@mashiro.org"]
11
+ gem.description = %q{miu miu}
12
+ gem.summary = %q{miu miu}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'thor'
21
+ gem.add_dependency 'foreman'
22
+ gem.add_dependency 'fluentd'
23
+ gem.add_dependency 'msgpack'
24
+ gem.add_dependency 'msgpack-rpc'
25
+
26
+ gem.add_development_dependency 'rake'
27
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: miu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mashiro
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: foreman
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: fluentd
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: msgpack
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: msgpack-rpc
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: miu miu
111
+ email:
112
+ - mail@mashiro.org
113
+ executables:
114
+ - miu
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - Procfile
122
+ - README.md
123
+ - Rakefile
124
+ - bin/miu
125
+ - config/fluent.conf
126
+ - config/store.rb
127
+ - db/.gitkeep
128
+ - lib/miu.rb
129
+ - lib/miu/cli.rb
130
+ - lib/miu/store.rb
131
+ - lib/miu/store/cli.rb
132
+ - lib/miu/store/strategies/null.rb
133
+ - lib/miu/store/strategy.rb
134
+ - lib/miu/version.rb
135
+ - miu.gemspec
136
+ homepage: ''
137
+ licenses: []
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ segments:
149
+ - 0
150
+ hash: 1422047492336437771
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ segments:
158
+ - 0
159
+ hash: 1422047492336437771
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 1.8.24
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: miu miu
166
+ test_files: []