umbrellio-sequel-plugins 0.6.0.46 → 0.9.0.76

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: 6300b1ec3023af08e57414d2e3f4f86483d0ec33addb2252ef11bc5d9af33a7f
4
- data.tar.gz: 7d75ea75302cddd7287a93fa996615b4491adfac1d93ac1b10c49b906eb4cb74
3
+ metadata.gz: c2e993d233df32418338f7de48f9bca64752aaaf9dc784e2c85b03876752c281
4
+ data.tar.gz: 3d3e0678d59ec23fe423f792da6820c212ef5b4a7ee0792af1ce011e688db011
5
5
  SHA512:
6
- metadata.gz: e6fa9070b52a12cf73f40fae645931a3cf8f475156446c1206be97692ea71920c0e60ac6e24db38ac44d92e33986cf0d5164073baf3af3c22360c8d9ca45ff0d
7
- data.tar.gz: bf2493882e57ae14e9c556fa7f77654ecacde594720a7b65381f75c5d50fc2e1f34e67d88d0d85120de3650485fefccf901816a4d60d6d98446d2e5dc358e471
6
+ metadata.gz: 799605817f6ffd341439a781bbb57eee5cc527a3985a98740e2eb260a78a78a7afc7bb40adb4fd5cf7613d5cd621ff2573ad96ba0ac3c7b4e460edfb10d33679
7
+ data.tar.gz: e8749ed4fb97f0e7bbda35cbc48c6eeb0720c004a0de318a1a57e80cef89976011fedf486829c55dce08e7de81338eb56978a9cd3bee33aa31b4c08163ad5ba4
@@ -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,14 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.9.0] 2022-07-01
5
+ ### Added
6
+ - Add `--server` option to `rails dbconsole` command.
7
+
8
+ ## [0.8.0] 2022-06-29
9
+ ### Added
10
+ - `rails dbconsole` command support for Sequel (also aliased as `rails db`) for easy access to the DB console. See the README for installation instructions.
11
+
4
12
  ## [0.7.0] 2022-06-24
5
13
  ### Added
6
14
  - `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.6.0)
4
+ umbrellio-sequel-plugins (0.9.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,53 @@
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
+ class_option :server, type: :string, desc: "Specifies the server to use."
8
+
9
+ def perform
10
+ require "rake"
11
+ Rake.with_application(&:load_rakefile) # Needed to initialize Rails.application
12
+ Rails::DBConsole.start(options)
13
+ end
14
+ end
15
+
16
+ class Rails::DBConsole
17
+ DBConfig = Struct.new(:configuration_hash, :adapter, :database)
18
+
19
+ private
20
+
21
+ def db_config
22
+ @db_config ||= DBConfig.new(configuration_hash, adapter, database)
23
+ end
24
+
25
+ def configuration_hash
26
+ return @configuration_hash if defined?(@configuration_hash)
27
+
28
+ rails_db_config = Rails.application.config.database_configuration
29
+
30
+ sequel_configuration = SequelRails::Configuration.new
31
+ SequelRails.configuration = sequel_configuration.merge!(raw: rails_db_config)
32
+
33
+ storage = SequelRails::Storage.adapter_for(Rails.env)
34
+ config = storage.config.with_indifferent_access
35
+
36
+ if @options[:server]
37
+ server_config = config.fetch(:servers).fetch(@options[:server])
38
+ config.merge!(server_config)
39
+ end
40
+
41
+ @configuration_hash = config
42
+ end
43
+
44
+ def adapter
45
+ mapping = SequelRails::DbConfig::ADAPTER_MAPPING.invert
46
+ value = configuration_hash.fetch(:adapter)
47
+ mapping[value] || value
48
+ end
49
+
50
+ def database
51
+ @options[:database] || configuration_hash.fetch(:database)
52
+ end
53
+ 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.6.0"
8
- release_version = "#{gem_version}.#{ENV["GITHUB_RUN_NUMBER"]}" if ENV["PUBLISH_JOB"]
7
+ gem_version = "0.9.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.6.0.46
4
+ version: 0.9.0.76
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-07-01 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