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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c287ef1568268d6329315195b6f2255a6cca268
4
- data.tar.gz: d700cae1c877b2009112ec5125ba615f66444bb1
3
+ metadata.gz: e13c00ed9f42cd2d40691d5f1acfa125fffcf284
4
+ data.tar.gz: 1aef0c43f773b32ac03d1f45773f52f94787a079
5
5
  SHA512:
6
- metadata.gz: 9bfeb51bc5202b6185a168e1c38b4a705248f01357191ef8bc2198b1b8f3d6b715762d8ac367b8d72ba397cf2e894c3a51183f37b8ebdbc06dda77b9ecce646d
7
- data.tar.gz: 41009a197052df5f4b0030e14f970a2964d70c79e8157f0d62b5e6fb760009d35dc2ebdbe1123bfdc0b05e0079f6d4b27c80ea27cf3c6b21cb6e3bbbca297a63
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"
@@ -210,12 +210,12 @@ module Ej
210
210
  puts_json(@core.refresh)
211
211
  end
212
212
 
213
- desc 'info', 'view nodes info'
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 'stats', 'view nodes stats'
218
+ desc 'nodes_stats', 'view nodes stats'
219
219
  def nodes_stats
220
220
  puts_json @core.nodes_stats
221
221
  end
@@ -1,3 +1,3 @@
1
1
  module Ej
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
@@ -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
@@ -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
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'ej'
3
+
4
+ describe Ej do
5
+ it "should have a VERSION constant" do
6
+ subject.const_get('VERSION').should_not be_empty
7
+ end
8
+ end
@@ -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.9
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-08 00:00:00.000000000 Z
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.2.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: