papertrail-cli 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/papertrail +1 -1
- data/lib/papertrail/search_client.rb +16 -6
- data/lib/papertrail-cli.rb +1 -1
- data/papertrail-cli.gemspec +2 -2
- metadata +6 -6
data/bin/papertrail
CHANGED
@@ -5,12 +5,22 @@ require 'always_verify_ssl_certificates'
|
|
5
5
|
module Papertrail
|
6
6
|
class SearchClient
|
7
7
|
attr_accessor :username, :password, :conn
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(username, password)
|
10
10
|
@username = username
|
11
11
|
@password = password
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
ssl_options = { :verify => OpenSSL::SSL::VERIFY_PEER }
|
14
|
+
|
15
|
+
# Make Ubuntu OpenSSL work
|
16
|
+
#
|
17
|
+
# From: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/396818
|
18
|
+
# "[OpenSSL] does not presume to select a set of CAs by default."
|
19
|
+
if File.directory?('/etc/ssl/certs/ca-certificates.crt')
|
20
|
+
ssl_options[:ca_file] = '/etc/ssl/certs/ca-certificates.crt'
|
21
|
+
end
|
22
|
+
|
23
|
+
@conn = Faraday::Connection.new(:url => 'https://papertrailapp.com', :ssl => ssl_options) do |builder|
|
14
24
|
builder.basic_auth(@username, @password)
|
15
25
|
|
16
26
|
builder.adapter Faraday.default_adapter
|
@@ -19,7 +29,7 @@ module Papertrail
|
|
19
29
|
|
20
30
|
@max_id_seen = {}
|
21
31
|
end
|
22
|
-
|
32
|
+
|
23
33
|
# search for all events or a specific query, defaulting to all events since
|
24
34
|
# last result set (call with since=0 for all).
|
25
35
|
def search(q = nil, since = nil)
|
@@ -32,7 +42,7 @@ module Papertrail
|
|
32
42
|
response.body['events']
|
33
43
|
end
|
34
44
|
end
|
35
|
-
|
45
|
+
|
36
46
|
def params_for_query(q = nil, since = nil)
|
37
47
|
params = {}
|
38
48
|
params[:q] = q if q
|
@@ -40,7 +50,7 @@ module Papertrail
|
|
40
50
|
params[:min_id] = since if since
|
41
51
|
params
|
42
52
|
end
|
43
|
-
|
53
|
+
|
44
54
|
def self.format_events(events, &block)
|
45
55
|
events.each do |event|
|
46
56
|
yield "#{Time.parse(event['received_at']).strftime('%b %e %X')} #{event['hostname']} #{event['program']} #{event['message']}"
|
data/lib/papertrail-cli.rb
CHANGED
data/papertrail-cli.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'papertrail-cli'
|
16
|
-
s.version = '0.
|
17
|
-
s.date = '2011-
|
16
|
+
s.version = '0.6.0'
|
17
|
+
s.date = '2011-06-02'
|
18
18
|
s.rubyforge_project = 'papertrail-cli'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papertrail-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Papertrail
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-02 00:00:00 -07:00
|
19
19
|
default_executable: papertrail
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
requirements: []
|
110
110
|
|
111
111
|
rubyforge_project: papertrail-cli
|
112
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.4.2
|
113
113
|
signing_key:
|
114
114
|
specification_version: 2
|
115
115
|
summary: Command-line client for Papertrail hosted log management service.
|