papertrail 0.9.17 → 0.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/papertrail.rb +1 -1
- data/lib/papertrail/cli.rb +17 -3
- data/lib/papertrail/http_client.rb +15 -8
- data/papertrail.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 973d907611de02622b404c3fd7b1904e1158229c
|
4
|
+
data.tar.gz: 8286cef976ddf379f33b5bea083cfdfcc448e98c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b79a2b28652befee191d8415c879f3c92f7eecb3a92c1a4ba79ea37e871ce4baa21a57cb9cda3d9a6fe6e98b3bf38e5450c5c4e0bf676b1261c58c3fc3f5fac
|
7
|
+
data.tar.gz: 40a8d133cb3c17bb54eecec80ab9086f7c4c9e1edaa1fed9d521f97a3c598d3a2e52b2cc13c93f11e36e351d7b8f8b24153c9799542034adf788b96518049469
|
data/README.md
CHANGED
@@ -120,7 +120,7 @@ Count by source/system name (field 4):
|
|
120
120
|
2 fastly
|
121
121
|
|
122
122
|
For sum, mean, and statistics, see
|
123
|
-
[datamash](http://www.gnu.org/software/datamash/).
|
123
|
+
[datamash](http://www.gnu.org/software/datamash/) and [one-liners](https://www.gnu.org/software/datamash/alternatives/).
|
124
124
|
|
125
125
|
### Colors
|
126
126
|
|
data/lib/papertrail.rb
CHANGED
data/lib/papertrail/cli.rb
CHANGED
@@ -6,7 +6,6 @@ require 'ansi/core'
|
|
6
6
|
require 'papertrail'
|
7
7
|
require 'papertrail/connection'
|
8
8
|
require 'papertrail/cli_helpers'
|
9
|
-
require 'papertrail/okjson'
|
10
9
|
|
11
10
|
module Papertrail
|
12
11
|
class Cli
|
@@ -147,7 +146,7 @@ module Papertrail
|
|
147
146
|
|
148
147
|
connection.each_event(@query, query_options.merge(:min_time => min_time, :max_time => max_time)) do |event|
|
149
148
|
if options[:json]
|
150
|
-
|
149
|
+
output_raw_json(event.data)
|
151
150
|
else
|
152
151
|
display_result(event)
|
153
152
|
end
|
@@ -184,7 +183,7 @@ module Papertrail
|
|
184
183
|
|
185
184
|
def display_results(results)
|
186
185
|
if options[:json]
|
187
|
-
|
186
|
+
output_raw_json(results.data)
|
188
187
|
else
|
189
188
|
results.events.each do |event|
|
190
189
|
display_result(event)
|
@@ -194,6 +193,21 @@ module Papertrail
|
|
194
193
|
$stdout.flush
|
195
194
|
end
|
196
195
|
|
196
|
+
if RUBY_VERSION < '1.9'
|
197
|
+
# Ruby 1.8 doesn't have json in the standard lib - so we have to use okjson
|
198
|
+
require 'papertrail/okjson'
|
199
|
+
|
200
|
+
def output_raw_json(hash)
|
201
|
+
$stdout.puts Papertrail::OkJson.encode(hash)
|
202
|
+
end
|
203
|
+
else
|
204
|
+
require 'json'
|
205
|
+
|
206
|
+
def output_raw_json(hash)
|
207
|
+
$stdout.puts JSON.generate(hash)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
197
211
|
def usage
|
198
212
|
<<-EOF
|
199
213
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'delegate'
|
2
2
|
require 'net/https'
|
3
3
|
|
4
|
-
require 'papertrail/okjson'
|
5
|
-
|
6
4
|
module Papertrail
|
7
5
|
|
8
6
|
# Used because Net::HTTPOK in Ruby 1.8 has no body= method
|
@@ -12,14 +10,23 @@ module Papertrail
|
|
12
10
|
super(response)
|
13
11
|
end
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
if RUBY_VERSION < '1.9'
|
14
|
+
# Ruby 1.8 doesn't have json in the standard lib - so we have to use okjson
|
15
|
+
require 'papertrail/okjson'
|
16
|
+
|
17
|
+
def body
|
18
|
+
if __getobj__.body.respond_to?(:force_encoding)
|
19
|
+
@body ||= Papertrail::OkJson.decode(__getobj__.body.dup.force_encoding('UTF-8'))
|
20
|
+
else
|
21
|
+
@body ||= Papertrail::OkJson.decode(__getobj__.body.dup)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
else
|
25
|
+
require 'json'
|
26
|
+
def body
|
27
|
+
@body ||= JSON.parse(__getobj__.body.dup)
|
20
28
|
end
|
21
29
|
end
|
22
|
-
|
23
30
|
end
|
24
31
|
|
25
32
|
class HttpClient
|
data/papertrail.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'
|
16
|
-
s.version = '0.9.
|
17
|
-
s.date = '2016-
|
16
|
+
s.version = '0.9.18'
|
17
|
+
s.date = '2016-11-28'
|
18
18
|
s.rubyforge_project = 'papertrail'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: papertrail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Papertrail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project: papertrail
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.4.8
|
117
117
|
signing_key:
|
118
118
|
specification_version: 2
|
119
119
|
summary: Command-line client for Papertrail hosted log management service.
|