norikra-client 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/norikra/client/cli.rb +38 -0
- data/lib/norikra/client/version.rb +1 -1
- data/norikra-client.gemspec +5 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6183e9cb0a070faf36d6fc891491c1c9bd43b5a3
|
4
|
+
data.tar.gz: 68ea45b21887eaaf408471fa3d742a891b10acd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 297d02b12b2abfcc4ba04e214bfca5fb606f4134cf0863948e64114e711a386f6bce9790389027d2ec550869b35f0e71eaf9a49a7161f82bb3456d677b0ca692
|
7
|
+
data.tar.gz: eb9b5912be61a4acacedae3331e677f8015bfebda92fba58df6b2c1054c45131f38cc2650fe57907e760f500f77c9aa3eec934672a0b8963e01a30aa2701e933
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Command `norikra-client` and module `Norikra::Client` are provided for both of C
|
|
10
10
|
* For CRuby: `gem install norikra-client`
|
11
11
|
* For JRuby: `gem install norikra-client-jruby`
|
12
12
|
|
13
|
-
Both have a same API and same data
|
13
|
+
Both have a same API and same data representations. You can use which you want.
|
14
14
|
|
15
15
|
## Commands
|
16
16
|
|
@@ -71,13 +71,13 @@ Create new target on norikra server, to put events and queries. Returns true or
|
|
71
71
|
|
72
72
|
client.open('sample') #=> true
|
73
73
|
|
74
|
-
Without fields, the specified target will be
|
74
|
+
Without fields, the specified target will be opened as 'lazy' mode, and actually opened when first input event arrived. Default field set will be determined at that time.
|
75
75
|
|
76
76
|
With field definitions, `#open()` creates the target and actually opens it immediately.
|
77
77
|
|
78
78
|
client.open('sample', {id:'integer', name:'string', age:'integer', email:'string'})
|
79
79
|
|
80
|
-
|
80
|
+
Fields specified on `#open()` are configured as default field set.
|
81
81
|
|
82
82
|
`auto_field` means which fields in arrived events are automatically added on field list, or not. Default is true.
|
83
83
|
`auto_field: true` helps you to know What fields input event streams have. You can watch fields list on norikra, and write queries. But in cases your input streams have great many field name patterns, norikra returns long list of field names. That is not understandable. In these cases, you should specify `auto_field false`.
|
data/lib/norikra/client/cli.rb
CHANGED
@@ -121,6 +121,44 @@ class Norikra::Client
|
|
121
121
|
client(parent_options).resume(query_name)
|
122
122
|
end
|
123
123
|
end
|
124
|
+
|
125
|
+
desc "dump", "dump queries as JSON"
|
126
|
+
def dump
|
127
|
+
|
128
|
+
require 'json'
|
129
|
+
|
130
|
+
wrap do
|
131
|
+
queries = client(parent_options).queries
|
132
|
+
puts JSON.pretty_generate(queries)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
desc "sync", "sync queries from stdin(dump JSON)"
|
137
|
+
option :dry_run, :type => :boolean, :default => false, :desc => "dry run", :aliases => "-n"
|
138
|
+
def sync
|
139
|
+
|
140
|
+
require 'json'
|
141
|
+
|
142
|
+
wrap do
|
143
|
+
load_queries = JSON.load($stdin)
|
144
|
+
server_queries = client(parent_options).queries
|
145
|
+
prefix = options[:dry_run] ? "[dry-run] " : ""
|
146
|
+
|
147
|
+
(server_queries - load_queries).each do |q|
|
148
|
+
puts "#{prefix}remove query #{q}"
|
149
|
+
unless options[:dry_run]
|
150
|
+
client(parent_options).deregister(q['name'])
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
(load_queries - server_queries).each do |q|
|
155
|
+
puts "#{prefix}add query #{q}"
|
156
|
+
unless options[:dry_run]
|
157
|
+
client(parent_options).register(q['name'], q['group'], q['expression'])
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
124
162
|
end
|
125
163
|
|
126
164
|
class Field < Thor
|
data/norikra-client.gemspec
CHANGED
@@ -6,7 +6,11 @@ require 'norikra/client/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "norikra-client"
|
8
8
|
spec.version = Norikra::Client::VERSION
|
9
|
-
|
9
|
+
|
10
|
+
if /java/ =~ RUBY_PLATFORM
|
11
|
+
spec.platform = "java"
|
12
|
+
end
|
13
|
+
|
10
14
|
spec.authors = ["TAGOMORI Satoshi"]
|
11
15
|
spec.email = ["tagomoris@gmail.com"]
|
12
16
|
spec.description = %q{Client commands and libraries for Norikra}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: norikra-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack-rpc-over-http
|
@@ -126,3 +126,4 @@ signing_key:
|
|
126
126
|
specification_version: 4
|
127
127
|
summary: Client commands and libraries for Norikra
|
128
128
|
test_files: []
|
129
|
+
has_rdoc:
|