miu 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/miu +1 -2
- data/lib/miu/cli.rb +17 -1
- data/lib/miu/plugin.rb +3 -0
- data/lib/miu/plugins/null.rb +7 -5
- data/lib/miu/version.rb +1 -1
- data/lib/miu.rb +22 -2
- data/lib/templates/Gemfile +5 -0
- data/lib/templates/config/fluent.conf +7 -0
- data/lib/templates/config/miu.god +2 -2
- data/miu.gemspec +1 -3
- metadata +5 -37
data/bin/miu
CHANGED
data/lib/miu/cli.rb
CHANGED
@@ -35,10 +35,26 @@ module Miu
|
|
35
35
|
desc 'init', 'Generates a miu configuration files'
|
36
36
|
def init
|
37
37
|
copy_file 'Gemfile'
|
38
|
-
|
38
|
+
inside 'config' do
|
39
|
+
template 'fluent.conf'
|
40
|
+
template 'miu.god'
|
41
|
+
end
|
39
42
|
empty_directory 'log'
|
40
43
|
empty_directory 'tmp/pids'
|
41
44
|
end
|
45
|
+
|
46
|
+
desc 'start', 'Start miu'
|
47
|
+
def start
|
48
|
+
require 'god'
|
49
|
+
run "bundle exec god -c #{Miu.default_god_config}"
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'god', 'Miu is a god'
|
53
|
+
def god(*args)
|
54
|
+
require 'god'
|
55
|
+
args.unshift "bundle exec god -p #{Miu.default_god_port}"
|
56
|
+
run args.join(' ')
|
57
|
+
end
|
42
58
|
end
|
43
59
|
end
|
44
60
|
|
data/lib/miu/plugin.rb
CHANGED
data/lib/miu/plugins/null.rb
CHANGED
@@ -5,6 +5,8 @@ module Miu
|
|
5
5
|
class Null
|
6
6
|
include Miu::Plugin
|
7
7
|
|
8
|
+
DEFAULT_PORT = Miu.default_port + 10
|
9
|
+
|
8
10
|
class Handler
|
9
11
|
def log(tag, time, record)
|
10
12
|
end
|
@@ -25,29 +27,29 @@ module Miu
|
|
25
27
|
register :null, :desc => 'Null plugin' do
|
26
28
|
desc 'start', 'start null'
|
27
29
|
option :bind, :type => :string, :default => '0.0.0.0', :desc => 'bind address', :aliases => '-a'
|
28
|
-
option :port, :type => :numeric, :default =>
|
30
|
+
option :port, :type => :numeric, :default => DEFAULT_PORT, :desc => 'listen port', :aliases => '-p'
|
29
31
|
def start
|
30
32
|
Null.new options
|
31
33
|
end
|
32
34
|
|
33
35
|
desc 'init', 'init null config'
|
34
36
|
def init
|
35
|
-
append_to_file
|
37
|
+
append_to_file Miu.default_god_config, <<-CONF
|
36
38
|
|
37
39
|
God.watch do |w|
|
38
40
|
w.dir = Miu.root
|
39
|
-
w.log = Miu.root.join('log
|
41
|
+
w.log = Miu.root.join('log/null.log')
|
40
42
|
w.name = 'null'
|
41
43
|
w.start = 'bundle exec miu null start'
|
42
44
|
end
|
43
45
|
CONF
|
44
|
-
append_to_file
|
46
|
+
append_to_file Miu.default_fluent_config, <<-CONF
|
45
47
|
|
46
48
|
# miu null output plugin
|
47
49
|
<match miu.output.null>
|
48
50
|
type msgpack_rpc
|
49
51
|
host localhost
|
50
|
-
port
|
52
|
+
port #{DEFAULT_PORT}
|
51
53
|
</match>
|
52
54
|
CONF
|
53
55
|
end
|
data/lib/miu/version.rb
CHANGED
data/lib/miu.rb
CHANGED
@@ -6,6 +6,26 @@ module Miu
|
|
6
6
|
@root ||= find_root 'Gemfile'
|
7
7
|
end
|
8
8
|
|
9
|
+
def default_port
|
10
|
+
22200
|
11
|
+
end
|
12
|
+
|
13
|
+
def default_rpc_port
|
14
|
+
default_port
|
15
|
+
end
|
16
|
+
|
17
|
+
def default_god_port
|
18
|
+
default_port + 1
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_god_config
|
22
|
+
'config/miu.god'
|
23
|
+
end
|
24
|
+
|
25
|
+
def default_fluent_config
|
26
|
+
'config/fluent.conf'
|
27
|
+
end
|
28
|
+
|
9
29
|
def plugins
|
10
30
|
@plugins ||= {}
|
11
31
|
end
|
@@ -22,9 +42,9 @@ module Miu
|
|
22
42
|
def find_root(flag, base = nil)
|
23
43
|
require 'pathname'
|
24
44
|
path = base || Dir.pwd
|
25
|
-
while path && File.directory?(path) && File.exist?("#{path}/#{flag}")
|
45
|
+
while path && File.directory?(path) && !File.exist?("#{path}/#{flag}")
|
26
46
|
parent = File.dirname path
|
27
|
-
path = path != parent &&
|
47
|
+
path = path != parent && parent
|
28
48
|
end
|
29
49
|
raise 'Could not find root path' unless path
|
30
50
|
Pathname.new File.realpath(path)
|
data/lib/templates/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# vim: ft=ruby
|
2
2
|
require 'miu'
|
3
3
|
|
4
|
-
God.port =
|
4
|
+
God.port = Miu.default_god_port
|
5
5
|
God.pid_file_directory = Miu.root.join('tmp/pids')
|
6
6
|
|
7
7
|
God.watch do |w|
|
8
8
|
w.dir = Miu.root
|
9
9
|
w.log = Miu.root.join('log/fluentd.log')
|
10
10
|
w.name = 'fluentd'
|
11
|
-
w.start =
|
11
|
+
w.start = "bundle exec fluentd -c #{Miu.default_fluent_config}"
|
12
12
|
w.keepalive
|
13
13
|
end
|
data/miu.gemspec
CHANGED
@@ -19,9 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.add_dependency 'bundler'
|
21
21
|
gem.add_dependency 'thor'
|
22
|
-
gem.add_dependency '
|
23
|
-
gem.add_dependency 'fluentd'
|
24
|
-
gem.add_dependency 'msgpack-rpc'
|
22
|
+
gem.add_dependency 'saorin'
|
25
23
|
|
26
24
|
gem.add_development_dependency 'rake'
|
27
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -44,39 +44,7 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
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: fluentd
|
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
|
47
|
+
name: saorin
|
80
48
|
requirement: !ruby/object:Gem::Requirement
|
81
49
|
none: false
|
82
50
|
requirements:
|
@@ -145,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
113
|
version: '0'
|
146
114
|
segments:
|
147
115
|
- 0
|
148
|
-
hash: -
|
116
|
+
hash: -3747572747096164549
|
149
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
118
|
none: false
|
151
119
|
requirements:
|
@@ -154,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
122
|
version: '0'
|
155
123
|
segments:
|
156
124
|
- 0
|
157
|
-
hash: -
|
125
|
+
hash: -3747572747096164549
|
158
126
|
requirements: []
|
159
127
|
rubyforge_project:
|
160
128
|
rubygems_version: 1.8.24
|