ej 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +27 -0
- data/ej.gemspec +1 -0
- data/lib/ej/commands.rb +2 -2
- data/lib/ej/version.rb +1 -1
- data/spec/commands_spec.rb +48 -0
- data/spec/core_spec.rb +31 -0
- data/spec/ej_spec.rb +8 -0
- data/spec/spec_helper.rb +24 -0
- metadata +26 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13c00ed9f42cd2d40691d5f1acfa125fffcf284
|
4
|
+
data.tar.gz: 1aef0c43f773b32ac03d1f45773f52f94787a079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21fdb6d389963d441e71fa521a68e125bd2756076b455b19244219d6b30f0848e729fbf333db3504c3c34336a0eaf9c102fd9be8ae616a02158882769ae892c4
|
7
|
+
data.tar.gz: 508a1b1389ea5b0b642b79a5710ce5f09176033aff2530333a539aebf4149aa039244a1ed3c2e2d8604d280704d9eebbe19e0ba9957ea217d8910435c1c56400
|
data/Rakefile
CHANGED
@@ -1 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require "bundler/gem_tasks"
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
begin
|
6
|
+
gem 'rubygems-tasks', '~> 0.2'
|
7
|
+
require 'rubygems/tasks'
|
8
|
+
|
9
|
+
Gem::Tasks.new
|
10
|
+
rescue LoadError => e
|
11
|
+
warn e.message
|
12
|
+
warn "Run `gem install rubygems-tasks` to install Gem::Tasks."
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
gem 'rspec', '~> 2.4'
|
17
|
+
require 'rspec/core/rake_task'
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new
|
20
|
+
rescue LoadError => e
|
21
|
+
task :spec do
|
22
|
+
abort "Please run `gem install rspec` to install RSpec."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
task :test => :spec
|
27
|
+
task :default => :spec
|
28
|
+
|
data/ej.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "pry"
|
24
24
|
spec.add_development_dependency "pry-doc"
|
25
|
+
spec.add_development_dependency 'rspec', '~> 2.4'
|
25
26
|
spec.add_runtime_dependency "thor"
|
26
27
|
spec.add_runtime_dependency "yajl-ruby"
|
27
28
|
spec.add_runtime_dependency "elasticsearch"
|
data/lib/ej/commands.rb
CHANGED
@@ -210,12 +210,12 @@ module Ej
|
|
210
210
|
puts_json(@core.refresh)
|
211
211
|
end
|
212
212
|
|
213
|
-
desc '
|
213
|
+
desc 'nodes_info', 'view nodes info'
|
214
214
|
def nodes_info
|
215
215
|
puts_json @core.nodes_info
|
216
216
|
end
|
217
217
|
|
218
|
-
desc '
|
218
|
+
desc 'nodes_stats', 'view nodes stats'
|
219
219
|
def nodes_stats
|
220
220
|
puts_json @core.nodes_stats
|
221
221
|
end
|
data/lib/ej/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ej'
|
3
|
+
|
4
|
+
describe Ej::Commands do
|
5
|
+
before do
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should exists search option" do
|
9
|
+
output = capture_stdout do
|
10
|
+
Ej::Commands.start(['help', 'search'])
|
11
|
+
end
|
12
|
+
output.should include('--type')
|
13
|
+
output.should include('--fields')
|
14
|
+
output.should include('--query')
|
15
|
+
output.should include('--size')
|
16
|
+
output.should include('--from')
|
17
|
+
output.should include('--source-only')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should exists copy option" do
|
21
|
+
output = capture_stdout do
|
22
|
+
Ej::Commands.start(['help', 'copy'])
|
23
|
+
end
|
24
|
+
output.should include('--source')
|
25
|
+
output.should include('--dest')
|
26
|
+
output.should include('--query')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should exists delete option" do
|
30
|
+
output = capture_stdout do
|
31
|
+
Ej::Commands.start(['help', 'delete'])
|
32
|
+
end
|
33
|
+
output.should include('--query')
|
34
|
+
output.should include('--index')
|
35
|
+
output.should include('--type')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should default check" do
|
39
|
+
output = capture_stdout do
|
40
|
+
Ej::Commands.start(['help', 'search'])
|
41
|
+
end
|
42
|
+
output.should include("Default: localhost")
|
43
|
+
output.should include("Default: _all")
|
44
|
+
end
|
45
|
+
|
46
|
+
after do
|
47
|
+
end
|
48
|
+
end
|
data/spec/core_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ej'
|
3
|
+
|
4
|
+
describe Ej::Core do
|
5
|
+
before do
|
6
|
+
@core = Core.new('localhost', '_all', false)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "core not nil" do
|
10
|
+
@core.should_not nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "parse json" do
|
14
|
+
@core.send(:parse_json, '{"id":1, "name":"rspec"}').should == [{"id" => 1, "name" => "rspec"}]
|
15
|
+
end
|
16
|
+
|
17
|
+
it "parse json" do
|
18
|
+
json = %[{"id":1, "name":"rspec"}
|
19
|
+
{"id":1, "name":"rspec"}
|
20
|
+
{"id":1, "name":"rspec"}
|
21
|
+
{"id":1, "name":"rspec"}]
|
22
|
+
@core.send(:parse_json, json).should == [{"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}, {"id" => 1, "name" => "rspec"}]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "generate id" do
|
26
|
+
@core.send(:generate_id, '%s_%s', {"id" => 1, "name" => "rspec"}, ['id', 'name']).should == '1_rspec'
|
27
|
+
end
|
28
|
+
|
29
|
+
after do
|
30
|
+
end
|
31
|
+
end
|
data/spec/ej_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
gem 'rspec', '~> 2.4'
|
2
|
+
require 'rspec'
|
3
|
+
require 'ej/version'
|
4
|
+
|
5
|
+
include Ej
|
6
|
+
|
7
|
+
def capture_stdout
|
8
|
+
out = StringIO.new
|
9
|
+
$stdout = out
|
10
|
+
yield
|
11
|
+
return out.string
|
12
|
+
ensure
|
13
|
+
$stdout = STDOUT
|
14
|
+
end
|
15
|
+
|
16
|
+
def capture_stderr
|
17
|
+
out = StringIO.new
|
18
|
+
$stderr = out
|
19
|
+
yield
|
20
|
+
return out.string
|
21
|
+
ensure
|
22
|
+
$stderr = STDERR
|
23
|
+
end
|
24
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ej
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toyama0919
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.4'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: thor
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +170,10 @@ files:
|
|
156
170
|
- lib/ej/commands.rb
|
157
171
|
- lib/ej/core.rb
|
158
172
|
- lib/ej/version.rb
|
173
|
+
- spec/commands_spec.rb
|
174
|
+
- spec/core_spec.rb
|
175
|
+
- spec/ej_spec.rb
|
176
|
+
- spec/spec_helper.rb
|
159
177
|
- template/ejrc.erb
|
160
178
|
- template/not_analyze_template.json
|
161
179
|
homepage: https://github.com/toyama0919/ej
|
@@ -178,9 +196,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
196
|
version: '0'
|
179
197
|
requirements: []
|
180
198
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.4.5
|
182
200
|
signing_key:
|
183
201
|
specification_version: 4
|
184
202
|
summary: elasticsearch command line utility.
|
185
|
-
test_files:
|
203
|
+
test_files:
|
204
|
+
- spec/commands_spec.rb
|
205
|
+
- spec/core_spec.rb
|
206
|
+
- spec/ej_spec.rb
|
207
|
+
- spec/spec_helper.rb
|
186
208
|
has_rdoc:
|