flumify 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1,2 +1,2 @@
1
- rvm use ruby-1.8.7-p302@flumify
1
+ rvm use ruby-1.8.7@flumify
2
2
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flumify (0.0.1)
4
+ flumify (0.0.2)
5
5
  net-ssh (~> 2.1.4)
6
6
 
7
7
  GEM
data/lib/flumify.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.join(File.dirname(__FILE__), "ssh_connection")
2
2
  require File.join(File.dirname(__FILE__), "flume_master")
3
3
 
4
- class Flumify
4
+ class Flumify
5
5
 
6
6
  attr_accessor :the_internal_collector, :the_external_collector, :logical_nodes, :node_configurations
7
7
 
@@ -21,15 +21,15 @@ class Flumify
21
21
  end
22
22
 
23
23
  def logical_node(name, opts)
24
+ opts = {:startFromEnd => true}.merge(opts)
25
+
24
26
  @logical_nodes << "flume shell -c localhost -e 'exec spawn #{@server} #{name}.#{@server}'"
25
-
26
27
  if opts[:tail].include? "*"
27
- split = opts[:tail].split("*")
28
- directory = split[0]
29
- glob_pattern = ".*" + split[1]
30
- @node_configurations << "#{name}.#{@server} : tailDir( \"#{directory}\", \"#{glob_pattern}\" ) | { value(\"bucket\", \"#{opts[:bucket]}\") => agentBEChain(\"#{@the_internal_collector[:host]}:#{@the_internal_collector[:port]}\",\"#{@the_external_collector[:host]}:#{@the_external_collector[:port]}\") };"
28
+ directory = File.dirname(opts[:tail])
29
+ glob_pattern = File.basename(opts[:tail])
30
+ @node_configurations << "#{name}.#{@server} : tailDir( \"#{directory}\", \"#{glob_pattern}\", #{opts[:startFromEnd]} ) | { value(\"bucket\", \"#{opts[:bucket]}\") => agentBEChain(\"#{@the_internal_collector[:host]}:#{@the_internal_collector[:port]}\",\"#{@the_external_collector[:host]}:#{@the_external_collector[:port]}\") };"
31
31
  else
32
- @node_configurations << "#{name}.#{@server} : tail( \"#{opts[:tail]}\", true ) | { value(\"bucket\", \"#{opts[:bucket]}\") => agentBEChain(\"#{@the_internal_collector[:host]}:#{@the_internal_collector[:port]}\",\"#{@the_external_collector[:host]}:#{@the_external_collector[:port]}\") };"
32
+ @node_configurations << "#{name}.#{@server} : tail( \"#{opts[:tail]}\", #{opts[:startFromEnd]} ) | { value(\"bucket\", \"#{opts[:bucket]}\") => agentBEChain(\"#{@the_internal_collector[:host]}:#{@the_internal_collector[:port]}\",\"#{@the_external_collector[:host]}:#{@the_external_collector[:port]}\") };"
33
33
  end
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module Flumify
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/flumify_spec.rb CHANGED
@@ -45,12 +45,12 @@ describe "Flumify" do
45
45
  internal_collector :host => "ec2-foo", :port => 35853
46
46
  external_collector :host => "ec2-bar", :port => 35853
47
47
 
48
- logical_node "query", {:tail => "/path/to/query.log", :bucket => "ask-query"}
49
- logical_node "click", {:tail => "/path/to/click.log", :bucket => "ask-click"}
48
+ logical_node "query", {:tail => "/path/to/query.log", :bucket => "ask-query", :startFromEnd => true}
49
+ logical_node "click", {:tail => "/path/to/click.log", :bucket => "ask-click", :startFromEnd => false}
50
50
  end
51
51
 
52
52
  config.node_configurations.should include "query.ec2.us-west-1a : tail( \"/path/to/query.log\", true ) | { value(\"bucket\", \"ask-query\") => agentBEChain(\"ec2-foo:35853\",\"ec2-bar:35853\") };"
53
- config.node_configurations.should include "click.ec2.us-west-1a : tail( \"/path/to/click.log\", true ) | { value(\"bucket\", \"ask-click\") => agentBEChain(\"ec2-foo:35853\",\"ec2-bar:35853\") };"
53
+ config.node_configurations.should include "click.ec2.us-west-1a : tail( \"/path/to/click.log\", false ) | { value(\"bucket\", \"ask-click\") => agentBEChain(\"ec2-foo:35853\",\"ec2-bar:35853\") };"
54
54
  config.node_configurations.length.should == 2
55
55
  end
56
56
 
@@ -59,10 +59,10 @@ describe "Flumify" do
59
59
  internal_collector :host => "ec2-foo", :port => 35853
60
60
  external_collector :host => "ec2-bar", :port => 35853
61
61
 
62
- logical_node "query", {:tail => "/path/to/*.log", :bucket => "ask-query"}
62
+ logical_node "query", {:tail => "/path/to/.*.log", :bucket => "ask-query", :startFromEnd => false}
63
63
  end
64
64
 
65
- config.node_configurations.should include "query.ec2.us-west-1a : tailDir( \"/path/to/\", \".*.log\" ) | { value(\"bucket\", \"ask-query\") => agentBEChain(\"ec2-foo:35853\",\"ec2-bar:35853\") };"
65
+ config.node_configurations.should include "query.ec2.us-west-1a : tailDir( \"/path/to\", \".*.log\", false ) | { value(\"bucket\", \"ask-query\") => agentBEChain(\"ec2-foo:35853\",\"ec2-bar:35853\") };"
66
66
  config.node_configurations.length.should == 1
67
67
  end
68
68
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flumify
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Greenhall
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-05-26 00:00:00 +01:00
19
+ date: 2011-06-21 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements: []
91
91
 
92
92
  rubyforge_project: flumify
93
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.6.2
94
94
  signing_key:
95
95
  specification_version: 3
96
96
  summary: Simple flume configuration