crate_ruby 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: d47fe15133585ee74801da1c280a14bf00fe6701b333d73a7510255402b52069
4
- data.tar.gz: 07f33bb5146cfca6501f60ae97a7988ba2731164061b75147bc1a1b5bff4b4fc
3
+ metadata.gz: 252dbe999ce51d0ad538e329f5a410edcdb862c2b90a339acee0721ff21bba2e
4
+ data.tar.gz: b4f4004851068929b773f04b5c0af13de0200d9927b26ddb30b6efd4f6ea645b
5
5
  SHA512:
6
- metadata.gz: f8b9c72c33cbdf281ad6bcf9ea20d763ef28f21e48678bd4cd02401e9e7fda10209926aa66f9e66d6e3a1b48014ef12a270bf2cf0ca3ba147e32da79c28b5344
7
- data.tar.gz: ea217acc07d3eb78913b283b0acf04529dea2f4e3cb49f2a72d9ccdcaa6521acd69ee7264b37561a815aa81372887604afcb83d82c6139fdb92e7ab1572827f3
6
+ metadata.gz: 7127c5c40398485355f66a0b0ddf8dc6e94e929cfd7b339c8f0193394491341a333069c5345cff908f781216c92185f1b53ff5146c0766604306584bc9d145b0
7
+ data.tar.gz: 7ba5bb66c8e97619cc376f0ade7a0a689fc6f9bb610edfa3f08bf254a48e26ee7e52dbc3cab7cd0e33a98f3696970ae2202148353d1a3d007355821f5fe14344
data/CHANGES.rst ADDED
@@ -0,0 +1,64 @@
1
+ ####################
2
+ crate_ruby changelog
3
+ ####################
4
+
5
+
6
+ unreleased
7
+ ==========
8
+
9
+
10
+ 0.2.1
11
+ =====
12
+
13
+ - Prevent Base64 wrapping in basic auth headers, when the username/password for a
14
+ CrateDB cluster is particularly long. Thanks, @ahorner.
15
+
16
+ - Drop support for EOL Ruby versions. Thanks, @hammerhead.
17
+
18
+ - Add support for Ruby 3.1.
19
+
20
+
21
+ 0.2.0
22
+ =====
23
+
24
+ - Add SSL support
25
+
26
+
27
+ 0.1.0
28
+ =====
29
+
30
+ - HTTP Basic Authentication support that comes with 2.3.0
31
+
32
+
33
+ 0.0.9
34
+ =====
35
+
36
+ - Fix breaking changes that kept driver from working with crate > v2.0
37
+ - Remove Ruby 1.9.3 from ``travis.yml``
38
+ - Client now supports HTTP options
39
+ - Update ``travis.yml`` and fix broken test
40
+
41
+
42
+ 0.0.8
43
+ =====
44
+
45
+ - Undocumented gem release
46
+
47
+
48
+ 0.0.7
49
+ =====
50
+
51
+ - Use prepared statements for insert
52
+
53
+
54
+ 0.0.6
55
+ =====
56
+
57
+ - Now officially supported by Crate Data and available under the
58
+ Apache 2.0 License
59
+
60
+
61
+ 0.0.5
62
+ =====
63
+
64
+ - ``#execute`` now supports parameter substitution
data/LICENSE CHANGED
@@ -1,19 +1,3 @@
1
- CRATE Ruby
2
- Copyright 2013-2015 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
1
 
18
2
 
19
3
  Apache License
data/NOTICE CHANGED
@@ -1,11 +1,24 @@
1
- Crate Ruby
2
- Copyright 2013-2015 CRATE Technology GmbH ("Crate")
1
+ CrateDB Ruby
2
+ Copyright 2013-2018 Crate.IO GmbH ("Crate")
3
3
 
4
4
 
5
- =========================================================================
5
+ Licensed to Crate.IO GmbH (referred to in this notice as "Crate") under one or
6
+ more contributor license agreements.
6
7
 
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.
8
+ Unless otherwise stated, every component of the CrateDB Ruby is licensed under
9
+ the Apache License, Version 2.0.
10
10
 
11
- =========================================================================
11
+ Third-party components bundled with the CrateDB Ruby are listed in the LICENSE
12
+ file along with their respective licenses. Any additional mandatory notices
13
+ pertaining to those dependencies will be reproduced in this file.
14
+
15
+ Crate provides pre-built releases for convenience, also known as convenience
16
+ releases. Building the CrateDB Ruby from source pulls in a number of additional
17
+ third-party dependencies. Hence, convenience releases will contain a mix of
18
+ CrateDB Ruby source code and third-party build-time dependencies not listed in
19
+ the LICENSE file or in this file.
20
+
21
+ Crate is committed to only using permissively licensed third-party code.
22
+ However, for the time being, if you make use of convenience releases, it is
23
+ your responsibility to check the licensing status of the bundled third-party
24
+ build-time dependencies.
data/README.rst CHANGED
@@ -1,51 +1,62 @@
1
- ===================
1
+ ###################
2
2
  CrateDB Ruby Client
3
- ===================
3
+ ###################
4
+
5
+ .. image:: https://github.com/crate/crate_ruby/workflows/Tests/badge.svg
6
+ :target: https://github.com/crate/crate_ruby/actions?workflow=Tests
7
+ :alt: Build Status
4
8
 
5
9
  .. image:: https://badge.fury.io/rb/crate_ruby.svg
6
- :target: http://badge.fury.io/rb/crate_ruby
10
+ :target: https://rubygems.org/gems/crate_ruby
7
11
  :alt: Gem Version
8
12
 
9
- .. image:: https://travis-ci.org/crate/crate_ruby.svg?branch=master
10
- :target: https://travis-ci.org/crate/crate_ruby
11
- :alt: Build Status
13
+ .. image:: https://badgen.net/rubygems/dt/crate_ruby
14
+ :target: https://rubygems.org/gems/crate_ruby
15
+ :alt: Total downloads
12
16
 
13
- .. image:: https://codeclimate.com/github/crate/crate_ruby.png
14
- :target: https://codeclimate.com/github/crate/crate_ruby
15
- :alt: Code Climate
16
17
 
17
18
  |
18
19
 
19
20
  A Ruby client library for CrateDB_.
20
21
 
22
+
23
+ *************
21
24
  Prerequisites
22
- =============
25
+ *************
23
26
 
24
27
  You will need Ruby 2.0 or greater.
25
28
 
29
+
30
+ ************
26
31
  Installation
27
- ============
32
+ ************
28
33
 
29
34
  The CrateDB Ruby client is available as a Ruby gem_.
30
35
 
31
- Add this line to your application's ``Gemfile``::
36
+ To use it, add this line to your application's ``Gemfile``::
32
37
 
33
38
  gem 'crate_ruby'
34
39
 
35
- Or, install it manually, like so::
40
+ Or install it manually::
41
+
42
+ gem install crate_ruby
43
+
36
44
 
37
- $ gem install crate_ruby
45
+ ********
46
+ Synopsis
47
+ ********
38
48
 
39
- Examples
40
- ========
49
+ Set up the client.
41
50
 
42
- Set up the client like so::
51
+ .. code:: ruby
43
52
 
44
53
  require 'crate_ruby'
45
54
 
46
55
  client = CrateRuby::Client.new
47
56
 
48
- Execute SQL queries like so::
57
+ Execute SQL queries.
58
+
59
+ .. code:: ruby
49
60
 
50
61
  result = client.execute("Select * from posts")
51
62
  => #<CrateRuby::ResultSet:0x00000002a9c5e8 @rowcount=1, @duration=5>
@@ -59,13 +70,19 @@ Execute SQL queries like so::
59
70
  => ["id", "my_column", "my_integer_col"]
60
71
 
61
72
 
62
- Perform parameter substitution like so::
73
+ Perform parameter substitution.
74
+
75
+ .. code:: ruby
63
76
 
64
77
  client.execute(
65
78
  "INSERT INTO posts (id, title, tags) VALUES (\$1, \$2, \$3)",
66
79
  [1, "My life with crate", ['awesome', 'cool']])
67
80
 
68
- Manipulate BLOBs like so::
81
+ Manipulate BLOBs.
82
+
83
+ .. code:: ruby
84
+
85
+ require 'digest'
69
86
 
70
87
  digest = Digest::SHA1.file(file_path).hexdigest
71
88
 
@@ -82,51 +99,46 @@ Manipulate BLOBs like so::
82
99
  # deletion
83
100
  client.blob_delete(table_name, digest)
84
101
 
85
- Schema support
102
+ A default schema can be set by passing in the schema name.
86
103
 
87
- A default schema can be set by passing in the schema name::
104
+ .. code:: ruby
88
105
 
89
- CrateRuby::Client.new(['localhost:44200'], schema: 'my_schema')
106
+ CrateRuby::Client.new(['localhost:4200'], schema: 'my_schema')
90
107
 
91
- Authentication
108
+ Authentication credentials can be passed to the client if needed.
92
109
 
93
- Authentication credentials can be passed to the client if needed::
110
+ .. code:: ruby
94
111
 
95
- CrateRuby::Client.new(['localhost:44200'], username: 'foo', password: 'supersecret')
112
+ CrateRuby::Client.new(['localhost:4200'], username: 'foo', password: 'supersecret')
96
113
 
114
+ SSL can be enabled.
97
115
 
98
- Version matrix
99
- ==============
100
- +--------------+------------+
101
- | Crate Ruby | CrateDB |
102
- +==============+============+
103
- | < 0.9 | < 0.57 |
104
- +--------------+------------+
105
- | 0.9 | >= 0.57 |
106
- +--------------+------------+
116
+ .. code:: ruby
107
117
 
118
+ CrateRuby::Client.new(['localhost:4200'], ssl: true)
119
+
120
+
121
+ ************
108
122
  Contributing
109
- ============
123
+ ************
110
124
 
111
- This project is primarily maintained by Crate.io_, but we welcome community
112
- contributions!
125
+ This project is primarily maintained by `Crate.IO GmbH`_,
126
+ but we welcome community contributions!
113
127
 
114
128
  See the `developer docs`_ and the `contribution docs`_ for more information.
115
129
 
130
+
131
+ ****
116
132
  Help
117
- ====
133
+ ****
118
134
 
119
135
  Looking for more help?
120
136
 
121
- - Check `StackOverflow`_ for common problems
122
- - Chat with us on `Slack`_
123
- - Get `paid support`_
137
+ - Check out our `support channels`_
124
138
 
125
139
  .. _contribution docs: CONTRIBUTING.rst
126
- .. _Crate.io: https://crate.io
140
+ .. _Crate.IO GmbH: https://crate.io
127
141
  .. _CrateDB: https://github.com/crate/crate
128
142
  .. _developer docs: DEVELOP.rst
129
143
  .. _gem: https://rubygems.org/
130
- .. _paid support: https://crate.io/pricing/
131
- .. _Slack: https://crate.io/docs/support/slackin/
132
- .. _StackOverflow: https://stackoverflow.com/tags/crate
144
+ .. _support channels: https://crate.io/support/
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
3
5
  # license agreements. See the NOTICE file distributed with this work for
@@ -25,8 +27,8 @@ require 'base64'
25
27
  module CrateRuby
26
28
  # Client to interact with Crate.io DB
27
29
  class Client
28
- DEFAULT_HOST = '127.0.0.1'.freeze
29
- DEFAULT_PORT = '4200'.freeze
30
+ DEFAULT_HOST = '127.0.0.1'
31
+ DEFAULT_PORT = '4200'
30
32
 
31
33
  attr_accessor :logger, :schema, :username, :password
32
34
 
@@ -198,7 +200,7 @@ module CrateRuby
198
200
 
199
201
  def insert(table_name, attributes)
200
202
  vals = attributes.values
201
- identifiers = attributes.keys.map {|v| %{"#{v}"} }.join(', ')
203
+ identifiers = attributes.keys.map { |v| %("#{v}") }.join(', ')
202
204
  binds = vals.count.times.map { |i| "$#{i + 1}" }.join(',')
203
205
  stmt = %{INSERT INTO "#{table_name}" (#{identifiers}) VALUES(#{binds})}
204
206
  execute(stmt, vals)
@@ -223,7 +225,7 @@ module CrateRuby
223
225
  host, port = @servers.first.split(':')
224
226
  http = Net::HTTP.new(host, port)
225
227
  http.use_ssl = true if @ssl
226
- return http
228
+ http
227
229
  end
228
230
 
229
231
  def request(req, http_options = {})
@@ -243,7 +245,7 @@ module CrateRuby
243
245
  end
244
246
 
245
247
  def encrypted_credentials
246
- @encrypted_credentials ||= Base64.encode64 "#{username}:#{password}"
248
+ @encrypted_credentials ||= Base64.strict_encode64 "#{username}:#{password}"
247
249
  end
248
250
  end
249
251
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
3
5
  # license agreements. See the NOTICE file distributed with this work for
@@ -21,5 +23,6 @@
21
23
  module CrateRuby
22
24
  # Base Error class
23
25
  class CrateError < StandardError; end
26
+
24
27
  class BlobExistsError < CrateError; end
25
28
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
3
5
  # license agreements. See the NOTICE file distributed with this work for
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
3
5
  # license agreements. See the NOTICE file distributed with this work for
@@ -19,5 +21,5 @@
19
21
  # software solely pursuant to the terms of the relevant commercial agreement.
20
22
 
21
23
  module CrateRuby
22
- VERSION = '0.2.0'.freeze
24
+ VERSION = '0.2.1'
23
25
  end
data/lib/crate_ruby.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
3
5
  # license agreements. See the NOTICE file distributed with this work for
@@ -18,18 +20,16 @@
18
20
  # with Crate these terms will supersede the license and you may use the
19
21
  # software solely pursuant to the terms of the relevant commercial agreement.
20
22
 
21
- require 'crate_ruby/version'
22
- require 'crate_ruby/error'
23
- require 'crate_ruby/result_set'
24
- require 'crate_ruby/client'
25
-
26
- include CrateRuby
27
-
28
23
  module CrateRuby
24
+ require 'crate_ruby/version'
25
+ require 'crate_ruby/error'
26
+ require 'crate_ruby/result_set'
27
+ require 'crate_ruby/client'
28
+
29
29
  def self.logger
30
30
  @logger ||= begin
31
31
  require 'logger'
32
- log = Logger.new(STDERR)
32
+ log = Logger.new($stderr)
33
33
  log.level = Logger::INFO
34
34
  log
35
35
  end
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crate_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Klocker
8
8
  - CRATE Technology GmbH
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-06 00:00:00.000000000 Z
12
+ date: 2022-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: os
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: rake
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -31,77 +45,110 @@ dependencies:
31
45
  requirements:
32
46
  - - "~>"
33
47
  - !ruby/object:Gem::Version
34
- version: '2.99'
48
+ version: '3.10'
35
49
  type: :development
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - "~>"
40
54
  - !ruby/object:Gem::Version
41
- version: '2.99'
42
- description: A Ruby interface for Crate.IO. Put your data to work. Simply.
55
+ version: '3.10'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rubocop
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rubocop-rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop-rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: A Ruby interface for CrateDB featuring query support, DDL command shortcuts,
99
+ and support for BLOB tables
43
100
  email:
44
101
  - office@crate.io
45
102
  executables: []
46
103
  extensions: []
47
- extra_rdoc_files: []
104
+ extra_rdoc_files:
105
+ - README.rst
106
+ - CHANGES.rst
107
+ - LICENSE
108
+ - NOTICE
48
109
  files:
49
- - ".gitignore"
50
- - ".travis.yml"
51
- - CONTRIBUTING.rst
52
- - DEVELOP.rst
53
- - Gemfile
110
+ - CHANGES.rst
54
111
  - LICENSE
55
112
  - NOTICE
56
113
  - README.rst
57
- - Rakefile
58
- - crate_ruby.gemspec
59
- - devtools/create_tag.sh
60
- - history.txt
61
114
  - lib/crate_ruby.rb
62
115
  - lib/crate_ruby/client.rb
63
116
  - lib/crate_ruby/error.rb
64
117
  - lib/crate_ruby/result_set.rb
65
118
  - lib/crate_ruby/version.rb
66
- - log/.keep
67
- - spec/bootstrap.rb
68
- - spec/crate_ruby/client_spec.rb
69
- - spec/crate_ruby/result_set_spec.rb
70
- - spec/spec_helper.rb
71
- - spec/support/test_cluster.rb
72
- - spec/uploads/get_logo-crate.png
73
- - spec/uploads/logo-crate.png
74
- - spec/uploads/text.txt
75
- homepage: http://crate.io
119
+ homepage: https://crate.io
76
120
  licenses:
77
121
  - Apache-2.0
78
- metadata: {}
79
- post_install_message:
80
- rdoc_options: []
122
+ metadata:
123
+ bug_tracker_uri: https://github.com/crate/crate_ruby/issues
124
+ changelog_uri: https://github.com/crate/crate_ruby/blob/main/CHANGES.rst
125
+ documentation_uri: https://www.rubydoc.info/gems/crate_ruby/0.2.0
126
+ homepage_uri: https://crate.io
127
+ source_code_uri: https://github.com/crate/crate_ruby
128
+ post_install_message:
129
+ rdoc_options:
130
+ - "--title"
131
+ - CrateDB HTTP client library for Ruby
132
+ - "--main"
133
+ - README.rst
134
+ - "--line-numbers"
135
+ - "--inline-source"
136
+ - "--quiet"
81
137
  require_paths:
82
138
  - lib
83
139
  required_ruby_version: !ruby/object:Gem::Requirement
84
140
  requirements:
85
141
  - - ">="
86
142
  - !ruby/object:Gem::Version
87
- version: '2.0'
143
+ version: '2.6'
88
144
  required_rubygems_version: !ruby/object:Gem::Requirement
89
145
  requirements:
90
146
  - - ">="
91
147
  - !ruby/object:Gem::Version
92
148
  version: '0'
93
149
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.7.6
96
- signing_key:
150
+ rubygems_version: 3.3.11
151
+ signing_key:
97
152
  specification_version: 4
98
- summary: A simple interface for the Crate.IO database.
99
- test_files:
100
- - spec/bootstrap.rb
101
- - spec/crate_ruby/client_spec.rb
102
- - spec/crate_ruby/result_set_spec.rb
103
- - spec/spec_helper.rb
104
- - spec/support/test_cluster.rb
105
- - spec/uploads/get_logo-crate.png
106
- - spec/uploads/logo-crate.png
107
- - spec/uploads/text.txt
153
+ summary: CrateDB HTTP client library for Ruby
154
+ test_files: []
data/.gitignore DELETED
@@ -1,24 +0,0 @@
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
- .idea/*
19
- .rvmrc
20
- log/crate.log
21
- crate_test_server.*
22
- parts/
23
-
24
- .byebug_history
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.0.0"
4
- - "2.1.5"
5
- - "2.2.0"
6
- - "2.4.2"
7
-
8
- before_script:
9
- - bundle exec ruby spec/bootstrap.rb
10
-
11
- script:
12
- bundle exec rspec spec
13
-
14
- before_install:
15
- - gem update bundler
data/CONTRIBUTING.rst DELETED
@@ -1,10 +0,0 @@
1
- ============
2
- Contributing
3
- ============
4
-
5
- Thank you for your interest in contributing.
6
-
7
- Please see the CrateDB `contribution guide`_ for more information. Everything in
8
- the CrateDB contribution guide applies to this repository.
9
-
10
- .. _contribution guide: https://github.com/crate/crate/blob/master/CONTRIBUTING.rst