umbrellio-sequel-plugins 0.7.0.52 → 0.8.0.73

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: 5dd0063f3a7dc2333a1873ec5bf37f9ac93aea1547535165cd6d2437b8dfc36e
4
- data.tar.gz: ed5211bb8da9df9bbde994028bffbc3603ff6f0c1bb92f9a14492ceec2dff013
3
+ metadata.gz: a5c9f5f32a4df0073264d3eaceffad9ddd253d6f0ba2df064cef8f3a4c833007
4
+ data.tar.gz: e8419cbb2ae5eea378770e05090119551aaf7d94e8787417ca90feaf0f496cb6
5
5
  SHA512:
6
- metadata.gz: c30461009a55bd6fb70a97da7e25fb926d60979fa775f651eab810fd5805bc645308b02a8455f04209664819d152a2160ffb29a6b2ed584c78cfc0131efc6eaf
7
- data.tar.gz: 12e81c89ebdfec793fa7d23c1595c6b9c3d909dbc73ff01f7d0dcea474079586557b8e47d62da561db804f4a8484ceab13d20822425c723c27da2496630056dd
6
+ metadata.gz: f6b623635f70d7a4d7a8865a379e65352979ffa453f66eb736bf557a7b9956278a2b1bc97b0ae94bd531c627bee732e903f365d83c482e300f8e52223c0ebfdc
7
+ data.tar.gz: 4aef5eb0a420c6df4af7d8384d79d55763582d6a8a4ddda0d2220f996d667d757bfb005a1bfe8c334a486f661ee2969c9c5a4fa2ca05c0514a4b66e2a53a7e08
@@ -30,7 +30,7 @@ jobs:
30
30
  strategy:
31
31
  fail-fast: false
32
32
  matrix:
33
- ruby: ["2.5", "2.6", "2.7", "3.0"]
33
+ ruby: ["2.7", "3.0", "3.1"]
34
34
 
35
35
  name: ${{ matrix.ruby }}
36
36
 
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.4
6
+ TargetRubyVersion: 2.7
7
7
 
8
8
  Naming/FileName:
9
9
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.8.0] 2022-06-29
5
+ ### Added
6
+
7
+ - `rails dbconsole` command support for Sequel (also aliased as `rails db`) for easy access to the DB console. See the README for installation instructions.
8
+
4
9
  ## [0.7.0] 2022-06-24
5
10
  ### Added
6
11
  - `DB.extension(:set_local)` - allows to set transaction locals;
data/Gemfile.lock CHANGED
@@ -1,86 +1,84 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbrellio-sequel-plugins (0.7.0)
4
+ umbrellio-sequel-plugins (0.8.0)
5
5
  sequel
6
6
  symbiont-ruby
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.1.3.2)
11
+ activesupport (7.0.3)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
15
15
  tzinfo (~> 2.0)
16
- zeitwerk (~> 2.3)
17
16
  ast (2.4.2)
18
17
  coderay (1.1.3)
19
- concurrent-ruby (1.1.8)
20
- diff-lcs (1.4.4)
18
+ concurrent-ruby (1.1.10)
19
+ diff-lcs (1.5.0)
21
20
  docile (1.4.0)
22
- i18n (1.8.10)
21
+ i18n (1.10.0)
23
22
  concurrent-ruby (~> 1.0)
24
23
  method_source (1.0.0)
25
- minitest (5.14.4)
24
+ minitest (5.16.1)
26
25
  money (6.16.0)
27
26
  i18n (>= 0.6.4, <= 2)
28
- parallel (1.20.1)
29
- parser (3.0.1.1)
27
+ parallel (1.22.1)
28
+ parser (3.1.2.0)
30
29
  ast (~> 2.4.1)
31
- pg (1.2.3)
30
+ pg (1.4.1)
32
31
  pry (0.14.1)
33
32
  coderay (~> 1.1)
34
33
  method_source (~> 1.0)
35
- rack (2.2.3)
36
- rainbow (3.0.0)
37
- rake (13.0.3)
38
- regexp_parser (2.1.1)
34
+ rack (2.2.3.1)
35
+ rainbow (3.1.1)
36
+ rake (13.0.6)
37
+ regexp_parser (2.5.0)
39
38
  rexml (3.2.5)
40
- rspec (3.10.0)
41
- rspec-core (~> 3.10.0)
42
- rspec-expectations (~> 3.10.0)
43
- rspec-mocks (~> 3.10.0)
44
- rspec-core (3.10.1)
45
- rspec-support (~> 3.10.0)
46
- rspec-expectations (3.10.1)
39
+ rspec (3.11.0)
40
+ rspec-core (~> 3.11.0)
41
+ rspec-expectations (~> 3.11.0)
42
+ rspec-mocks (~> 3.11.0)
43
+ rspec-core (3.11.0)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-expectations (3.11.0)
47
46
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.10.0)
49
- rspec-mocks (3.10.2)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-mocks (3.11.1)
50
49
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.10.0)
52
- rspec-support (3.10.2)
53
- rubocop (1.11.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-support (3.11.0)
52
+ rubocop (1.30.1)
54
53
  parallel (~> 1.10)
55
- parser (>= 3.0.0.0)
54
+ parser (>= 3.1.0.0)
56
55
  rainbow (>= 2.2.2, < 4.0)
57
56
  regexp_parser (>= 1.8, < 3.0)
58
- rexml
59
- rubocop-ast (>= 1.2.0, < 2.0)
57
+ rexml (>= 3.2.5, < 4.0)
58
+ rubocop-ast (>= 1.18.0, < 2.0)
60
59
  ruby-progressbar (~> 1.7)
61
60
  unicode-display_width (>= 1.4.0, < 3.0)
62
- rubocop-ast (1.7.0)
63
- parser (>= 3.0.1.1)
64
- rubocop-config-umbrellio (1.11.0.40)
65
- rubocop (= 1.11.0)
66
- rubocop-performance (= 1.10.0)
67
- rubocop-rails (= 2.9.1)
68
- rubocop-rake (= 0.5.1)
69
- rubocop-rspec (= 2.2.0)
70
- rubocop-sequel (= 0.2.0)
71
- rubocop-performance (1.10.0)
72
- rubocop (>= 0.90.0, < 2.0)
61
+ rubocop-ast (1.18.0)
62
+ parser (>= 3.1.1.0)
63
+ rubocop-config-umbrellio (1.30.0.65)
64
+ rubocop (~> 1.30.0)
65
+ rubocop-performance (~> 1.14.0)
66
+ rubocop-rails (~> 2.14.2)
67
+ rubocop-rake (~> 0.6.0)
68
+ rubocop-rspec (~> 2.11.1)
69
+ rubocop-sequel (~> 0.3.3)
70
+ rubocop-performance (1.14.2)
71
+ rubocop (>= 1.7.0, < 2.0)
73
72
  rubocop-ast (>= 0.4.0)
74
- rubocop-rails (2.9.1)
73
+ rubocop-rails (2.14.2)
75
74
  activesupport (>= 4.2.0)
76
75
  rack (>= 1.1)
77
- rubocop (>= 0.90.0, < 2.0)
78
- rubocop-rake (0.5.1)
79
- rubocop
80
- rubocop-rspec (2.2.0)
76
+ rubocop (>= 1.7.0, < 2.0)
77
+ rubocop-rake (0.6.0)
81
78
  rubocop (~> 1.0)
82
- rubocop-ast (>= 1.1.0)
83
- rubocop-sequel (0.2.0)
79
+ rubocop-rspec (2.11.1)
80
+ rubocop (~> 1.19)
81
+ rubocop-sequel (0.3.4)
84
82
  rubocop (~> 1.0)
85
83
  ruby-progressbar (1.11.0)
86
84
  sequel (5.57.0)
@@ -90,12 +88,11 @@ GEM
90
88
  simplecov_json_formatter (~> 0.1)
91
89
  simplecov-html (0.12.3)
92
90
  simplecov-lcov (0.8.0)
93
- simplecov_json_formatter (0.1.3)
94
- symbiont-ruby (0.6.0)
91
+ simplecov_json_formatter (0.1.4)
92
+ symbiont-ruby (0.7.0)
95
93
  tzinfo (2.0.4)
96
94
  concurrent-ruby (~> 1.0)
97
- unicode-display_width (2.0.0)
98
- zeitwerk (2.4.2)
95
+ unicode-display_width (2.2.0)
99
96
 
100
97
  PLATFORMS
101
98
  ruby
@@ -113,4 +110,4 @@ DEPENDENCIES
113
110
  umbrellio-sequel-plugins!
114
111
 
115
112
  BUNDLED WITH
116
- 2.2.17
113
+ 2.3.16
data/README.md CHANGED
@@ -39,6 +39,7 @@ $ bundle
39
39
 
40
40
  # Tools
41
41
  - [`TimestampMigratorUndoExtension`](#TimestampMigratorUndoExtension)
42
+ - [`Rails DBConsole`](#Rails-DBConsole)
42
43
 
43
44
  ## CurrencyRates
44
45
 
@@ -188,7 +189,7 @@ OR
188
189
  ```ruby
189
190
  # wives attributes: id (pk), husband_id (fk)
190
191
  # husbands attributes: id (pk), wife_id (fk)
191
-
192
+
192
193
  Wife = Sequel::Model(:wives)
193
194
  Husband = Sequel::Model(:husbands)
194
195
 
@@ -237,7 +238,7 @@ Example:
237
238
  ```ruby
238
239
  Sequel.migration do
239
240
  transaction_options rollback: :always
240
-
241
+
241
242
  up { DB.select("1") }
242
243
  end
243
244
  ```
@@ -452,11 +453,21 @@ Example:
452
453
  rake sequel:undo VERSION=1549624163
453
454
  ```
454
455
 
456
+ ## Rails DBConsole
457
+
458
+ Overrides Rails default `dbconsole` and `db` commands. In order to use it, you have to add the following line to your `boot.rb` file:
459
+
460
+ ```ruby
461
+ require "umbrellio_sequel_plugins/rails_db_command"
462
+ ```
463
+
455
464
  ## License
465
+
456
466
  Released under MIT License.
457
467
 
458
468
  ## Authors
459
- Created by Aleksey Bespalov.
469
+
470
+ Created by Team Umbrellio.
460
471
 
461
472
  <a href="https://github.com/umbrellio/">
462
473
  <img style="float: left;" src="https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg" alt="Supported by Umbrellio" width="439" height="72">
@@ -4,8 +4,8 @@
4
4
  module Sequel::Plugins::Synchronize
5
5
  module ClassMethods
6
6
  # Watch Sequel::Synchronize#synchronize_with
7
- def synchronize_with(*args, &block)
8
- db.extension(:synchronize).synchronize_with(*args, &block)
7
+ def synchronize_with(...)
8
+ db.extension(:synchronize).synchronize_with(...)
9
9
  end
10
10
  end
11
11
 
@@ -10,8 +10,8 @@ namespace :sequel do
10
10
  Dir.glob("#{path}/db/migrate/*.rb").map { |filename| File.basename(filename).to_i }
11
11
  end
12
12
 
13
- old_migrations = extract_migrations(ENV["OLD_RELEASE"])
14
- new_migrations = extract_migrations(ENV["NEW_RELEASE"])
13
+ old_migrations = extract_migrations(ENV.fetch("OLD_RELEASE"))
14
+ new_migrations = extract_migrations(ENV.fetch("NEW_RELEASE"))
15
15
  migrations_to_rollback = old_migrations - new_migrations
16
16
 
17
17
  next if migrations_to_rollback.empty?
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/command"
4
+ require "rails/commands/dbconsole/dbconsole_command"
5
+
6
+ class Rails::Command::DbconsoleCommand < Rails::Command::Base
7
+ def perform
8
+ require "rake"
9
+ Rake.with_application(&:load_rakefile) # Needed to initialize Rails.application
10
+ Rails::DBConsole.start(options)
11
+ end
12
+ end
13
+
14
+ class Rails::DBConsole
15
+ DBConfig = Struct.new(:configuration_hash, :adapter, :database)
16
+
17
+ private
18
+
19
+ def db_config
20
+ @db_config ||= DBConfig.new(configuration_hash, adapter, database)
21
+ end
22
+
23
+ def configuration_hash
24
+ return @configuration_hash if defined?(@configuration_hash)
25
+
26
+ rails_db_config = Rails.application.config.database_configuration
27
+
28
+ sequel_configuration = SequelRails::Configuration.new
29
+ SequelRails.configuration = sequel_configuration.merge!(raw: rails_db_config)
30
+
31
+ storage = SequelRails::Storage.adapter_for(Rails.env)
32
+ @configuration_hash = storage.config.with_indifferent_access
33
+ end
34
+
35
+ def adapter
36
+ mapping = SequelRails::DbConfig::ADAPTER_MAPPING.invert
37
+ value = configuration_hash.fetch(:adapter)
38
+ mapping[value] || value
39
+ end
40
+
41
+ def database
42
+ @options[:database] || configuration_hash.fetch(:database)
43
+ end
44
+ end
@@ -4,15 +4,18 @@ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- gem_version = "0.7.0"
8
- release_version = "#{gem_version}.#{ENV["GITHUB_RUN_NUMBER"]}" if ENV["PUBLISH_JOB"]
7
+ gem_version = "0.8.0"
8
+
9
+ if ENV.fetch("PUBLISH_JOB", nil)
10
+ release_version = "#{gem_version}.#{ENV.fetch("GITHUB_RUN_NUMBER")}"
11
+ end
9
12
 
10
13
  spec.name = "umbrellio-sequel-plugins"
11
14
  spec.version = release_version || gem_version
12
- spec.required_ruby_version = ">= 2.4"
15
+ spec.required_ruby_version = ">= 2.7"
13
16
 
14
- spec.authors = ["nulldef"]
15
- spec.email = ["nulldefiner@gmail.com", "oss@umbrellio.biz"]
17
+ spec.authors = ["Team Umbrellio"]
18
+ spec.email = ["oss@umbrellio.biz"]
16
19
  spec.homepage = "https://github.com/umbrellio/umbrellio-sequel-plugins"
17
20
  spec.licenses = ["MIT"]
18
21
  spec.summary = "Sequel plugins"
data/utils/database.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "logger"
4
4
 
5
- DB = Sequel.connect(ENV["DB_URL"] || "postgres://localhost/sequel_plugins")
5
+ DB = Sequel.connect(ENV.fetch("DB_URL", "postgres://localhost/sequel_plugins"))
6
6
  DB.logger = Logger.new("log/db.log")
7
7
 
8
8
  Sequel::Model.db = DB
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-sequel-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.52
4
+ version: 0.8.0.73
5
5
  platform: ruby
6
6
  authors:
7
- - nulldef
7
+ - Team Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-24 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -166,7 +166,6 @@ dependencies:
166
166
  version: '0'
167
167
  description: A colletion of sequel plugins by Umbrellio
168
168
  email:
169
- - nulldefiner@gmail.com
170
169
  - oss@umbrellio.biz
171
170
  executables: []
172
171
  extensions: []
@@ -176,7 +175,6 @@ files:
176
175
  - ".gitignore"
177
176
  - ".rspec"
178
177
  - ".rubocop.yml"
179
- - ".travis.yml"
180
178
  - CHANGELOG.md
181
179
  - Gemfile
182
180
  - Gemfile.lock
@@ -207,6 +205,7 @@ files:
207
205
  - lib/tasks/sequel/undo.rake
208
206
  - lib/umbrellio-sequel-plugins.rb
209
207
  - lib/umbrellio_sequel_plugins.rb
208
+ - lib/umbrellio_sequel_plugins/rails_db_command.rb
210
209
  - log/.keep
211
210
  - umbrellio-sequel-plugins.gemspec
212
211
  - utils/database.rb
@@ -222,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
221
  requirements:
223
222
  - - ">="
224
223
  - !ruby/object:Gem::Version
225
- version: '2.4'
224
+ version: '2.7'
226
225
  required_rubygems_version: !ruby/object:Gem::Requirement
227
226
  requirements:
228
227
  - - ">="
data/.travis.yml DELETED
@@ -1,55 +0,0 @@
1
- language: ruby
2
-
3
- os: linux
4
-
5
- dist: xenial
6
-
7
- jobs:
8
- fast_finish: true
9
- include:
10
- - rvm: 2.5
11
- - rvm: 2.6
12
- - rvm: 2.7
13
- - rvm: ruby-head
14
- allow_failures:
15
- - rvm: ruby-head
16
-
17
- services:
18
- - postgresql
19
-
20
- addons:
21
- postgresql: 12
22
- apt:
23
- packages:
24
- - postgresql-12
25
- - postgresql-client-12
26
- - postgresql-server-dev-12
27
- - postgresql-client-common
28
- - postgresql-common
29
-
30
- env:
31
- global:
32
- - PGPORT=5433
33
-
34
- cache: bundler
35
-
36
- before_install:
37
- - gem install bundler
38
- - sudo cp /etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/12/main/pg_hba.conf
39
- - sudo service postgresql restart 12
40
- - sleep 1
41
-
42
- install: bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
43
-
44
- before_script:
45
- - psql -c 'create database sequel_plugins;' -U postgres
46
-
47
- deploy:
48
- provider: rubygems
49
- api_key:
50
- secure: cwFaLzVdRiYWvNkIAEL+1EduaxdSmuBeJNQ/EikaiUIXyW6FesepZfRTlfFd/hmK3XlcWwm1QVAzPR/RtNASHGhO+52LWInryqdfVeg0xqqijMEYMLipNf5boprgpqL1uh8ADs8jMSWmgtgXXTveHTg9WWrcQ7FYDVJ8QCxKPTeXUIL1O+0YLT2vKoRCD47yoAxu3mz1Ok6dk2Z3RjZVDPqbKrqUnj4EStrppKdWcapG04gq8vzrMVfuu6ek3ijJRsQui9GZNPSoRO3EIoHu9EtmC/s5JTmFQGJZv/xJPVQGmOFLVgXAS7R/id5VDIH9Kv/5jWFYzE7LD3bzUBPZ8GcNSsmjHGuIbdJr87e9m/B+SnAd/SI3hV80Mfq0MJpx8UArcbXPu+oa/oFxoN79hGo8fjMIjRtOBQYmkLr50VvYXUD2Kn7mBEgFWekPPuXbAvL5cHN1PNo1vYJC5PcEeZRow7yx1LS35VAsE0WLAQrnOH1kMc+neFnddDV8v0GXDsqOiWbrJDvDzNH/tjiQcEKhJkab5f7eGRoCLV3SCisijzTyRdzL9ijlrwCo3U1JGkimS+ToTOiWorAOtwxaYLnqKSrIHY0SJ3rVChZtVkOcaHBe1PgW5glD22C1X1fpiuH/jpGrTC986zlyCop7GBoILK+Cz/pNNcoWapglaW0=
51
- gemspec: umbrellio-sequel-plugins.gemspec
52
- on:
53
- repo: umbrellio/umbrellio-sequel-plugins
54
- branch: master
55
- rvm: 2.7