elasticshelf 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df5d7240ce8328b331e0fa12a50fa8dc643026fe
4
+ data.tar.gz: 9d3171890bd33fdb4d0d792336b691eab28b7be4
5
+ SHA512:
6
+ metadata.gz: c0c30720d27c9028e9a207ddac05b4f9bbaeca3d813a2582fe3b1542e0de2f2701313f4f9102e46febadac9cd49f59ff9ac0f3abee8244291478ee1aef0f3a3f
7
+ data.tar.gz: e16ffb10bcf847d4325d2af1daafebee8de7166574eabc7a4d4f0edfc7df29c3429e2eea9c7ab3c5b6bbe731c8c595579cdce9387787bb480b182fafc6374cd5
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ __cls.txt
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in shelver.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Chris Smith
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Elasticshelf
2
+
3
+ Ruby integrations for Elasticsearch indices management using close, open, delete, snapshot and restore.
4
+
5
+ Inspired by Curator at https://github.com/elasticsearch/curator.git, but if
6
+ you are an ophidiophobe, no worries, this is written in Ruby :-)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'elasticshelf'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install elasticshelf
21
+
22
+ ## Usage
23
+
24
+ The goal is to close, delete, snapshot, and restore Elasticsearch indices.
25
+
26
+ But for now you can:
27
+
28
+ $ es = Elasticshelf::Client.new(:host => '127.0.0.1:9200')
29
+
30
+ $ es.version
31
+
32
+ $ es.get_elasticsearch_version
33
+
34
+ $ es.get_lucene_version
35
+
36
+ $ es.get_info
37
+
38
+ $ es.get_cluster_state("some-index")
39
+
40
+ $ es.get_index_state("some-index")
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it ( http://github.com/<my-github-username>/elasticshelf/fork )
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'elasticshelf/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "elasticshelf"
8
+ spec.version = Elasticshelf::VERSION
9
+ spec.authors = ["cLee Smith"]
10
+ spec.email = ["cleesmith2006@gmail.com"]
11
+ spec.summary = "Ruby integrations for Elasticsearch indices management"
12
+ spec.description = "Ruby integrations for Elasticsearch indices management using close, open, delete, snapshot, and restore"
13
+ spec.homepage = "https://github.com/cleesmith/elasticshelf.git"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "elasticsearch", '1.0.1'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,4 @@
1
+ module Elasticshelf
2
+ # Elasticshelf::VERSION
3
+ VERSION = "0.0.1"
4
+ end
@@ -0,0 +1,52 @@
1
+ require 'elasticsearch'
2
+ require "elasticshelf/version"
3
+
4
+ module Elasticshelf
5
+
6
+ module Client
7
+ attr_reader :client, :get_info, :version
8
+
9
+ def new(arguments={})
10
+ @client = Elasticsearch::Transport::Client.new(arguments)
11
+ self
12
+ end
13
+ extend self
14
+
15
+ def get_index_state(index_name, metric='metadata')
16
+ index_metadata = @client.cluster.state(:index => index_name, :metric => metric)
17
+ index_metadata['metadata']['indices'][index_name]['state']
18
+ end
19
+
20
+ def get_cluster_state(index_name, metric='metadata')
21
+ index_metadata = @client.cluster.state(:index => index_name, :metric => metric)
22
+ index_metadata
23
+ end
24
+
25
+ def get_info
26
+ @client.info
27
+ end
28
+
29
+ def get_elasticsearch_version
30
+ info_hash = @client.info
31
+ info_hash_blank = info_hash.respond_to?(:empty?) ? info_hash.empty? : !info_hash
32
+ return nil if info_hash_blank
33
+ return nil unless info_hash['status'] == 200
34
+ return nil if info_hash['version'].respond_to?(:empty?) ? info_hash['version'].empty? : !info_hash['version']
35
+ info_hash['version']['number']
36
+ end
37
+
38
+ def get_lucene_version
39
+ info_hash = @client.info
40
+ info_hash_blank = info_hash.respond_to?(:empty?) ? info_hash.empty? : !info_hash
41
+ return nil if info_hash_blank
42
+ return nil unless info_hash['status'] == 200
43
+ return nil if info_hash['version'].respond_to?(:empty?) ? info_hash['version'].empty? : !info_hash['version']
44
+ info_hash['version']['lucene_version']
45
+ end
46
+
47
+ def version
48
+ Elasticshelf::VERSION
49
+ end
50
+ end
51
+
52
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elasticshelf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - cLee Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: elasticsearch
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Ruby integrations for Elasticsearch indices management using close, open,
56
+ delete, snapshot, and restore
57
+ email:
58
+ - cleesmith2006@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - elasticshelf.gemspec
69
+ - lib/elasticshelf.rb
70
+ - lib/elasticshelf/version.rb
71
+ homepage: https://github.com/cleesmith/elasticshelf.git
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Ruby integrations for Elasticsearch indices management
95
+ test_files: []