elastics-admin 1.1.11 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8773291797d3150355adc83e85fed22bee4f6dbb
4
+ data.tar.gz: 112c1bb949bf45eadeec4c3ad9c1b821146604a8
5
+ SHA512:
6
+ metadata.gz: 1f083c1e7e26551e5f2238e37901f5b87c32805b4d2663e7eca7cbec295fd0df63327fd5b3258a87ef4d56e5f335e2c872b90b7fc3ced4fbecc82255e79a0e23
7
+ data.tar.gz: 33109c3432697c08231b9ec4d37839c98466d53040794f05c527874a87aef4e1580347c4bab78a3702b11ea7b884de72878d785a36bab405610cc9156c33d425
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.11
1
+ 1.2.0
@@ -1,6 +1,9 @@
1
1
  require 'date'
2
- version_path = %w[../VERSION ../../VERSION].detect{|v| File.exist?(File.expand_path(v, __FILE__))}
3
- version = File.read(File.expand_path(version_path, __FILE__)).strip
2
+ version_path = %w[VERSION ../VERSION].detect{|v| File.exist?(v)}
3
+ version = File.read(version_path).strip
4
+ extra_files = []
5
+ extra_files << 'VERSION' if File.exist?('VERSION')
6
+ extra_files << 'LICENSE' if File.exist?('LICENSE')
4
7
 
5
8
  Gem::Specification.new do |s|
6
9
  s.name = 'elastics-admin'
@@ -10,7 +13,7 @@ Gem::Specification.new do |s|
10
13
  s.authors = ["Domizio Demichelis"]
11
14
  s.email = 'dd.nexus@gmail.com'
12
15
  s.executables = %w[elastics-admin]
13
- s.files = `git ls-files -z`.split("\0") + %w[VERSION LICENSE]
16
+ s.files = `git ls-files -z`.split("\0") + extra_files
14
17
  s.version = version
15
18
  s.date = Date.today.to_s
16
19
  s.required_rubygems_version = ">= 1.3.6"
@@ -115,7 +115,7 @@ module Elastics
115
115
  if @ensure_indices && !@ensure_indices.include?(base)
116
116
  prefixed = @prefix + base
117
117
  unless @indices.include?(base)
118
- unless Elastics.exist?(:index => prefixed)
118
+ unless Elastics.indices_exists(:index => prefixed)
119
119
  Conf.indices.create_index(base, prefixed, :raise => false) # it might trigger an error if 2 threads create the index at the same time
120
120
  if Conf.optimize_indexing
121
121
  @refresh_intervals[index] ||= Elastics.get_index_settings(:index => prefixed)[prefixed]['settings']['index.refresh_interval']
@@ -145,6 +145,7 @@ module Elastics
145
145
  private
146
146
 
147
147
  def perform(opts={})
148
+ started_at = Time.now
148
149
  Prompter.say_title 'Live-Reindex' if opts[:verbose]
149
150
  if opts[:safe_reindex] == false
150
151
  Conf.logger.warn 'Safe reindex is disabled!'
@@ -237,6 +238,7 @@ module Elastics
237
238
 
238
239
  ensure
239
240
  Redis.reset_keys
241
+ Prompter.say_notice "Elapsed Time: #{fduration(Time.now - started_at)}."
240
242
  end
241
243
 
242
244
  def index_changes(opts)
@@ -303,5 +305,32 @@ module Elastics
303
305
  bulk_string
304
306
  end
305
307
 
308
+ private
309
+
310
+ def fduration(seconds)
311
+ seconds = seconds.round
312
+ days = (seconds / 86400)
313
+ hours = (seconds / 3600) % 24
314
+ mins = (seconds / 60) % 60
315
+ secs = seconds % 60
316
+ pluralize = lambda do |count, word|
317
+ case
318
+ when count == 1 then "1 #{word}"
319
+ when count > 1 then "#{count} #{word}s"
320
+ end
321
+ end
322
+ parts = []
323
+ parts << pluralize.call(days, 'day')
324
+ parts << pluralize.call(hours, 'hour')
325
+ parts << pluralize.call(mins, 'minute')
326
+ parts << pluralize.call(secs, 'second')
327
+ last = parts.pop
328
+
329
+ first = parts.compact.join(', ')
330
+ first = nil if first == ''
331
+
332
+ [first, last].compact.join(' and ')
333
+ end
334
+
306
335
  end
307
336
  end
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastics-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.11
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Domizio Demichelis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-17 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: elastics-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.1.11
19
+ version: 1.2.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.1.11
26
+ version: 1.2.0
30
27
  description: Provides binary and rake tasks to dump, load and optionally rename indices.
31
28
  Implements live-reindex with hot-swap of old code/index with new code/index.
32
29
  email: dd.nexus@gmail.com
@@ -35,40 +32,38 @@ executables:
35
32
  extensions: []
36
33
  extra_rdoc_files: []
37
34
  files:
35
+ - LICENSE
38
36
  - README.md
37
+ - VERSION
39
38
  - bin/elastics-admin
40
39
  - elastics-admin.gemspec
41
40
  - lib/elastics-admin.rb
42
41
  - lib/elastics/admin.rb
43
42
  - lib/elastics/admin_live_reindex.rb
44
43
  - lib/tasks.rake
45
- - VERSION
46
- - LICENSE
47
44
  homepage: http://elastics.github.io/elastics
48
45
  licenses:
49
46
  - MIT
47
+ metadata: {}
50
48
  post_install_message:
51
49
  rdoc_options:
52
- - --charset=UTF-8
50
+ - "--charset=UTF-8"
53
51
  require_paths:
54
52
  - lib
55
53
  required_ruby_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
- - - ! '>='
55
+ - - ">="
59
56
  - !ruby/object:Gem::Version
60
57
  version: '0'
61
58
  required_rubygems_version: !ruby/object:Gem::Requirement
62
- none: false
63
59
  requirements:
64
- - - ! '>='
60
+ - - ">="
65
61
  - !ruby/object:Gem::Version
66
62
  version: 1.3.6
67
63
  requirements: []
68
64
  rubyforge_project:
69
- rubygems_version: 1.8.25
65
+ rubygems_version: 2.4.5.1
70
66
  signing_key:
71
- specification_version: 3
67
+ specification_version: 4
72
68
  summary: Dump/load/rename/live-redindex one or more elasticsearch indices and types.
73
69
  test_files: []
74
- has_rdoc: