plunk 0.3.10 → 0.3.11
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/bin/plunk +12 -1
- data/lib/plunk.rb +10 -3
- data/lib/plunk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0870feaf4598dab6fc0dd14cfe797021d15e22
|
4
|
+
data.tar.gz: d65d9025b1384cd446da54d75091a8c072eb2986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a12882302f751b913ff4bab7157d26603ad8433ac2858a5de85dec4f9afe6d8a56d5308658e013cb1957effa9dee63f0640147b903e3fb5913befb5f42516d94
|
7
|
+
data.tar.gz: a8fe3b9d113537ed09113f3e69570381254e0c7dc3d21f7813576807a7311063eefb6a7adf2e7d5f07307eec968e4e2e045e2c81d794f1bce3beea4e44a9b541
|
data/bin/plunk
CHANGED
@@ -18,14 +18,25 @@ OptionParser.new do |opts|
|
|
18
18
|
options[:host] = h
|
19
19
|
end
|
20
20
|
|
21
|
+
opts.on(
|
22
|
+
"-p",
|
23
|
+
"--parse-only",
|
24
|
+
"parse but don't execute query, returning ES-compatible JSON"
|
25
|
+
) do |p|
|
26
|
+
|
27
|
+
options[:parse_only] = p
|
28
|
+
end
|
29
|
+
|
21
30
|
|
22
31
|
end.parse!
|
23
32
|
|
24
33
|
Plunk.configure do |c|
|
34
|
+
c.parse_only = options[:parse_only]
|
35
|
+
|
25
36
|
c.elasticsearch_client = Elasticsearch::Client.new(
|
26
37
|
host: options[:host].split(','),
|
27
38
|
randomize_hosts: true
|
28
|
-
)
|
39
|
+
) unless c.parse_only
|
29
40
|
end
|
30
41
|
|
31
42
|
puts Plunk.search($stdin.read).to_json
|
data/lib/plunk.rb
CHANGED
@@ -9,7 +9,8 @@ require 'plunk/result_set'
|
|
9
9
|
module Plunk
|
10
10
|
class << self
|
11
11
|
attr_accessor :elasticsearch_options, :elasticsearch_client,
|
12
|
-
:parser, :transformer, :max_number_of_hits, :timestamp_field, :logger
|
12
|
+
:parser, :transformer, :max_number_of_hits, :timestamp_field, :logger,
|
13
|
+
:parse_only
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.configure(&block)
|
@@ -17,7 +18,7 @@ module Plunk
|
|
17
18
|
self.timestamp_field ||= :timestamp
|
18
19
|
initialize_parser
|
19
20
|
initialize_transformer
|
20
|
-
initialize_elasticsearch
|
21
|
+
initialize_elasticsearch unless self.parse_only
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.initialize_elasticsearch
|
@@ -41,6 +42,12 @@ module Plunk
|
|
41
42
|
self.logger.debug "Parsed Output: #{transformed}"
|
42
43
|
end
|
43
44
|
|
44
|
-
ResultSet.new(transformed)
|
45
|
+
result_set = ResultSet.new(transformed)
|
46
|
+
|
47
|
+
if self.parse_only
|
48
|
+
result_set.query
|
49
|
+
else
|
50
|
+
result_set.eval
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
data/lib/plunk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plunk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ram Mehta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-05-
|
13
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|