crate_ruby 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55b4dfa8a269c3f83308ef19acaae60bb29198f6
4
- data.tar.gz: d217309dc244aa67205082d81b5306d38cd02df7
3
+ metadata.gz: 056090d63bf8c0b4811c9e67de0e66069f57867d
4
+ data.tar.gz: 69cf78fb1ec3cfca491ff4a2a9dbd4de640ca426
5
5
  SHA512:
6
- metadata.gz: 0f64c08fd539c392fe4d471e40841b9bd3d2124858c9e0f767c649f9faeb6a335ccb3859eb5519904dbf219185c3d1def0e6eb092d0be20cb51dcc864a3126d8
7
- data.tar.gz: b255048105ccc16c4cb3c208b0b6d9e1bdef02980e4af4f3e7eb1f4887313432da3d33b109902a6806e72266198c6fc94df2432ca6eb1442b882b921a2e7e057
6
+ metadata.gz: 79cbc4eac0dea687b3efc48f24fc755d1ff31c0d064cb71045ded13803766f7d59729cd04710a90a709e632c6c77df30d25f10160ac995fcd6b76c032382da5c
7
+ data.tar.gz: 8b1904bad9928255436323c53d22e8c6127b083a8eb357de3ccf0c055cbf6929a591b15817dd334ea771cc18604e8f2738e969001be7077d09484684fc4ee014
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.1.1"
5
+ - "2.0.0"
6
+ # uncomment this line if your project needs to run something other than `rake`:
7
+
8
+ before_script:
9
+ - wget https://cdn.crate.io/downloads/releases/crate-0.39.0.tar.gz -O /tmp/crate.tar.gz
10
+ - tar -xvf /tmp/crate.tar.gz
11
+ - ls
12
+ - echo $PWD
13
+ - bundle exec ruby spec/travis_test_server.rb $PWD/crate-0.39.0/ 4209
14
+
15
+ script: bundle exec rspec spec
16
+
data/CONTRIBUTING.rst ADDED
@@ -0,0 +1,91 @@
1
+ Contributing to Crate Ruby
2
+ ==========================
3
+
4
+ Thanks for considering contributing to crate active record adapter.
5
+
6
+
7
+ Reporting an issue
8
+ ------------------
9
+
10
+ - Search existing issues before raising a new one.
11
+
12
+ - include as much details as possible. This might include:
13
+
14
+ - Which OS you're using.
15
+
16
+ - Which version you've been running.
17
+
18
+ - Logs/Stacktrace of the error that occurred.
19
+
20
+ - Steps to reproduce.
21
+
22
+
23
+ Pull requests
24
+ -------------
25
+
26
+ Before we can accept any pull requests to CRATE Active Record Adapter we need you to agree to
27
+ our CLA_. Once that is done, we suggest to continue as follows:
28
+
29
+ - Add an issue on Github and let us know that you're working on something.
30
+
31
+ - Use a feature branch, not master.
32
+
33
+ - Rebase your feature branch onto origin/master before raising the PR
34
+
35
+ - Be descriptive in your PR and commit messages. What is it for, why is it
36
+ needed, etc.
37
+
38
+ - Squash related commits
39
+
40
+ .. _CLA: https://crate.io/contribute/agreements/
41
+
42
+
43
+ Rebase
44
+ ------
45
+
46
+ If while you've been working in the feature branch new commits were added to
47
+ the master branch please don't merge them but use rebase::
48
+
49
+ git fetch origin
50
+ git rebase origin/master
51
+
52
+ This will apply all commits on your feature branch on top of the master branch.
53
+ Any conflicts can be resolved just the same as if ``git merge`` was used. After
54
+ the conflict has been resolved use ``git rebase --continue`` to continue the
55
+ rebase process.
56
+
57
+
58
+ Squash
59
+ ------
60
+
61
+ Minor commits that only fix typos or rename variables that are related to a
62
+ bigger change should be squashed into that commit.
63
+
64
+ This can be done using ``git rebase -i ( <hash> | <branch> )``
65
+
66
+ For example while working on a feature branch you'd use::
67
+
68
+ git add .
69
+ git commit -m "implemented feature XY"
70
+
71
+ # push and ask for a merge/review
72
+
73
+ git add .
74
+ git commit --fixup $(git rev-parse HEAD)
75
+
76
+ # push and ask for a merge/review
77
+
78
+ git add .
79
+ git commit --fixup $(git rev-parse HEAD)
80
+
81
+ git rebase -i origin/master
82
+
83
+ ``git commit --fixup`` will mark the commit as a fixup relating to the commit
84
+ HEAD currently points to.
85
+
86
+ This is useful because ``git rebase -i`` will then automatically recognize the
87
+ fixup commits and mark them to squash. But in order for that to work the
88
+ ``autosquash`` setting has to be enabled in the ``.gitconfig``::
89
+
90
+ git config --global rebase.autosquash true
91
+
data/LICENSE ADDED
@@ -0,0 +1,219 @@
1
+ CRATE Ruby
2
+ Copyright 2013-2014 CRATE Technology GmbH ("Crate")
3
+
4
+
5
+ Licensed to CRATE Technology GmbH (referred to in this notice as "Crate")
6
+ under one or more contributor license agreements. See the NOTICE file
7
+ distributed with this work for additional information regarding copyright
8
+ ownership.
9
+
10
+ Crate licenses this software to you under the Apache License, Version 2.0.
11
+ However, if you have executed another commercial license agreement with
12
+ Crate these terms will supersede the license and you may use the software
13
+ solely pursuant to the terms of the relevant commercial agreement.
14
+
15
+
16
+ =========================================================================
17
+
18
+
19
+ Apache License
20
+ Version 2.0, January 2004
21
+ http://www.apache.org/licenses/
22
+
23
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
24
+
25
+ 1. Definitions.
26
+
27
+ "License" shall mean the terms and conditions for use, reproduction,
28
+ and distribution as defined by Sections 1 through 9 of this document.
29
+
30
+ "Licensor" shall mean the copyright owner or entity authorized by
31
+ the copyright owner that is granting the License.
32
+
33
+ "Legal Entity" shall mean the union of the acting entity and all
34
+ other entities that control, are controlled by, or are under common
35
+ control with that entity. For the purposes of this definition,
36
+ "control" means (i) the power, direct or indirect, to cause the
37
+ direction or management of such entity, whether by contract or
38
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
39
+ outstanding shares, or (iii) beneficial ownership of such entity.
40
+
41
+ "You" (or "Your") shall mean an individual or Legal Entity
42
+ exercising permissions granted by this License.
43
+
44
+ "Source" form shall mean the preferred form for making modifications,
45
+ including but not limited to software source code, documentation
46
+ source, and configuration files.
47
+
48
+ "Object" form shall mean any form resulting from mechanical
49
+ transformation or translation of a Source form, including but
50
+ not limited to compiled object code, generated documentation,
51
+ and conversions to other media types.
52
+
53
+ "Work" shall mean the work of authorship, whether in Source or
54
+ Object form, made available under the License, as indicated by a
55
+ copyright notice that is included in or attached to the work
56
+ (an example is provided in the Appendix below).
57
+
58
+ "Derivative Works" shall mean any work, whether in Source or Object
59
+ form, that is based on (or derived from) the Work and for which the
60
+ editorial revisions, annotations, elaborations, or other modifications
61
+ represent, as a whole, an original work of authorship. For the purposes
62
+ of this License, Derivative Works shall not include works that remain
63
+ separable from, or merely link (or bind by name) to the interfaces of,
64
+ the Work and Derivative Works thereof.
65
+
66
+ "Contribution" shall mean any work of authorship, including
67
+ the original version of the Work and any modifications or additions
68
+ to that Work or Derivative Works thereof, that is intentionally
69
+ submitted to Licensor for inclusion in the Work by the copyright owner
70
+ or by an individual or Legal Entity authorized to submit on behalf of
71
+ the copyright owner. For the purposes of this definition, "submitted"
72
+ means any form of electronic, verbal, or written communication sent
73
+ to the Licensor or its representatives, including but not limited to
74
+ communication on electronic mailing lists, source code control systems,
75
+ and issue tracking systems that are managed by, or on behalf of, the
76
+ Licensor for the purpose of discussing and improving the Work, but
77
+ excluding communication that is conspicuously marked or otherwise
78
+ designated in writing by the copyright owner as "Not a Contribution."
79
+
80
+ "Contributor" shall mean Licensor and any individual or Legal Entity
81
+ on behalf of whom a Contribution has been received by Licensor and
82
+ subsequently incorporated within the Work.
83
+
84
+ 2. Grant of Copyright License. Subject to the terms and conditions of
85
+ this License, each Contributor hereby grants to You a perpetual,
86
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87
+ copyright license to reproduce, prepare Derivative Works of,
88
+ publicly display, publicly perform, sublicense, and distribute the
89
+ Work and such Derivative Works in Source or Object form.
90
+
91
+ 3. Grant of Patent License. Subject to the terms and conditions of
92
+ this License, each Contributor hereby grants to You a perpetual,
93
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
94
+ (except as stated in this section) patent license to make, have made,
95
+ use, offer to sell, sell, import, and otherwise transfer the Work,
96
+ where such license applies only to those patent claims licensable
97
+ by such Contributor that are necessarily infringed by their
98
+ Contribution(s) alone or by combination of their Contribution(s)
99
+ with the Work to which such Contribution(s) was submitted. If You
100
+ institute patent litigation against any entity (including a
101
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
102
+ or a Contribution incorporated within the Work constitutes direct
103
+ or contributory patent infringement, then any patent licenses
104
+ granted to You under this License for that Work shall terminate
105
+ as of the date such litigation is filed.
106
+
107
+ 4. Redistribution. You may reproduce and distribute copies of the
108
+ Work or Derivative Works thereof in any medium, with or without
109
+ modifications, and in Source or Object form, provided that You
110
+ meet the following conditions:
111
+
112
+ (a) You must give any other recipients of the Work or
113
+ Derivative Works a copy of this License; and
114
+
115
+ (b) You must cause any modified files to carry prominent notices
116
+ stating that You changed the files; and
117
+
118
+ (c) You must retain, in the Source form of any Derivative Works
119
+ that You distribute, all copyright, patent, trademark, and
120
+ attribution notices from the Source form of the Work,
121
+ excluding those notices that do not pertain to any part of
122
+ the Derivative Works; and
123
+
124
+ (d) If the Work includes a "NOTICE" text file as part of its
125
+ distribution, then any Derivative Works that You distribute must
126
+ include a readable copy of the attribution notices contained
127
+ within such NOTICE file, excluding those notices that do not
128
+ pertain to any part of the Derivative Works, in at least one
129
+ of the following places: within a NOTICE text file distributed
130
+ as part of the Derivative Works; within the Source form or
131
+ documentation, if provided along with the Derivative Works; or,
132
+ within a display generated by the Derivative Works, if and
133
+ wherever such third-party notices normally appear. The contents
134
+ of the NOTICE file are for informational purposes only and
135
+ do not modify the License. You may add Your own attribution
136
+ notices within Derivative Works that You distribute, alongside
137
+ or as an addendum to the NOTICE text from the Work, provided
138
+ that such additional attribution notices cannot be construed
139
+ as modifying the License.
140
+
141
+ You may add Your own copyright statement to Your modifications and
142
+ may provide additional or different license terms and conditions
143
+ for use, reproduction, or distribution of Your modifications, or
144
+ for any such Derivative Works as a whole, provided Your use,
145
+ reproduction, and distribution of the Work otherwise complies with
146
+ the conditions stated in this License.
147
+
148
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
149
+ any Contribution intentionally submitted for inclusion in the Work
150
+ by You to the Licensor shall be under the terms and conditions of
151
+ this License, without any additional terms or conditions.
152
+ Notwithstanding the above, nothing herein shall supersede or modify
153
+ the terms of any separate license agreement you may have executed
154
+ with Licensor regarding such Contributions.
155
+
156
+ 6. Trademarks. This License does not grant permission to use the trade
157
+ names, trademarks, service marks, or product names of the Licensor,
158
+ except as required for reasonable and customary use in describing the
159
+ origin of the Work and reproducing the content of the NOTICE file.
160
+
161
+ 7. Disclaimer of Warranty. Unless required by applicable law or
162
+ agreed to in writing, Licensor provides the Work (and each
163
+ Contributor provides its Contributions) on an "AS IS" BASIS,
164
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
165
+ implied, including, without limitation, any warranties or conditions
166
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
167
+ PARTICULAR PURPOSE. You are solely responsible for determining the
168
+ appropriateness of using or redistributing the Work and assume any
169
+ risks associated with Your exercise of permissions under this License.
170
+
171
+ 8. Limitation of Liability. In no event and under no legal theory,
172
+ whether in tort (including negligence), contract, or otherwise,
173
+ unless required by applicable law (such as deliberate and grossly
174
+ negligent acts) or agreed to in writing, shall any Contributor be
175
+ liable to You for damages, including any direct, indirect, special,
176
+ incidental, or consequential damages of any character arising as a
177
+ result of this License or out of the use or inability to use the
178
+ Work (including but not limited to damages for loss of goodwill,
179
+ work stoppage, computer failure or malfunction, or any and all
180
+ other commercial damages or losses), even if such Contributor
181
+ has been advised of the possibility of such damages.
182
+
183
+ 9. Accepting Warranty or Additional Liability. While redistributing
184
+ the Work or Derivative Works thereof, You may choose to offer,
185
+ and charge a fee for, acceptance of support, warranty, indemnity,
186
+ or other liability obligations and/or rights consistent with this
187
+ License. However, in accepting such obligations, You may act only
188
+ on Your own behalf and on Your sole responsibility, not on behalf
189
+ of any other Contributor, and only if You agree to indemnify,
190
+ defend, and hold each Contributor harmless for any liability
191
+ incurred by, or claims asserted against, such Contributor by reason
192
+ of your accepting any such warranty or additional liability.
193
+
194
+ END OF TERMS AND CONDITIONS
195
+
196
+ APPENDIX: How to apply the Apache License to your work.
197
+
198
+ To apply the Apache License to your work, attach the following
199
+ boilerplate notice, with the fields enclosed by brackets "[]"
200
+ replaced with your own identifying information. (Don't include
201
+ the brackets!) The text should be enclosed in the appropriate
202
+ comment syntax for the file format. We also recommend that a
203
+ file or class name and description of purpose be included on the
204
+ same "printed page" as the copyright notice for easier
205
+ identification within third-party archives.
206
+
207
+ Copyright [yyyy] [name of copyright owner]
208
+
209
+ Licensed under the Apache License, Version 2.0 (the "License");
210
+ you may not use this file except in compliance with the License.
211
+ You may obtain a copy of the License at
212
+
213
+ http://www.apache.org/licenses/LICENSE-2.0
214
+
215
+ Unless required by applicable law or agreed to in writing, software
216
+ distributed under the License is distributed on an "AS IS" BASIS,
217
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
218
+ See the License for the specific language governing permissions and
219
+ limitations under the License.
data/NOTICE ADDED
@@ -0,0 +1,11 @@
1
+ Crate Ruby
2
+ Copyright 2013-2014 CRATE Technology GmbH ("Crate")
3
+
4
+
5
+ =========================================================================
6
+
7
+ Copyright (2014) by Christoph Klocker (http://www.vedanova.com)
8
+ Special thanks go to Christoph for launching and writing the
9
+ main parts of this project.
10
+
11
+ =========================================================================
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![Gem Version](https://badge.fury.io/rb/crate_ruby.svg)](http://badge.fury.io/rb/crate_ruby)
2
+ [![Build Status](https://travis-ci.org/crate/crate_ruby.svg?branch=master)](https://travis-ci.org/crate/crate_ruby)
3
+ [![Code Climate](https://codeclimate.com/github/crate/crate_ruby.png)](https://codeclimate.com/github/crate/crate_ruby)
4
+
5
+
1
6
  # CrateRuby
2
7
 
3
8
  Official Ruby library to access a [Crate](http://crate.io) database.
@@ -60,18 +65,15 @@ To run the tests start up the crate server first
60
65
 
61
66
  ## Contributing
62
67
 
63
- 1. Fork it ( `http://github.com/crate/crate_ruby/fork` )
64
- 2. Create your feature branch (`git checkout -b my-new-feature`)
65
- 3. Add some tests
66
- 4. Commit your changes (`git commit -am 'Add some feature'`)
67
- 5. Push to the branch (`git push origin my-new-feature`)
68
- 6. Create new Pull Request
68
+ If you think something is missing, either create a pull request
69
+ or log a new issue, so someone else can tackle it.
70
+ Please refer to CONTRIBUTING.rst for further information.
69
71
 
70
72
  ##Maintainer
71
73
 
74
+ * [CRATE Technology GmbH](http://crate.io)
72
75
  * [Christoph Klocker](http://www.vedanova.com), [@corck](http://www.twitter.com/corck)
73
76
 
74
- ##License
75
-
76
- MIT License. Copyright 2014 Vedanova. [http://vedanova.com](http://vedanova.com)
77
+ ##License & Copyright
78
+ See LICENSE for details.
77
79
 
data/crate_ruby.gemspec CHANGED
@@ -1,4 +1,24 @@
1
1
  # coding: utf-8
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
2
22
  lib = File.expand_path('../lib', __FILE__)
3
23
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
24
  require 'crate_ruby/version'
@@ -6,13 +26,12 @@ require 'crate_ruby/version'
6
26
  Gem::Specification.new do |spec|
7
27
  spec.name = "crate_ruby"
8
28
  spec.version = CrateRuby::VERSION
9
- spec.authors = ["Christoph Klocker"]
10
- spec.email = ["christoph@vedanova.com"]
29
+ spec.authors = ["Christoph Klocker", "CRATE Technology GmbH"]
30
+ spec.email = ["office@crate.io"]
11
31
  spec.summary = "A simple interface to Crate Data."
12
- spec.description = ""
13
- spec.source = "https://github.com/crate/crate_ruby"
32
+ spec.description = "A ruby interface for Crate Data, a shared-nothing, fully searchable, document-oriented cluster data store."
14
33
  spec.homepage = "http://crate.io"
15
- spec.license = "MIT"
34
+ spec.license = "Apache License, v2.0"
16
35
 
17
36
  spec.files = `git ls-files -z`.split("\x0")
18
37
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
data/history.txt CHANGED
@@ -1,7 +1,13 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === unreleased
4
+
5
+ === 0.0.7
6
+ * now officially supported by Crate Data and available under the
7
+ Apache 2.0 License
8
+
3
9
  === 0.0.5
4
10
 
5
11
  Enhancements:
6
12
 
7
- * #execute now supports parameter substitution
13
+ * #execute now supports parameter substitution
data/lib/crate_ruby.rb CHANGED
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require "crate_ruby/version"
2
23
  require "crate_ruby/error"
3
24
  require 'crate_ruby/result_set'
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require 'json'
2
23
  require 'net/http'
3
24
  module CrateRuby
@@ -1,6 +1,27 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  module CrateRuby
2
23
  # Base Error class
3
24
  class CrateError < StandardError; end
4
25
  class BlobExistsError < CrateError; end
5
26
 
6
- end
27
+ end
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  module CrateRuby
2
23
  class ResultSet
3
24
  include Enumerable
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  module CrateRuby
2
- VERSION = "0.0.5"
23
+ VERSION = "0.0.6"
3
24
  end
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require_relative '../spec_helper'
2
23
 
3
24
  describe CrateRuby::Client do
@@ -94,6 +115,14 @@ describe CrateRuby::Client do
94
115
  [1, "My life with crate", ['awesome', 'freaky']]).should be_true
95
116
  end
96
117
 
118
+ it 'should create an object' do
119
+ client.execute("CREATE TABLE #{table_name} (id STRING PRIMARY KEY, name string, address object) ")
120
+ client.execute(%Q{INSERT INTO #{table_name} (address, id, name) VALUES ({"street"="1010 W 2nd Ave","city"="Vancouver"}, 'fb7183ac-d049-462c-85a9-732aca59a1c1', 'Mad Max')})
121
+ client.refresh_table table_name
122
+ client.execute(%Q{select * from #{table_name}})
123
+
124
+ end
125
+
97
126
  end
98
127
 
99
128
 
@@ -1,8 +1,31 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require_relative '../spec_helper'
2
23
 
3
24
  describe ResultSet do
4
25
 
5
26
  let(:crate_result) { "{\"cols\":[\"my_column\",\"my_integer_col\"],\"rows\":[[\"Foo\",5],[\"Bar\",5]],\"rowcount\":1,\"duration\":4}" }
27
+ let(:result_with_array_col) { %Q{{"cols":["id","tags","title"],"rows":[[1,["awesome","freaky"],"My life with crate"]],"rowcount":1,"duration":2}} }
28
+ let(:result_with_object) { %Q{{"cols":["address","id","name"],"rows":[[{"street":"1010 W 2nd Ave","city":"Vancouver"},"fb7183ac-d049-462c-85a9-732aca59a1c1","Mad Max"]],"rowcount":1,"duration":3}} }
6
29
 
7
30
  let(:result_set) { ResultSet.new(crate_result) }
8
31
 
@@ -19,10 +42,22 @@ describe ResultSet do
19
42
  result_set.duration.should eq 4
20
43
  end
21
44
 
22
- it 'should set cols' do
45
+ it 'should set cols' do
23
46
  result_set.cols.should eq json_result['cols']
24
47
  end
25
48
 
49
+ it 'should parse an array column result into an Array' do
50
+ res = ResultSet.new(result_with_array_col)
51
+ res[0][1].should be_a(Array)
52
+ res[0][1].should eq(["awesome","freaky"])
53
+ end
54
+
55
+ it 'should parse an object column result into an Object' do
56
+ res = ResultSet.new(result_with_object)
57
+ res[0][0].should be_a(Hash)
58
+ res[0][0].should eq({"street" => "1010 W 2nd Ave","city" => "Vancouver"})
59
+ end
60
+
26
61
  end
27
62
 
28
63
  describe '#each' do
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,23 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require_relative '../lib/crate_ruby'
2
- TEST_PORT = 4209
23
+ TEST_PORT = 4209
data/spec/test_server.rb CHANGED
@@ -1,3 +1,24 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
4
+ # license agreements. See the NOTICE file distributed with this work for
5
+ # additional information regarding copyright ownership. Crate licenses
6
+ # this file to you under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License. You may
8
+ # obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # However, if you have executed another commercial license agreement
19
+ # with Crate these terms will supersede the license and you may use the
20
+ # software solely pursuant to the terms of the relevant commercial agreement.
21
+
1
22
  require 'net/http'
2
23
  class TestServer
3
24
  CRATE_PATH = "~/crate"
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8; -*-
3
+ #
4
+ # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
5
+ # license agreements. See the NOTICE file distributed with this work for
6
+ # additional information regarding copyright ownership. Crate licenses
7
+ # this file to you under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License. You may
9
+ # obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
+ # License for the specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+ # However, if you have executed another commercial license agreement
20
+ # with Crate these terms will supersede the license and you may use the
21
+ # software solely pursuant to the terms of the relevant commercial agreement.
22
+
23
+ require 'net/http'
24
+ class TestServer
25
+ CRATE_PATH = "~/crate"
26
+ TEST_PORT = 4209
27
+ NAME = "TestCluster"
28
+
29
+
30
+ def initialize(crate_home = nil, port = nil)
31
+ @crate_home = crate_home
32
+ @port = port
33
+ @host = "127.0.0.1"
34
+ end
35
+
36
+ def start
37
+ cmd = "sh #{File.join(@crate_home, 'bin/crate')} #{start_params}"
38
+ @pid = spawn(cmd, :out => "/tmp/crate_test_server.out", :err => "/tmp/crate_test_server.err")
39
+ Process.detach(@pid)
40
+ puts 'starting'
41
+ time_slept = 0
42
+ while !alive?
43
+ puts "Crate not yet fully available. Waiting since #{time_slept} seconds..."
44
+ sleep(2)
45
+ time_slept += 2
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def start_params
52
+ "-Des.index.storage.type=memory " +
53
+ "-Des.node.name=#{NAME} " +
54
+ "-Des.cluster.name=Testing#{@port} " +
55
+ "-Des.http.port=#{@port}-#{@port} " +
56
+ "-Des.network.host=localhost " +
57
+ "-Des.discovery.type=zen " +
58
+ "-Des.discovery.zen.ping.multicast.enabled=false"
59
+ end
60
+
61
+ def alive?
62
+ req = Net::HTTP::Get.new('/')
63
+ resp = Net::HTTP.new(@host, @port)
64
+ begin
65
+ response = resp.start { |http| http.request(req) }
66
+ response.code == "200" ? true : false
67
+ rescue Errno::ECONNREFUSED
68
+ false
69
+ end
70
+ end
71
+
72
+ end
73
+
74
+ server = TestServer.new *ARGV
75
+ server.start
metadata CHANGED
@@ -1,67 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crate_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Klocker
8
+ - CRATE Technology GmbH
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-06-16 00:00:00.000000000 Z
12
+ date: 2014-07-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - "~>"
18
+ - - ~>
18
19
  - !ruby/object:Gem::Version
19
20
  version: '1.5'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - "~>"
25
+ - - ~>
25
26
  - !ruby/object:Gem::Version
26
27
  version: '1.5'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rake
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ">="
32
+ - - '>='
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - ">="
39
+ - - '>='
39
40
  - !ruby/object:Gem::Version
40
41
  version: '0'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rspec
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - "~>"
46
+ - - ~>
46
47
  - !ruby/object:Gem::Version
47
48
  version: '2.14'
48
49
  type: :development
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - "~>"
53
+ - - ~>
53
54
  - !ruby/object:Gem::Version
54
55
  version: '2.14'
55
- description: ''
56
+ description: A ruby interface for Crate Data, a shared-nothing, fully searchable,
57
+ document-oriented cluster data store.
56
58
  email:
57
- - christoph@vedanova.com
59
+ - office@crate.io
58
60
  executables: []
59
61
  extensions: []
60
62
  extra_rdoc_files: []
61
63
  files:
62
- - ".gitignore"
64
+ - .gitignore
65
+ - .travis.yml
66
+ - CONTRIBUTING.rst
63
67
  - Gemfile
64
- - LICENSE.txt
68
+ - LICENSE
69
+ - NOTICE
65
70
  - README.md
66
71
  - Rakefile
67
72
  - crate_ruby.gemspec
@@ -76,12 +81,13 @@ files:
76
81
  - spec/crate_ruby/result_set_spec.rb
77
82
  - spec/spec_helper.rb
78
83
  - spec/test_server.rb
84
+ - spec/travis_test_server.rb
79
85
  - spec/uploads/get_logo-crate.png
80
86
  - spec/uploads/logo-crate.png
81
87
  - spec/uploads/text.txt
82
88
  homepage: http://crate.io
83
89
  licenses:
84
- - MIT
90
+ - Apache License, v2.0
85
91
  metadata: {}
86
92
  post_install_message:
87
93
  rdoc_options: []
@@ -89,17 +95,17 @@ require_paths:
89
95
  - lib
90
96
  required_ruby_version: !ruby/object:Gem::Requirement
91
97
  requirements:
92
- - - ">="
98
+ - - '>='
93
99
  - !ruby/object:Gem::Version
94
100
  version: '0'
95
101
  required_rubygems_version: !ruby/object:Gem::Requirement
96
102
  requirements:
97
- - - ">="
103
+ - - '>='
98
104
  - !ruby/object:Gem::Version
99
105
  version: '0'
100
106
  requirements: []
101
107
  rubyforge_project:
102
- rubygems_version: 2.2.1
108
+ rubygems_version: 2.0.3
103
109
  signing_key:
104
110
  specification_version: 4
105
111
  summary: A simple interface to Crate Data.
@@ -108,6 +114,7 @@ test_files:
108
114
  - spec/crate_ruby/result_set_spec.rb
109
115
  - spec/spec_helper.rb
110
116
  - spec/test_server.rb
117
+ - spec/travis_test_server.rb
111
118
  - spec/uploads/get_logo-crate.png
112
119
  - spec/uploads/logo-crate.png
113
120
  - spec/uploads/text.txt
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Christoph Klocker
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.