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 CHANGED
@@ -9,7 +9,7 @@ class PapertrailSearch
9
9
  def run
10
10
  options = {
11
11
  :configfile => File.expand_path('~/.papertrail.yml'),
12
- :delay => 30,
12
+ :delay => 10,
13
13
  :follow => false
14
14
  }
15
15
 
@@ -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
- @conn = Faraday::Connection.new(:url => 'https://papertrailapp.com', :ssl => { :verify => OpenSSL::SSL::VERIFY_PEER }) do |builder|
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']}"
@@ -1,5 +1,5 @@
1
1
  module PapertrailCli
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
4
4
 
5
5
  require 'papertrail/search_client'
@@ -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.5.0'
17
- s.date = '2011-03-24'
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: 11
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.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-03-24 00:00:00 -07:00
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.3.7
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.