sequelize-rails 0.4.0 → 0.5.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: 1d9b36457ef8b9c1cfc36554adb7b76a2c6262ac93fc9e6468a0c5e4eae74a04
4
- data.tar.gz: 46a4e132f2d67a1c2aab16dcf1ec7fa39bb113f1dab39dbf2bb9a0e272af33da
3
+ metadata.gz: ffb36f44727f56d3d9f157d95b669785999567afc37d7b2b4a1c99e4b7fbfe40
4
+ data.tar.gz: f2f9b2e5b1a96a8048731ab03cbc279fb363f1549da47f988869dc9d55d34989
5
5
  SHA512:
6
- metadata.gz: 0d4ff60a438337fe2d9f9f440a74da942b8c9aad250c8a127500cab2ef6082dd5de45c15163abaa8f25e1ce26c7c6ad772fb24edf57995ac4c6c29191512bf4c
7
- data.tar.gz: '08f935a29a8f038fc824d407cb8d988f0d1c0745f9465e01dbbfe870c9a4c97f021a251b3750a7b4b74e91865846d4a51121039d6aac2c2a10ddce312e72a697'
6
+ metadata.gz: 33451f66a4c01399910e6ec4bfdbed2a9136f1da5fe537020efae31a39e1cbdc514da3f7f0773888cf16bd4e5a1648ef57d76170fd3ee76aa006e27fde85485a
7
+ data.tar.gz: 692a29096179817f411539a22363cf4a8688bdf688236fa9c5ecee2b8644c0a72d78939be12db570ff6a5faa7a9d620fd90415b5ea075a2107d283f85f4f06de
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ Exclude:
2
+ - '**/*'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2023-09-04
4
+
5
+ - Adds the `db:seed` rake task for running seed files
6
+ - Stubs the `db:schema:load` rake task and adds it as a step in `db:setup`
7
+ - Stubs the `db:schema:dump` rake task
8
+
9
+ ## [0.4.1] - 2023-08-16
10
+
11
+ - Adds a `Rails.application.config.sequel.after_connect` hook that is called after each connection is established. This hook can be used to add plugins and extensions to the database connection once established.
12
+
3
13
  ## [0.4.0] - 2023-08-16
4
14
 
5
15
  - Rake tasks will no longer attempt a database connection by default
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequelize-rails (0.3.0)
4
+ sequelize-rails (0.5.0)
5
5
  activerecord (>= 6.0.0)
6
6
  rails (>= 6.0.0)
7
7
  sequel (>= 5.0.0)
@@ -9,67 +9,67 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.4.3)
13
- actionpack (= 7.0.4.3)
14
- activesupport (= 7.0.4.3)
12
+ actioncable (7.0.7)
13
+ actionpack (= 7.0.7)
14
+ activesupport (= 7.0.7)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (7.0.4.3)
18
- actionpack (= 7.0.4.3)
19
- activejob (= 7.0.4.3)
20
- activerecord (= 7.0.4.3)
21
- activestorage (= 7.0.4.3)
22
- activesupport (= 7.0.4.3)
17
+ actionmailbox (7.0.7)
18
+ actionpack (= 7.0.7)
19
+ activejob (= 7.0.7)
20
+ activerecord (= 7.0.7)
21
+ activestorage (= 7.0.7)
22
+ activesupport (= 7.0.7)
23
23
  mail (>= 2.7.1)
24
24
  net-imap
25
25
  net-pop
26
26
  net-smtp
27
- actionmailer (7.0.4.3)
28
- actionpack (= 7.0.4.3)
29
- actionview (= 7.0.4.3)
30
- activejob (= 7.0.4.3)
31
- activesupport (= 7.0.4.3)
27
+ actionmailer (7.0.7)
28
+ actionpack (= 7.0.7)
29
+ actionview (= 7.0.7)
30
+ activejob (= 7.0.7)
31
+ activesupport (= 7.0.7)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  net-imap
34
34
  net-pop
35
35
  net-smtp
36
36
  rails-dom-testing (~> 2.0)
37
- actionpack (7.0.4.3)
38
- actionview (= 7.0.4.3)
39
- activesupport (= 7.0.4.3)
40
- rack (~> 2.0, >= 2.2.0)
37
+ actionpack (7.0.7)
38
+ actionview (= 7.0.7)
39
+ activesupport (= 7.0.7)
40
+ rack (~> 2.0, >= 2.2.4)
41
41
  rack-test (>= 0.6.3)
42
42
  rails-dom-testing (~> 2.0)
43
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
- actiontext (7.0.4.3)
45
- actionpack (= 7.0.4.3)
46
- activerecord (= 7.0.4.3)
47
- activestorage (= 7.0.4.3)
48
- activesupport (= 7.0.4.3)
44
+ actiontext (7.0.7)
45
+ actionpack (= 7.0.7)
46
+ activerecord (= 7.0.7)
47
+ activestorage (= 7.0.7)
48
+ activesupport (= 7.0.7)
49
49
  globalid (>= 0.6.0)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (7.0.4.3)
52
- activesupport (= 7.0.4.3)
51
+ actionview (7.0.7)
52
+ activesupport (= 7.0.7)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- activejob (7.0.4.3)
58
- activesupport (= 7.0.4.3)
57
+ activejob (7.0.7)
58
+ activesupport (= 7.0.7)
59
59
  globalid (>= 0.3.6)
60
- activemodel (7.0.4.3)
61
- activesupport (= 7.0.4.3)
62
- activerecord (7.0.4.3)
63
- activemodel (= 7.0.4.3)
64
- activesupport (= 7.0.4.3)
65
- activestorage (7.0.4.3)
66
- actionpack (= 7.0.4.3)
67
- activejob (= 7.0.4.3)
68
- activerecord (= 7.0.4.3)
69
- activesupport (= 7.0.4.3)
60
+ activemodel (7.0.7)
61
+ activesupport (= 7.0.7)
62
+ activerecord (7.0.7)
63
+ activemodel (= 7.0.7)
64
+ activesupport (= 7.0.7)
65
+ activestorage (7.0.7)
66
+ actionpack (= 7.0.7)
67
+ activejob (= 7.0.7)
68
+ activerecord (= 7.0.7)
69
+ activesupport (= 7.0.7)
70
70
  marcel (~> 1.0)
71
71
  mini_mime (>= 1.1.0)
72
- activesupport (7.0.4.3)
72
+ activesupport (7.0.7)
73
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
74
74
  i18n (>= 1.6, < 2)
75
75
  minitest (>= 5.1)
@@ -88,13 +88,13 @@ GEM
88
88
  erubi (1.12.0)
89
89
  globalid (1.1.0)
90
90
  activesupport (>= 5.0)
91
- i18n (1.12.0)
91
+ i18n (1.14.1)
92
92
  concurrent-ruby (~> 1.0)
93
93
  json (2.6.3)
94
94
  language_server-protocol (3.17.0.3)
95
- loofah (2.19.1)
95
+ loofah (2.21.3)
96
96
  crass (~> 1.0.2)
97
- nokogiri (>= 1.5.9)
97
+ nokogiri (>= 1.12.0)
98
98
  mail (2.8.1)
99
99
  mini_mime (>= 0.1.1)
100
100
  net-imap
@@ -102,7 +102,7 @@ GEM
102
102
  net-smtp
103
103
  marcel (1.0.2)
104
104
  method_source (1.0.0)
105
- mini_mime (1.1.2)
105
+ mini_mime (1.1.5)
106
106
  mini_portile2 (2.8.1)
107
107
  minitest (5.18.0)
108
108
  minitest-reporters (1.6.0)
@@ -110,7 +110,7 @@ GEM
110
110
  builder
111
111
  minitest (>= 5.0)
112
112
  ruby-progressbar
113
- net-imap (0.3.4)
113
+ net-imap (0.3.7)
114
114
  date
115
115
  net-protocol
116
116
  net-pop (0.1.2)
@@ -119,9 +119,8 @@ GEM
119
119
  timeout
120
120
  net-smtp (0.3.3)
121
121
  net-protocol
122
- nio4r (2.5.8)
123
- nokogiri (1.14.2)
124
- mini_portile2 (~> 2.8.0)
122
+ nio4r (2.5.9)
123
+ nokogiri (1.15.4-arm64-darwin)
125
124
  racc (~> 1.4)
126
125
  parallel (1.22.1)
127
126
  parser (3.2.1.1)
@@ -130,32 +129,34 @@ GEM
130
129
  pry (0.14.2)
131
130
  coderay (~> 1.1)
132
131
  method_source (~> 1.0)
133
- racc (1.6.2)
134
- rack (2.2.6.4)
132
+ racc (1.7.1)
133
+ rack (2.2.8)
135
134
  rack-test (2.1.0)
136
135
  rack (>= 1.3)
137
- rails (7.0.4.3)
138
- actioncable (= 7.0.4.3)
139
- actionmailbox (= 7.0.4.3)
140
- actionmailer (= 7.0.4.3)
141
- actionpack (= 7.0.4.3)
142
- actiontext (= 7.0.4.3)
143
- actionview (= 7.0.4.3)
144
- activejob (= 7.0.4.3)
145
- activemodel (= 7.0.4.3)
146
- activerecord (= 7.0.4.3)
147
- activestorage (= 7.0.4.3)
148
- activesupport (= 7.0.4.3)
136
+ rails (7.0.7)
137
+ actioncable (= 7.0.7)
138
+ actionmailbox (= 7.0.7)
139
+ actionmailer (= 7.0.7)
140
+ actionpack (= 7.0.7)
141
+ actiontext (= 7.0.7)
142
+ actionview (= 7.0.7)
143
+ activejob (= 7.0.7)
144
+ activemodel (= 7.0.7)
145
+ activerecord (= 7.0.7)
146
+ activestorage (= 7.0.7)
147
+ activesupport (= 7.0.7)
149
148
  bundler (>= 1.15.0)
150
- railties (= 7.0.4.3)
151
- rails-dom-testing (2.0.3)
152
- activesupport (>= 4.2.0)
149
+ railties (= 7.0.7)
150
+ rails-dom-testing (2.2.0)
151
+ activesupport (>= 5.0.0)
152
+ minitest
153
153
  nokogiri (>= 1.6)
154
- rails-html-sanitizer (1.5.0)
155
- loofah (~> 2.19, >= 2.19.1)
156
- railties (7.0.4.3)
157
- actionpack (= 7.0.4.3)
158
- activesupport (= 7.0.4.3)
154
+ rails-html-sanitizer (1.6.0)
155
+ loofah (~> 2.21)
156
+ nokogiri (~> 1.14)
157
+ railties (7.0.7)
158
+ actionpack (= 7.0.7)
159
+ activesupport (= 7.0.7)
159
160
  method_source
160
161
  rake (>= 12.2)
161
162
  thor (~> 1.0)
@@ -180,7 +181,7 @@ GEM
180
181
  rubocop (>= 1.7.0, < 2.0)
181
182
  rubocop-ast (>= 0.4.0)
182
183
  ruby-progressbar (1.13.0)
183
- sequel (5.66.0)
184
+ sequel (5.71.0)
184
185
  sqlite3 (1.6.1)
185
186
  mini_portile2 (~> 2.8.0)
186
187
  standard (1.25.3)
@@ -188,14 +189,14 @@ GEM
188
189
  rubocop (~> 1.48.1)
189
190
  rubocop-performance (~> 1.16.0)
190
191
  thor (1.2.1)
191
- timeout (0.3.2)
192
+ timeout (0.4.0)
192
193
  tzinfo (2.0.6)
193
194
  concurrent-ruby (~> 1.0)
194
195
  unicode-display_width (2.4.2)
195
- websocket-driver (0.7.5)
196
+ websocket-driver (0.7.6)
196
197
  websocket-extensions (>= 0.1.0)
197
198
  websocket-extensions (0.1.5)
198
- zeitwerk (2.6.7)
199
+ zeitwerk (2.6.11)
199
200
 
200
201
  PLATFORMS
201
202
  ruby
@@ -51,7 +51,7 @@ module Sequel
51
51
  end
52
52
 
53
53
  initializer "sequel.connection" do
54
- in_rake = Rails.const_defined?("Rake") && Rake.application.top_level_tasks.length > 0
54
+ in_rake = Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.length > 0
55
55
  ::Sequel::Rails.connect_to :primary unless in_rake
56
56
  end
57
57
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sequel
4
4
  module Rails
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
data/lib/sequel/rails.rb CHANGED
@@ -32,6 +32,9 @@ module Sequel
32
32
  config[:pool_timeout] ||= config.delete(:timeout) / 1000 if config[:timeout]
33
33
  Dir.chdir ::Rails.root do
34
34
  ::Sequel.connect config, opts
35
+ end.tap do |db|
36
+ callback = ::Rails.application.config.sequel.after_connect
37
+ callback.call(db) if callback.respond_to?(:call)
35
38
  end
36
39
  end
37
40
  end
@@ -125,13 +125,13 @@ db_namespace = namespace ns do
125
125
  end
126
126
 
127
127
  namespace :migrate do
128
- # desc "Runs the \"down\" method for the last applied migration"
128
+ desc "Runs the \"down\" method for the last applied migration"
129
129
  task down: [:connection] do
130
130
  target = (migrator.applied_migrations[-2] || "0_").split("_", 2).first.to_i
131
131
  migrator(target: target).run
132
132
  end
133
133
 
134
- # desc "Runs the \"up\" method for the next pending migration"
134
+ desc "Runs the \"up\" method for the next pending migration"
135
135
  task up: [:connection] do
136
136
  pending = migrator.migration_tuples.first
137
137
  if pending
@@ -172,30 +172,33 @@ db_namespace = namespace ns do
172
172
  desc "Rolls back the last migration"
173
173
  task rollback: [:"migrate:down"]
174
174
 
175
- # namespace :schema do
176
- # namespace :cache do
177
- # desc "Clears the database schema and indicies caches"
178
- # task clear: [] do
179
- # end
175
+ namespace :schema do
176
+ # namespace :cache do
177
+ # desc "Clears the database schema and indicies caches"
178
+ # task clear: [] do
179
+ # end
180
180
 
181
- # desc "Creates the database schema and indicies caches"
182
- # task dump: [] do
183
- # end
184
- # end
181
+ # desc "Creates the database schema and indicies caches"
182
+ # task dump: [] do
183
+ # end
184
+ # end
185
185
 
186
- # desc "Creates a backup of just the database's schema"
187
- # task dump: [] do
188
- # end
186
+ desc "Creates a backup of the database's schema"
187
+ task dump: [] do
188
+ puts "Please implement the #{ns}:schema:dump task within your Rakefile"
189
+ end
189
190
 
190
- # desc "Restores the database's schema from backup"
191
- # task load: [] do
192
- # end
193
- # end
191
+ desc "Restores the database's schema from backup"
192
+ task load: [] do
193
+ puts "Please implement the #{ns}:schema:load task within your Rakefile"
194
+ end
195
+ end
194
196
 
195
- # desc "Loads the seed data from db/seeds.rb"
196
- # task seed: [] do
197
- # end
197
+ desc "Loads seed data by running db/seeds.rb"
198
+ task seed: [:connection] do
199
+ require Rails.root.join("db", "seeds.rb")
200
+ end
198
201
 
199
- desc "Runs the #{ns}:create, #{ns}:migrate, #{ns}:seed tasks"
200
- task setup: [:"#{ns}:create", :"#{ns}:migrate", :"#{ns}:seed"]
202
+ desc "Runs the #{ns}:create, #{ns}:schema:load, #{ns}:migrate, #{ns}:seed tasks"
203
+ task setup: [:"#{ns}:create", :"#{ns}:schema:load", :"#{ns}:migrate", :"#{ns}:seed"]
201
204
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequelize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenaniah Cerny
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-16 00:00:00.000000000 Z
11
+ date: 2023-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - ".DS_Store"
148
+ - ".rubocop.yml"
148
149
  - ".standard.yml"
149
150
  - Appraisals
150
151
  - CHANGELOG.md