scribe 0.1.2 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +0 -1
- data/Rakefile +2 -2
- data/lib/scribe.rb +1 -2
- data/lib/scribe/scribe.rb +6 -12
- data/scribe.gemspec +7 -7
- metadata +3 -5
- metadata.gz.sig +0 -0
- data/lib/scribe/safe_client.rb +0 -23
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
p.project = "fauna"
|
9
9
|
p.summary = "A Ruby client for the Scribe distributed log server."
|
10
10
|
p.rubygems_version = ">= 0.8"
|
11
|
-
p.dependencies = ['
|
11
|
+
p.dependencies = ['thrift_client', 'rake']
|
12
12
|
p.ignore_pattern = /^(vendor\/thrift)/
|
13
13
|
p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
|
14
14
|
p.url = "http://blog.evanweaver.com/files/doc/fauna/scribe/"
|
@@ -32,7 +32,7 @@ desc "Restart Scribe"
|
|
32
32
|
task :restart => ["stop", "scribe"] do
|
33
33
|
end
|
34
34
|
|
35
|
-
# desc "Regenerate thrift bindings for
|
35
|
+
# desc "Regenerate thrift bindings for Scribe" # Dev only
|
36
36
|
task :thrift do
|
37
37
|
puts "Generating Thrift bindings"
|
38
38
|
# FIXME
|
data/lib/scribe.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'rubygems'
|
3
|
-
require '
|
3
|
+
require 'thrift_client'
|
4
4
|
|
5
5
|
HERE = File.expand_path(File.dirname(__FILE__))
|
6
6
|
|
@@ -14,6 +14,5 @@ ScribeThrift.const_set("LogEntry", LogEntry)
|
|
14
14
|
Object.send(:remove_const, "LogEntry")
|
15
15
|
|
16
16
|
$LOAD_PATH << "#{HERE}"
|
17
|
-
require 'scribe/safe_client'
|
18
17
|
require 'scribe/scribe'
|
19
18
|
require 'scribe/debug' if ENV['DEBUG']
|
data/lib/scribe/scribe.rb
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
|
2
2
|
class Scribe
|
3
|
-
# Created a new client instance. Accepts an optional host
|
4
|
-
# category,
|
5
|
-
|
6
|
-
|
7
|
-
@
|
3
|
+
# Created a new client instance. Accepts an optional host and port, default
|
4
|
+
# category, flag to control whether newlines are added to each line, and
|
5
|
+
# additional settings to be passed to ThriftClient.
|
6
|
+
def initialize(servers = "127.0.0.1:1463", category = "Ruby", add_newlines = true, thrift_client_options = {})
|
7
|
+
@servers = servers
|
8
8
|
@category = category
|
9
9
|
@add_newlines = add_newlines
|
10
|
-
|
11
|
-
transport = Thrift::FramedTransport.new(Thrift::Socket.new(@host, @port))
|
12
|
-
transport.open
|
13
|
-
|
14
|
-
@client = ScribeThrift::SafeClient.new(
|
15
|
-
ScribeThrift::Client.new(Thrift::BinaryProtocol.new(transport, false)),
|
16
|
-
transport)
|
10
|
+
@client = ThriftClient.new(ScribeThrift::Client, @servers, thrift_client_options)
|
17
11
|
end
|
18
12
|
|
19
13
|
# Log a message. Accepts a string and an optional category.
|
data/scribe.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{scribe}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Evan Weaver"]
|
9
9
|
s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
|
10
|
-
s.date = %q{2009-10-
|
10
|
+
s.date = %q{2009-10-13}
|
11
11
|
s.description = %q{A Ruby client for the Scribe distributed log server.}
|
12
12
|
s.email = %q{}
|
13
|
-
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/scribe.rb", "lib/scribe/debug.rb", "lib/scribe/
|
14
|
-
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "conf/scribe.conf", "lib/scribe.rb", "lib/scribe/debug.rb", "lib/scribe/
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/scribe.rb", "lib/scribe/debug.rb", "lib/scribe/scribe.rb"]
|
14
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "conf/scribe.conf", "lib/scribe.rb", "lib/scribe/debug.rb", "lib/scribe/scribe.rb", "test/scribe_test.rb", "test/test_helper.rb", "vendor/gen-rb/facebook_service.rb", "vendor/gen-rb/fb303_constants.rb", "vendor/gen-rb/fb303_types.rb", "vendor/gen-rb/scribe.rb", "vendor/gen-rb/scribe_constants.rb", "vendor/gen-rb/scribe_types.rb", "scribe.gemspec"]
|
15
15
|
s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/scribe/}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Scribe", "--main", "README"]
|
17
17
|
s.require_paths = ["lib"]
|
@@ -26,14 +26,14 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.specification_version = 3
|
27
27
|
|
28
28
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
-
s.add_runtime_dependency(%q<
|
29
|
+
s.add_runtime_dependency(%q<thrift_client>, [">= 0"])
|
30
30
|
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
31
31
|
else
|
32
|
-
s.add_dependency(%q<
|
32
|
+
s.add_dependency(%q<thrift_client>, [">= 0"])
|
33
33
|
s.add_dependency(%q<rake>, [">= 0"])
|
34
34
|
end
|
35
35
|
else
|
36
|
-
s.add_dependency(%q<
|
36
|
+
s.add_dependency(%q<thrift_client>, [">= 0"])
|
37
37
|
s.add_dependency(%q<rake>, [">= 0"])
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Weaver
|
@@ -30,11 +30,11 @@ cert_chain:
|
|
30
30
|
yZ0=
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2009-10-
|
33
|
+
date: 2009-10-13 00:00:00 -07:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: thrift_client
|
38
38
|
type: :runtime
|
39
39
|
version_requirement:
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -65,7 +65,6 @@ extra_rdoc_files:
|
|
65
65
|
- README
|
66
66
|
- lib/scribe.rb
|
67
67
|
- lib/scribe/debug.rb
|
68
|
-
- lib/scribe/safe_client.rb
|
69
68
|
- lib/scribe/scribe.rb
|
70
69
|
files:
|
71
70
|
- CHANGELOG
|
@@ -76,7 +75,6 @@ files:
|
|
76
75
|
- conf/scribe.conf
|
77
76
|
- lib/scribe.rb
|
78
77
|
- lib/scribe/debug.rb
|
79
|
-
- lib/scribe/safe_client.rb
|
80
78
|
- lib/scribe/scribe.rb
|
81
79
|
- test/scribe_test.rb
|
82
80
|
- test/test_helper.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/scribe/safe_client.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
module ScribeThrift #:nodoc: all
|
3
|
-
class SafeClient
|
4
|
-
def initialize(client, transport, reset = false)
|
5
|
-
@client = client
|
6
|
-
@transport = transport
|
7
|
-
@reset = reset
|
8
|
-
end
|
9
|
-
|
10
|
-
def reset_transport
|
11
|
-
@transport.close rescue nil
|
12
|
-
@transport.open
|
13
|
-
end
|
14
|
-
|
15
|
-
def method_missing(*args)
|
16
|
-
reset_transport if @reset
|
17
|
-
@client.send(*args)
|
18
|
-
rescue IOError, UnavailableException, Thrift::ProtocolException, Thrift::ApplicationException, Thrift::TransportException
|
19
|
-
reset_transport
|
20
|
-
@client.send(*args)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|