elastomer-cli 0.2.2 → 0.2.3

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: 5d18eff5e75b895c06c49cebc0b63cc1cf0178b8
4
- data.tar.gz: 98c890b586b9fb012ef6aea147ef7524e3b81369
3
+ metadata.gz: b09a4148ac027157b8a858b8ca3efcd450195728
4
+ data.tar.gz: 9f8b7f6b2c1a4d5a4e758a204acf35c446763ceb
5
5
  SHA512:
6
- metadata.gz: a3d24db9d0994429e920ad616dc219c8d0befc4f59800554c9822191a91a123f6c457a8c82c33805c031d819f061f9c1c20cfffd89d5c6bdcaa3e3ef51dccdf6
7
- data.tar.gz: 222fd7a12c90a8487cae69d95fdfaecfc058ecdfeb41913db68c08fde10fb167ed0be081b3cf72732cce535b0d60069229c8c62ec53a5a20976977828418a2b6
6
+ metadata.gz: 839e9ea2e84aad6f21ee6353ef82a5b1f1ea26cdf384eefb7ec77919ab9a2aec4b54f63abe373626bf465f163477a0cb903c6fa9200a857d0ba3545230df5490
7
+ data.tar.gz: 322853197e039d9886ec4b4373f0ebc01f0a9f3bf67bb8c8a1b603c4728acb641d0517f45dae09ec4f1c08d7a3742eb892f92bf595dc774dc99723055afee859
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.3 (2014-10-21)
2
+ - Nonzero exit status if command fails
3
+ - New command:
4
+ - `index count`
5
+
1
6
  ## 0.2.2 (2014-10-08)
2
7
  - Fix tests
3
8
 
data/bin/elastomer CHANGED
@@ -2,4 +2,7 @@
2
2
 
3
3
  require 'elastomer/cli'
4
4
 
5
+ # Make Thor exit with nonzero status if a command fails
6
+ Elastomer::CLI.setup_failure_hook
7
+
5
8
  Elastomer::CLI.start
@@ -6,6 +6,12 @@ module Elastomer
6
6
  response = client.cluster.indices
7
7
  puts response.keys.sort
8
8
  end
9
+
10
+ desc "count [NAME] [TYPE]", "count documents in index NAME of type TYPE"
11
+ def count(index, type)
12
+ response = client.docs(index, type).search({:query => {:match_all => {}}}, :search_type => :count)
13
+ puts response["hits"]["total"]
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -1,5 +1,5 @@
1
1
  module Elastomer
2
2
  module Cli
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
data/lib/elastomer/cli.rb CHANGED
@@ -16,5 +16,20 @@ module Elastomer
16
16
  def self.start(*args)
17
17
  Elastomer::CLI::Application.start(*args)
18
18
  end
19
+
20
+ module FailureHook
21
+ # This method, defined on a Thor class, causes it to exit with nonzero
22
+ # status if a command fails. By default, Thor doesn't exit if a command
23
+ # fails, and the eventual exit status is zero (success).
24
+ def exit_on_failure?
25
+ true
26
+ end
27
+ end
28
+
29
+ # Force Thor to exit immediately with nonzero status if a command fails.
30
+ # This is probably what you want when running from the command line.
31
+ def self.setup_failure_hook
32
+ Base.extend(FailureHook)
33
+ end
19
34
  end
20
35
  end
data/test/node_test.rb CHANGED
@@ -10,7 +10,7 @@ describe Elastomer::CLI::Node do
10
10
  end
11
11
 
12
12
  it 'should get hot_threads for all nodes' do
13
- VCR.use_cassette('two_node_cluster', :record => :new_episodes) do
13
+ VCR.use_cassette('two_node_cluster') do
14
14
  elastomer 'node hot_threads'
15
15
  @out.must_match /^:::.*:9300/
16
16
  @out.must_match /^:::.*:9301/
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastomer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Rodgers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor