yoga_pants 0.1.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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - ree
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ # v0.1.0
4
+
5
+ - Added multi_search (thanks to @dhotson)
6
+
7
+ # v0.0.4
8
+
9
+ - Added basic failover functionality
10
+
11
+ # v0.0.3
12
+
13
+ - Added _bulk
14
+
15
+ # v0.0.2
16
+
17
+ - Build on Travis
18
+
19
+ # v0.0.1
20
+
21
+ - Initial commit
22
+ - Added get, post, put, delete, exists?
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in yoga_pants.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Jack Chen (chendo)
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,53 @@
1
+ # YogaPants
2
+
3
+ A lightweight ElasticSearch ruby gem.
4
+
5
+ ## Goals
6
+
7
+ * Super light-weight, super flexible
8
+ * No DSL for queries; only hashes
9
+ * Bulk indexing
10
+ * Threadsafe
11
+ * Handle a list of servers and fallback to other ones
12
+ * A solid base to build more complex ES libraries on top of.
13
+
14
+ ## Ruby compatibility
15
+
16
+ * 1.8.7
17
+ * 1.9.2
18
+ * 1.9.3
19
+ * rbx-18mode
20
+ * rbx-19mode
21
+ * ree
22
+
23
+ JRuby will probably be supported down the track when I allow other HTTP libraries since it's failing due to httpclient wanting openssl.
24
+
25
+ ## Build status
26
+
27
+ [![Build Status](https://secure.travis-ci.org/chendo/yoga_pants.png)](http://travis-ci.org/chendo/yoga_pants)
28
+
29
+ ## Installation
30
+
31
+ Add this line to your application's Gemfile:
32
+
33
+ gem 'yoga_pants'
34
+
35
+ And then execute:
36
+
37
+ $ bundle
38
+
39
+ Or install it yourself as:
40
+
41
+ $ gem install yoga_pants
42
+
43
+ ## Usage
44
+
45
+ TODO: Write usage instructions here
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new do |t|
10
+
11
+ end
@@ -0,0 +1,165 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: head
5
+ uri: http://localhost:9200/yoga_pants_test
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers: {}
10
+
11
+ response:
12
+ status:
13
+ code: 200
14
+ message: OK
15
+ headers:
16
+ Content-Type:
17
+ - text/plain; charset=UTF-8
18
+ Content-Length:
19
+ - "0"
20
+ body:
21
+ encoding: US-ASCII
22
+ string: ""
23
+ http_version:
24
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
25
+ - request:
26
+ method: delete
27
+ uri: http://localhost:9200/yoga_pants_test
28
+ body:
29
+ encoding: US-ASCII
30
+ string: ""
31
+ headers:
32
+ Query: []
33
+
34
+ Body: []
35
+
36
+ response:
37
+ status:
38
+ code: 200
39
+ message: OK
40
+ headers:
41
+ Content-Type:
42
+ - application/json; charset=UTF-8
43
+ Content-Length:
44
+ - "31"
45
+ body:
46
+ encoding: US-ASCII
47
+ string: "{\"ok\":true,\"acknowledged\":true}"
48
+ http_version:
49
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
50
+ - request:
51
+ method: head
52
+ uri: http://localhost:9200/yoga_pants_test_1
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ""
56
+ headers: {}
57
+
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: OK
62
+ headers:
63
+ Content-Type:
64
+ - text/plain; charset=UTF-8
65
+ Content-Length:
66
+ - "0"
67
+ body:
68
+ encoding: US-ASCII
69
+ string: ""
70
+ http_version:
71
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
72
+ - request:
73
+ method: delete
74
+ uri: http://localhost:9200/yoga_pants_test_1
75
+ body:
76
+ encoding: US-ASCII
77
+ string: ""
78
+ headers:
79
+ Query: []
80
+
81
+ Body: []
82
+
83
+ response:
84
+ status:
85
+ code: 200
86
+ message: OK
87
+ headers:
88
+ Content-Type:
89
+ - application/json; charset=UTF-8
90
+ Content-Length:
91
+ - "31"
92
+ body:
93
+ encoding: US-ASCII
94
+ string: "{\"ok\":true,\"acknowledged\":true}"
95
+ http_version:
96
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
97
+ - request:
98
+ method: post
99
+ uri: http://localhost:9200/yoga_pants_test
100
+ body:
101
+ encoding: US-ASCII
102
+ string: ""
103
+ headers:
104
+ Content-Type:
105
+ - application/x-www-form-urlencoded
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Content-Type:
112
+ - application/json; charset=UTF-8
113
+ Content-Length:
114
+ - "31"
115
+ body:
116
+ encoding: US-ASCII
117
+ string: "{\"ok\":true,\"acknowledged\":true}"
118
+ http_version:
119
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
120
+ - request:
121
+ method: put
122
+ uri: http://localhost:9200/yoga_pants_test/doc/_mapping
123
+ body:
124
+ encoding: UTF-8
125
+ string: "{\"doc\":{\"properties\":{\"foo\":{\"type\":\"string\"}}}}"
126
+ headers: {}
127
+
128
+ response:
129
+ status:
130
+ code: 200
131
+ message: OK
132
+ headers:
133
+ Content-Type:
134
+ - application/json; charset=UTF-8
135
+ Content-Length:
136
+ - "31"
137
+ body:
138
+ encoding: US-ASCII
139
+ string: "{\"ok\":true,\"acknowledged\":true}"
140
+ http_version:
141
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
142
+ - request:
143
+ method: post
144
+ uri: http://localhost:9200/yoga_pants_test/_refresh
145
+ body:
146
+ encoding: US-ASCII
147
+ string: ""
148
+ headers:
149
+ Content-Type:
150
+ - application/x-www-form-urlencoded
151
+ response:
152
+ status:
153
+ code: 200
154
+ message: OK
155
+ headers:
156
+ Content-Type:
157
+ - application/json; charset=UTF-8
158
+ Content-Length:
159
+ - "60"
160
+ body:
161
+ encoding: US-ASCII
162
+ string: "{\"ok\":true,\"_shards\":{\"total\":10,\"successful\":5,\"failed\":0}}"
163
+ http_version:
164
+ recorded_at: Mon, 25 Jun 2012 08:14:09 GMT
165
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,69 @@
1
+ ---
2
+ recorded_with: VCR 2.2.0
3
+ http_interactions:
4
+ - request:
5
+ method: post
6
+ uri: http://localhost:9200/_bulk?refresh
7
+ body:
8
+ string: |
9
+ {"index":{"_id":2,"_type":"doc","_index":"yoga_pants_test"}}
10
+ {"foo":"hello bulk"}
11
+ {"index":{"_id":2,"_type":"doc2","_index":"yoga_pants_test_1"}}
12
+ {"foo":"hello bulk 2"}
13
+
14
+ headers:
15
+ Content-Type:
16
+ - application/x-www-form-urlencoded
17
+ response:
18
+ status:
19
+ code: 200
20
+ message: OK
21
+ headers:
22
+ Content-Type:
23
+ - application/json; charset=UTF-8
24
+ Content-Length:
25
+ - "196"
26
+ body:
27
+ string: "{\"took\":41,\"items\":[{\"index\":{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"2\",\"_version\":1,\"ok\":true}},{\"index\":{\"_index\":\"yoga_pants_test_1\",\"_type\":\"doc2\",\"_id\":\"2\",\"_version\":1,\"ok\":true}}]}"
28
+ http_version:
29
+ recorded_at: Wed, 29 Aug 2012 07:04:31 GMT
30
+ - request:
31
+ method: get
32
+ uri: http://localhost:9200/yoga_pants_test/doc/2
33
+ body:
34
+ string: ""
35
+ headers: {}
36
+
37
+ response:
38
+ status:
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ Content-Type:
43
+ - application/json; charset=UTF-8
44
+ Content-Length:
45
+ - "113"
46
+ body:
47
+ string: "{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"2\",\"_version\":1,\"exists\":true, \"_source\" : {\"foo\":\"hello bulk\"}}"
48
+ http_version:
49
+ recorded_at: Wed, 29 Aug 2012 07:04:31 GMT
50
+ - request:
51
+ method: get
52
+ uri: http://localhost:9200/yoga_pants_test_1/doc2/2
53
+ body:
54
+ string: ""
55
+ headers: {}
56
+
57
+ response:
58
+ status:
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ Content-Type:
63
+ - application/json; charset=UTF-8
64
+ Content-Length:
65
+ - "118"
66
+ body:
67
+ string: "{\"_index\":\"yoga_pants_test_1\",\"_type\":\"doc2\",\"_id\":\"2\",\"_version\":1,\"exists\":true, \"_source\" : {\"foo\":\"hello bulk 2\"}}"
68
+ http_version:
69
+ recorded_at: Wed, 29 Aug 2012 07:04:31 GMT
@@ -0,0 +1,69 @@
1
+ ---
2
+ recorded_with: VCR 2.2.0
3
+ http_interactions:
4
+ - request:
5
+ method: post
6
+ uri: http://localhost:9200/_bulk?
7
+ body:
8
+ string: |
9
+ {"index":{"_index":"yoga_pants_test","_type":"doc","_id":1}}
10
+ {"bar":1}
11
+ {"index":{"_index":"yoga_pants_test","_type":"doc","_id":2}}
12
+ {"bar":"invalid"}
13
+
14
+ headers:
15
+ Content-Type:
16
+ - application/x-www-form-urlencoded
17
+ response:
18
+ status:
19
+ code: 200
20
+ message: OK
21
+ headers:
22
+ Content-Length:
23
+ - "289"
24
+ Content-Type:
25
+ - application/json; charset=UTF-8
26
+ body:
27
+ string: "{\"took\":1,\"items\":[{\"index\":{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"1\",\"_version\":2,\"ok\":true}},{\"index\":{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"2\",\"error\":\"MapperParsingException[Failed to parse [bar]]; nested: NumberFormatException[For input string: \\\"invalid\\\"]; \"}}]}"
28
+ http_version:
29
+ recorded_at: Wed, 29 Aug 2012 06:55:05 GMT
30
+ - request:
31
+ method: get
32
+ uri: http://localhost:9200/yoga_pants_test/doc/1
33
+ body:
34
+ string: ""
35
+ headers: {}
36
+
37
+ response:
38
+ status:
39
+ code: 200
40
+ message: OK
41
+ headers:
42
+ Content-Length:
43
+ - "102"
44
+ Content-Type:
45
+ - application/json; charset=UTF-8
46
+ body:
47
+ string: "{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"1\",\"_version\":2,\"exists\":true, \"_source\" : {\"bar\":1}}"
48
+ http_version:
49
+ recorded_at: Wed, 29 Aug 2012 06:55:05 GMT
50
+ - request:
51
+ method: get
52
+ uri: http://localhost:9200/yoga_pants_test/doc/2
53
+ body:
54
+ string: ""
55
+ headers: {}
56
+
57
+ response:
58
+ status:
59
+ code: 404
60
+ message: Not Found
61
+ headers:
62
+ Content-Length:
63
+ - "67"
64
+ Content-Type:
65
+ - application/json; charset=UTF-8
66
+ body:
67
+ string: "{\"_index\":\"yoga_pants_test\",\"_type\":\"doc\",\"_id\":\"2\",\"exists\":false}"
68
+ http_version:
69
+ recorded_at: Wed, 29 Aug 2012 06:55:05 GMT