elasticsearch-extensions 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -0
- data/Rakefile +15 -0
- data/elasticsearch-extensions.gemspec +3 -1
- data/lib/elasticsearch/extensions/ansi.rb +15 -0
- data/lib/elasticsearch/extensions/ansi/response.rb +13 -1
- data/lib/elasticsearch/extensions/version.rb +1 -1
- metadata +36 -4
data/README.md
CHANGED
@@ -5,6 +5,22 @@ This library provides a set of extensions to the
|
|
5
5
|
|
6
6
|
## Extensions
|
7
7
|
|
8
|
+
### ANSI
|
9
|
+
|
10
|
+
Colorize and format selected Elasticsearch response parts in terminal:
|
11
|
+
|
12
|
+
Display formatted search results:
|
13
|
+
|
14
|
+
require 'elasticsearch/extensions/ansi'
|
15
|
+
puts Elasticsearch::Client.new.search.to_ansi
|
16
|
+
|
17
|
+
Display a table with the output of the `_analyze` API:
|
18
|
+
|
19
|
+
require 'elasticsearch/extensions/ansi'
|
20
|
+
puts Elasticsearch::Client.new.indices.analyze(text: 'Quick Brown Fox Jumped').to_ansi
|
21
|
+
|
22
|
+
[Full documentation](http://rubydoc.info/gems/elasticsearch-extensions/Elasticsearch/Extensions/ANSI).
|
23
|
+
|
8
24
|
## Installation
|
9
25
|
|
10
26
|
Install the package from [Rubygems](https://rubygems.org):
|
data/Rakefile
CHANGED
@@ -8,7 +8,19 @@ task :test => 'test:unit'
|
|
8
8
|
|
9
9
|
require 'rake/testtask'
|
10
10
|
namespace :test do
|
11
|
+
task :ci_reporter do
|
12
|
+
ENV['CI_REPORTS'] ||= 'tmp/reports'
|
13
|
+
if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
14
|
+
require 'ci/reporter/rake/test_unit'
|
15
|
+
Rake::Task['ci:setup:testunit'].invoke
|
16
|
+
else
|
17
|
+
require 'ci/reporter/rake/minitest'
|
18
|
+
Rake::Task['ci:setup:minitest'].invoke
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
11
22
|
Rake::TestTask.new(:unit) do |test|
|
23
|
+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
|
12
24
|
test.libs << 'lib' << 'test'
|
13
25
|
test.test_files = FileList["test/unit/**/*_test.rb"]
|
14
26
|
# test.verbose = true
|
@@ -16,16 +28,19 @@ namespace :test do
|
|
16
28
|
end
|
17
29
|
|
18
30
|
Rake::TestTask.new(:integration) do |test|
|
31
|
+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
|
19
32
|
test.libs << 'lib' << 'test'
|
20
33
|
test.test_files = FileList["test/integration/**/*_test.rb"]
|
21
34
|
end
|
22
35
|
|
23
36
|
Rake::TestTask.new(:all) do |test|
|
37
|
+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
|
24
38
|
test.libs << 'lib' << 'test'
|
25
39
|
test.test_files = FileList["test/unit/**/*_test.rb", "test/integration/**/*_test.rb"]
|
26
40
|
end
|
27
41
|
|
28
42
|
Rake::TestTask.new(:profile) do |test|
|
43
|
+
Rake::Task['test:ci_reporter'].invoke if ENV['CI']
|
29
44
|
test.libs << 'lib' << 'test'
|
30
45
|
test.test_files = FileList["test/profile/**/*_test.rb"]
|
31
46
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_dependency "elasticsearch", '0.4.0'
|
21
|
+
s.add_dependency "elasticsearch", '~> 0.4.0'
|
22
22
|
s.add_dependency "ansi"
|
23
23
|
|
24
24
|
|
@@ -30,10 +30,12 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_development_dependency "turn"
|
31
31
|
s.add_development_dependency "yard"
|
32
32
|
s.add_development_dependency "ruby-prof"
|
33
|
+
s.add_development_dependency "ci_reporter"
|
33
34
|
|
34
35
|
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
35
36
|
s.add_development_dependency "simplecov"
|
36
37
|
s.add_development_dependency "cane"
|
37
38
|
s.add_development_dependency "require-prof"
|
39
|
+
s.add_development_dependency "coveralls"
|
38
40
|
end
|
39
41
|
end
|
@@ -15,7 +15,22 @@ require 'elasticsearch/extensions/ansi/response'
|
|
15
15
|
|
16
16
|
module Elasticsearch
|
17
17
|
module Extensions
|
18
|
+
|
19
|
+
# This extension provides a {ResponseBody#to_ansi} method for the Elasticsearch response body,
|
20
|
+
# which colorizes and formats the output with the `ansi` gem.
|
21
|
+
#
|
22
|
+
# @example Display formatted search results
|
23
|
+
#
|
24
|
+
# require 'elasticsearch/extensions/ansi'
|
25
|
+
# puts Elasticsearch::Client.new.search.to_ansi
|
26
|
+
#
|
27
|
+
# @example Display a table with the output of the `_analyze` API
|
28
|
+
#
|
29
|
+
# require 'elasticsearch/extensions/ansi'
|
30
|
+
# puts Elasticsearch::Client.new.indices.analyze(text: 'Quick Brown Fox Jumped').to_ansi
|
31
|
+
#
|
18
32
|
module ANSI
|
19
33
|
end
|
34
|
+
|
20
35
|
end
|
21
36
|
end
|
@@ -10,7 +10,19 @@ module Elasticsearch
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Return a [colorized and formatted](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
13
|
-
# representation of the Elasticsearch response
|
13
|
+
# representation of the Elasticsearch response for:
|
14
|
+
#
|
15
|
+
# * Search results (hits and highlights)
|
16
|
+
# * Facets (terms, statistical, date_histogram)
|
17
|
+
# * Analyze API output
|
18
|
+
# * Shard allocation
|
19
|
+
#
|
20
|
+
# @example Display formatted search results
|
21
|
+
#
|
22
|
+
# require 'elasticsearch/extensions/ansi'
|
23
|
+
# puts Elasticsearch::Client.new.search.to_ansi
|
24
|
+
#
|
25
|
+
# @todo Add all facets and handlers for remaining response parts / types
|
14
26
|
#
|
15
27
|
def to_ansi(options={})
|
16
28
|
output = Actions.public_methods.select do |m|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: elasticsearch
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 0.4.0
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.4.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -155,6 +155,22 @@ dependencies:
|
|
155
155
|
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: ci_reporter
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
158
174
|
- !ruby/object:Gem::Dependency
|
159
175
|
name: simplecov
|
160
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,6 +219,22 @@ dependencies:
|
|
203
219
|
- - ! '>='
|
204
220
|
- !ruby/object:Gem::Version
|
205
221
|
version: '0'
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: coveralls
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
226
|
+
requirements:
|
227
|
+
- - ! '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
206
238
|
description: Extensions for the Elasticsearch Rubygem
|
207
239
|
email:
|
208
240
|
- karel.minarik@elasticsearch.org
|