db 0.0.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2847cf8837c2e4e4115e6bb66e4941e5325d2206cde7cb15a4b815333a277255
4
- data.tar.gz: c04ee3789b067527bdab43fa0fc9c75ff5ed1e7e063e10ac78fb1cccdb577810
3
+ metadata.gz: b99d4c7411ec402a465403035740d0ecec4827992808204a2f3e6a3ef6747f5f
4
+ data.tar.gz: da794cd95025fbc95034ea0a7d48853ba5c57d7c0f3f3b2b5d312139628f5c11
5
5
  SHA512:
6
- metadata.gz: 518fdf481350ad615c0a76492b593762c2d4aed282b6bed052ccca86d6a75c9dd7198584c87f598b11d852a989b40d9f49a067c4b3368a91ce49e8c1c6ad8c9e
7
- data.tar.gz: 10834ed3f026f7a781afdd60e5a7611dd2d2e55578bdef48675a6f7c2aaaec5c76a5436bc91d219f53d377c8fef5c78e0343ad0360d1e64fc980b84011a3a11b
6
+ metadata.gz: 32c37129983d4b02a00eb42469a5be479909c24a2777c136eb2768f7ecb848b8061dad4f73ea7d5aa984b39a22f9295546a21122da548a2f529e6b5ffefe8ee3
7
+ data.tar.gz: 90919ecaa9a3ab9aa715ee9ce38cc1deb622e6c515d343e9b2a92a8b4f6c7ff1655053cd0552e4c8a9f68837366acca29d9f7d838ee597e98f41b0e4e1e948d9
data/lib/db.rb CHANGED
@@ -20,4 +20,5 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require "db/version"
23
+ require_relative 'db/version'
24
+ require_relative 'db/adapters'
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ module DB
24
+ # A global map of registered adapters.
25
+ # e.g. `DB::Adapters.register(:mariadb, DB::MariaDB::Adapter)`
26
+ module Adapters
27
+ @adapters = {}
28
+
29
+ # Register the adapter class to the specified name.
30
+ # @parameter name [Symbol] The adapter name.
31
+ # @parameter adapter [Class] The adapter class.
32
+ def self.register(name, adapter)
33
+ @adapters[name] = adapter
34
+ end
35
+
36
+ # Enumerate all registered adapters.
37
+ # @yields {|name, adapter| ...} The adapters if a block is given.
38
+ # @parameter name [Symbol] The adapter name.
39
+ # @parameter adapter [Class] The adapter class
40
+ # @returns [Enumerator(Symbol, Class)] If no block is given.
41
+ def self.each(&block)
42
+ @adapters.each(&block)
43
+ end
44
+ end
45
+ end
data/lib/db/client.rb ADDED
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require 'async/io'
24
+ require 'async/io/stream'
25
+ require 'async/pool/controller'
26
+
27
+ require_relative 'context/session'
28
+ require_relative 'context/transaction'
29
+
30
+ module DB
31
+ # Binds a connection pool to the specified adapter.
32
+ class Client
33
+ # Initialize the client and internal connection pool using the specified adapter.
34
+ # @parameter adapter [Object] The adapter instance.
35
+ def initialize(adapter, **options)
36
+ @adapter = adapter
37
+
38
+ @pool = connect(**options)
39
+ end
40
+
41
+ # The adapter used for making connections.
42
+ # @attribute [Object]
43
+ attr :adapter
44
+
45
+ # Close all open connections in the connection pool.
46
+ def close
47
+ @pool.close
48
+ end
49
+
50
+ # Acquires a connection and sends the specified statement if given.
51
+ # @parameters statement [String | Nil] An optional statement to send.
52
+ # @yields {|session| ...} A connected session if a block is given. Implicitly closed.
53
+ # @parameter session [Context::Session]
54
+ # @returns [Context::Session] A connected session if no block is given.
55
+ def session(statement = nil, **options)
56
+ session = Context::Session.new(@pool, **options)
57
+
58
+ if statement
59
+ session.send_query(statement)
60
+ end
61
+
62
+ return session unless block_given?
63
+
64
+ begin
65
+ yield session
66
+ ensure
67
+ session.close
68
+ end
69
+ end
70
+
71
+ # Acquires a connection and starts a transaction.
72
+ # @parameters statement [String | Nil] An optional statement to send. Defaults to `"BEGIN"`.
73
+ # @yields {|session| ...} A connected session if a block is given. Implicitly commits, or aborts the connnection if an exception is raised.
74
+ # @parameter session [Context::Transaction]
75
+ # @returns [Context::Transaction] A connected and started transaction if no block is given.
76
+ def transaction(statement = "BEGIN", **options)
77
+ transaction = Context::Transaction.new(@pool, **options)
78
+
79
+ if statement
80
+ transaction.call("BEGIN")
81
+ end
82
+
83
+ return transaction unless block_given?
84
+
85
+ begin
86
+ yield transaction
87
+
88
+ transaction.commit
89
+ ensure
90
+ transaction.abort if $!
91
+ end
92
+ end
93
+
94
+ protected
95
+
96
+ def connect(**options)
97
+ Async::Pool::Controller.new(@adapter, **options)
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require_relative '../query'
24
+
25
+ module DB
26
+ module Context
27
+ # A connected context for sending queries and reading results.
28
+ class Session
29
+ # Iniitalize the query context attached to the given connection pool.
30
+ def initialize(pool, **options)
31
+ @pool = pool
32
+ @connection = pool.acquire
33
+ end
34
+
35
+ # The underlying connection.
36
+ attr :connection
37
+
38
+ # Flush the connection and then return it to the connection pool.
39
+ def close
40
+ if @connection
41
+ self.flush
42
+
43
+ @pool.release(@connection)
44
+
45
+ @connection = nil
46
+ end
47
+ end
48
+
49
+ def clause(*arguments)
50
+ Query.new(self).clause(*arguments)
51
+ end
52
+
53
+ def query(fragment = String.new, **parameters)
54
+ if parameters.empty?
55
+ Query.new(self, fragment)
56
+ else
57
+ Query.new(self).interpolate(fragment, **parameters)
58
+ end
59
+ end
60
+
61
+ # Send a query to the server.
62
+ # @parameter statement [String] The SQL query to send.
63
+ def send_query(statement, **options)
64
+ # Console.logger.info(self, statement)
65
+ @connection.send_query(statement, **options)
66
+ end
67
+
68
+ # Read the next result. Sending a query usually generates 1 or more results.
69
+ # @returns [Enumerable] The resulting records.
70
+ def next_result
71
+ @connection.next_result
72
+ end
73
+
74
+ # Send a query to the server and read the next result.
75
+ # @returns [Enumerable] The resulting records.
76
+ def call(statement, **options)
77
+ # Console.logger.info(self, statement)
78
+ @connection.send_query(statement, **options)
79
+
80
+ return @connection.next_result
81
+ end
82
+
83
+ # Enumerate all results.
84
+ # @yields {|result ...} The results if a block is given.
85
+ # @parameter result [Enumerable]
86
+ def results
87
+ while result = self.next_result
88
+ yield result
89
+ end
90
+
91
+ return nil
92
+ end
93
+
94
+ # Flush all outstanding results.
95
+ def flush
96
+ until @connection.next_result.nil?
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require_relative 'session'
24
+
25
+ module DB
26
+ module Context
27
+ class Transaction < Session
28
+ # Commit the transaction and return the connection to the connection pool.
29
+ def commit
30
+ self.call("COMMIT")
31
+ self.close
32
+ end
33
+
34
+ # Abort the transaction and return the connection to the connection pool.
35
+ def abort
36
+ self.call("ROLLBACK")
37
+ self.close
38
+ end
39
+
40
+ # Mark a savepoint in the transaction.
41
+ def savepoint(name)
42
+ self.call("SAVEPOINT #{name}")
43
+ end
44
+
45
+ # Return back to a previously registered savepoint.
46
+ def rollback(name)
47
+ self.call("ROLLBACK #{name}")
48
+ end
49
+ end
50
+ end
51
+ end
data/lib/db/query.rb ADDED
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ module DB
24
+ # Represents one or more identifiers for databases, tables or columns.
25
+ class Identifier < Array
26
+ # Construct an identifier from an array of names.
27
+ # e.g. `DB::Identifier[:mytable, :mycolumn]`
28
+ #
29
+ # @parameter names [Array] The array of names.
30
+ def self.[](*names)
31
+ self.new(names)
32
+ end
33
+
34
+ def self.coerce(name_or_identifier)
35
+ case name_or_identifier
36
+ when Identifier
37
+ name_or_identifier
38
+ when Symbol
39
+ self.new(name_or_identifier)
40
+ else
41
+ self.new(name_or_identifier.to_sym)
42
+ end
43
+ end
44
+
45
+ def append_to(query)
46
+ query.identifier(self)
47
+ end
48
+ end
49
+
50
+ # A mutable query builder.
51
+ class Query
52
+ # Create a new query builder attached to the specified session.
53
+ # @parameter session [Context::Session] the connected session which is used for escaping arguments.
54
+ def initialize(session, buffer = String.new)
55
+ @session = session
56
+ @connection = session.connection
57
+ @buffer = +buffer
58
+ end
59
+
60
+ # Append a raw textual clause to the query buffer.
61
+ # @parameter value [String] A raw SQL string, e.g. `WHERE x > 10`.
62
+ # @returns [Query] The mutable query itself.
63
+ def clause(value)
64
+ @buffer << ' ' unless @buffer.end_with?(' ')
65
+
66
+ @buffer << value
67
+
68
+ return self
69
+ end
70
+
71
+ # Append a literal value to the query buffer.
72
+ # Escapes the field according to the requirements of the underlying connection.
73
+ # @parameter value [Object] Any kind of object, passed to the underlying database connection for conversion to a string representation.
74
+ # @returns [Query] The mutable query itself.
75
+ def literal(value)
76
+ @buffer << ' ' unless @buffer.end_with?(' ')
77
+
78
+ @connection.append_literal(value, @buffer)
79
+
80
+ return self
81
+ end
82
+
83
+ # Append an identifier value to the query buffer.
84
+ # Escapes the field according to the requirements of the underlying connection.
85
+ # @parameter value [String | Symbol | DB::Identifier] Passed to the underlying database connection for conversion to a string representation.
86
+ # @returns [Query] The mutable query itself.
87
+ def identifier(value)
88
+ @buffer << ' ' unless @buffer.end_with?(' ')
89
+
90
+ @connection.append_identifier(value, @buffer)
91
+
92
+ return self
93
+ end
94
+
95
+ # Interpolate a query fragment with the specified parameters.
96
+ # The parameters are escaped before being appended.
97
+ #
98
+ # @parameter fragment [String] A fragment of SQL including placeholders, e.g. `WHERE x > %{column}`.
99
+ # @parameter parameters [Hash] The substitution parameters.
100
+ # @returns [Query] The mutable query itself.
101
+ def interpolate(fragment, **parameters)
102
+ parameters.transform_values! do |value|
103
+ case value
104
+ when Symbol, Identifier
105
+ @connection.append_identifier(value)
106
+ else
107
+ @connection.append_literal(value)
108
+ end
109
+ end
110
+
111
+ @buffer << sprintf(fragment, parameters)
112
+
113
+ return self
114
+ end
115
+
116
+ def key_column(*arguments, **options)
117
+ @buffer << @connection.key_column(*arguments, **options)
118
+
119
+ return self
120
+ end
121
+
122
+ # Send the query to the remote server to be executed. See {Context::Session#send_query} for more details.
123
+ def send
124
+ @session.send_query(@buffer)
125
+ end
126
+
127
+ # Send the query to the remote server to be executed. See {Context::Session#call} for more details.
128
+ # @returns [Enumerable] The resulting records.
129
+ def call
130
+ @session.call(@buffer)
131
+ end
132
+
133
+ def to_s
134
+ @buffer
135
+ end
136
+
137
+ def inspect
138
+ "\#<#{self.class} #{@buffer.inspect}>"
139
+ end
140
+ end
141
+ end
data/lib/db/version.rb CHANGED
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module DB
24
- VERSION = "0.0.0"
24
+ VERSION = "0.8.0"
25
25
  end
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2021-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bake
14
+ name: async-io
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- type: :development
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -25,13 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bake-bundler
28
+ name: async-pool
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: covered
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,25 +80,24 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
- description:
83
+ description:
84
84
  email:
85
- - samuel.williams@oriontransfer.co.nz
86
85
  executables: []
87
86
  extensions: []
88
87
  extra_rdoc_files: []
89
88
  files:
90
- - ".github/workflows/development.yml"
91
- - ".gitignore"
92
- - ".rspec"
93
- - README.md
94
- - db.gemspec
95
- - gems.rb
96
89
  - lib/db.rb
90
+ - lib/db/adapters.rb
91
+ - lib/db/client.rb
92
+ - lib/db/context/session.rb
93
+ - lib/db/context/transaction.rb
94
+ - lib/db/query.rb
97
95
  - lib/db/version.rb
98
96
  homepage: https://github.com/socketry/db
99
- licenses: []
97
+ licenses:
98
+ - MIT
100
99
  metadata: {}
101
- post_install_message:
100
+ post_install_message:
102
101
  rdoc_options: []
103
102
  require_paths:
104
103
  - lib
@@ -106,15 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
105
  requirements:
107
106
  - - ">="
108
107
  - !ruby/object:Gem::Version
109
- version: '0'
108
+ version: '2.5'
110
109
  required_rubygems_version: !ruby/object:Gem::Requirement
111
110
  requirements:
112
111
  - - ">="
113
112
  - !ruby/object:Gem::Version
114
113
  version: '0'
115
114
  requirements: []
116
- rubygems_version: 3.0.6
117
- signing_key:
115
+ rubygems_version: 3.2.3
116
+ signing_key:
118
117
  specification_version: 4
119
118
  summary: A low level database access gem.
120
119
  test_files: []
@@ -1,34 +0,0 @@
1
- name: Development
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- test:
7
- strategy:
8
- matrix:
9
- os:
10
- - ubuntu
11
- - macos
12
-
13
- ruby:
14
- - 2.4
15
- - 2.5
16
- - 2.6
17
- - 2.7
18
-
19
- include:
20
- - os: 'ubuntu'
21
- ruby: '2.6'
22
- env: COVERAGE=PartialSummary,Coveralls
23
-
24
- runs-on: ${{matrix.os}}-latest
25
-
26
- steps:
27
- - uses: actions/checkout@v1
28
- - uses: ruby/setup-ruby@v1
29
- with:
30
- ruby-version: ${{matrix.ruby}}
31
- - name: Install dependencies
32
- run: bundle install
33
- - name: Run tests
34
- run: ${{matrix.env}} bundle exec rspec
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- gems.locked
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/README.md DELETED
@@ -1,35 +0,0 @@
1
- # Db
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/db`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'db'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install db
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/db.
data/db.gemspec DELETED
@@ -1,26 +0,0 @@
1
-
2
- require_relative "lib/db/version"
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "db"
6
- spec.version = DB::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = "A low level database access gem."
11
- spec.homepage = "https://github.com/socketry/db"
12
-
13
- spec.files = Dir.chdir(__dir__) do
14
- `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/})}
15
- end
16
-
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_development_dependency "bake"
21
- spec.add_development_dependency "bake-bundler"
22
-
23
- spec.add_development_dependency "bundler", "~> 2.0"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
26
- end
data/gems.rb DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in db.gemspec
4
- gemspec