declare_schema 0.14.3 → 1.0.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: 27ae145f4edb218307dce4bf78aefff0de21188a481f8c9180a33831fe6ae9dc
4
- data.tar.gz: a8750df254820e71a477763731d09367449469d243021a6b246a4cd7118b2eee
3
+ metadata.gz: 65a5d6f6ca6a81d44fe5ff1d1fa0cc73249e2e20f02017e53c9dd3c6a03156b3
4
+ data.tar.gz: 167a53b05577190b8bb68b6871c41199ef4a2697fa2bc165fb4ed65355fecfeb
5
5
  SHA512:
6
- metadata.gz: b042815d991c698b5975a810ec25d741aa7897c3ec4df4acbbe2bcd29f47e52ba7b04ec4256bf9800fc721d5f81e27b8adbef7dfcda930d7cc4941a944ad3dfa
7
- data.tar.gz: 66528d14e7fcf88766271bd507e5e69b45514db5342baa39f2db75e5da562335c19159a1e7ed45c20a8cb9c4485283c1027aadb079f465a3eea2fe1ef5cdcc3f
6
+ metadata.gz: 11722905e9a2761a84124aadf10f20221eb8c5bab9aec35e65a2db216b14607f958db2fe2076920d4bcd6e537ca8dabad5c60ef514a5ff843e6675d4e042ac84
7
+ data.tar.gz: 103f1a41b5176b575b60141ed207c8e57d0c4ed8bc55a0235c318f928ff0a2dbf20bc2b889d8a6260c43fd0bcb1549a43581e594f1b2ebb70dc8312f68ab6476
@@ -8,18 +8,29 @@ jobs:
8
8
  name: DeclareSchema Build
9
9
  runs-on: ubuntu-latest
10
10
  strategy:
11
+ fail-fast: false
11
12
  matrix:
12
- ruby: [ 2.4.5, 2.5.8, 2.6.5, 2.7.1 ]
13
+ ruby: [2.6, 2.7, '3.0', 3.1]
13
14
  gemfile:
14
15
  - gemfiles/rails_5_mysql.gemfile
15
16
  - gemfiles/rails_5_sqlite.gemfile
16
17
  - gemfiles/rails_6_mysql.gemfile
17
18
  - gemfiles/rails_6_sqlite.gemfile
19
+ include:
20
+ - gemfile: gemfiles/rails_5_mysql.gemfile
21
+ ruby: 2.5
22
+ - gemfile: gemfiles/rails_5_sqlite.gemfile
23
+ ruby: 2.5
18
24
  exclude:
19
- - { gemfile: gemfiles/rails_5_mysql.gemfile, ruby: 2.4.5 }
20
- - { gemfile: gemfiles/rails_5_sqlite.gemfile, ruby: 2.4.5 }
21
- - { gemfile: gemfiles/rails_6_mysql.gemfile, ruby: 2.4.5 }
22
- - { gemfile: gemfiles/rails_6_sqlite.gemfile, ruby: 2.4.5 }
25
+ - ruby: '3.0'
26
+ gemfile: gemfiles/rails_5_mysql.gemfile
27
+ - ruby: 3.1
28
+ gemfile: gemfiles/rails_5_mysql.gemfile
29
+ - ruby: '3.0'
30
+ gemfile: gemfiles/rails_5_sqlite.gemfile
31
+ - ruby: 3.1
32
+ gemfile: gemfiles/rails_5_sqlite.gemfile
33
+
23
34
  env:
24
35
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
25
36
  services:
@@ -30,27 +41,15 @@ jobs:
30
41
  ports:
31
42
  - 3306:3306
32
43
  steps:
33
- - name: Checkout Branch
34
- id: checkout_branch
35
- uses: actions/checkout@v2
36
- - name: Setup Ruby
37
- id: setup_ruby
38
- uses: ruby/setup-ruby@v1
44
+ - uses: actions/checkout@v2
45
+ - uses: ruby/setup-ruby@v1
39
46
  with:
40
- bundler: 1.17.3
41
47
  ruby-version: ${{matrix.ruby}}
42
- - name: Remove Bundler 2
43
- id: remove_bundler_2
44
- if: ${{ matrix.ruby >= '2.6.5' }}
45
- run: |
46
- rm -f /opt/hostedtoolcache/Ruby/2.*/x64/lib/ruby/gems/2.*/specifications/default/bundler-2.*.gemspec
47
- gem install bundler:1.17.3 --force --default
48
- gem install bundler -v 1.17.3
49
- - name: Appraisals
50
- id: appraisals
48
+ bundler: 2.2.29
49
+ bundler-cache: true
50
+ - name: Setup
51
51
  run: |
52
- bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle} --gemfile=${{ matrix.gemfile }}
53
52
  git config --global user.email "dummy@example.com"
54
53
  git config --global user.name "dummy"
55
54
  MYSQL_PORT=3306 bundle exec rake test:prepare_testapp[force]
56
- bundle exec rake test:all
55
+ - run: bundle exec rake test:all
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.0
1
+ 2.7.5
data/Appraisals CHANGED
@@ -3,11 +3,18 @@
3
3
  appraise 'rails-5-sqlite' do
4
4
  gem 'rails', '~> 5.2'
5
5
  gem 'sqlite3'
6
+
7
+ remove_gem 'mail'
8
+ remove_gem 'net-smtp'
6
9
  end
7
10
 
8
11
  appraise 'rails-5-mysql' do
9
12
  gem 'rails', '~> 5.2'
10
13
  gem 'mysql2'
14
+
15
+ remove_gem 'mail'
16
+ remove_gem 'net-smtp'
17
+ remove_gem 'sqlite3'
11
18
  end
12
19
 
13
20
  appraise 'rails-6-sqlite' do
@@ -18,4 +25,5 @@ end
18
25
  appraise 'rails-6-mysql' do
19
26
  gem 'rails', '~> 6.1'
20
27
  gem 'mysql2'
28
+ remove_gem 'sqlite3'
21
29
  end
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.0.0] - 2022-03-28
8
+ ### Added
9
+ - Added support for Ruby 3+
10
+
11
+ ### Removed
12
+ - Removed deprecated `fields` block declaration
13
+
7
14
  ## [0.14.3] - 2021-09-01
8
15
  ### Fixed
9
16
  - Fixed more Ruby 2.7 warnings about needing `**options` when calling a method that has `**options` in its signature.
@@ -18,7 +25,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
18
25
 
19
26
  ## [0.14.0] - 2021-08-10
20
27
  ### Removed
21
- - Dropped support for Rails versions less than 5.
28
+ - Dropped support for Rails versions less than 5.
22
29
 
23
30
  ## [0.13.2] - 2021-08-04
24
31
  ### Fixed
@@ -55,7 +62,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
55
62
  The migration will be run if `--migrate` is passed; otherwise, the migrate command will be displayed to be run later.
56
63
  ### Added
57
64
  - Added the new configuration option `DeclareSchema.@db_migrate_command =`.
58
- ### Fixed
65
+ ### Fixed
59
66
  - Fixed bug where foreign key constraint names are not globally unique
60
67
 
61
68
  ## [0.10.1] - 2021-03-18
@@ -109,7 +116,7 @@ i.e. `declare schema { string :title }`. Otherwise, there is no difference betwe
109
116
  ### Fixed
110
117
  - Fixed a bug in migration generation caused by `DeclareSchema::Migration#create_constraints`
111
118
  calling `DeclareSchema::Model::ForeignKeyDefinition#to_add_statement` with unused parameters.
112
-
119
+
113
120
  - Fixed a bug in `DeclareSchema::Migration#remove_foreign_key` where special characters would not be quoted properly.
114
121
 
115
122
  ## [0.6.2] - 2021-01-06
@@ -134,7 +141,7 @@ because all of the existing primary key columns are being removed.
134
141
  - FieldSpec#initialize interface now includes `position` keyword argument and `**options` hash.
135
142
 
136
143
  ### Fixed
137
- - Fixed cycle in which FieldSpec#initialize was calling `model.field_specs`
144
+ - Fixed cycle in which FieldSpec#initialize was calling `model.field_specs`
138
145
 
139
146
  ### Changed
140
147
  - Changed ci support from Travis to Github Workflow
@@ -208,6 +215,7 @@ using the appropriate Rails configuration attributes.
208
215
  ### Added
209
216
  - Initial version from https://github.com/Invoca/hobo_fields v4.1.0.
210
217
 
218
+ [1.0.0]: https://github.com/Invoca/declare_schema/compare/v0.14.3...v1.0.0
211
219
  [0.14.3]: https://github.com/Invoca/declare_schema/compare/v0.14.2...v0.14.3
212
220
  [0.14.2]: https://github.com/Invoca/declare_schema/compare/v0.14.1...v0.14.2
213
221
  [0.14.1]: https://github.com/Invoca/declare_schema/compare/v0.14.0...v0.14.1
data/Gemfile CHANGED
@@ -10,11 +10,12 @@ group :testapp do
10
10
  end
11
11
 
12
12
  gem 'appraisal'
13
- gem 'bundler', '< 2'
14
13
  gem "climate_control", '~> 0.2'
14
+ gem 'mail'
15
+ gem 'net-smtp'
15
16
  gem 'pry'
16
17
  gem 'pry-byebug'
17
- gem 'rails', '~> 5.2', '>= 5.2.4.3'
18
+ gem 'rails', '~> 6.0'
18
19
  gem 'responders'
19
20
  gem 'rspec'
20
21
  gem 'rubocop'
data/Gemfile.lock CHANGED
@@ -1,58 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (0.14.3)
4
+ declare_schema (1.0.0)
5
5
  rails (>= 5.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.2.6)
11
- actionpack (= 5.2.6)
10
+ actioncable (6.1.5)
11
+ actionpack (= 6.1.5)
12
+ activesupport (= 6.1.5)
12
13
  nio4r (~> 2.0)
13
14
  websocket-driver (>= 0.6.1)
14
- actionmailer (5.2.6)
15
- actionpack (= 5.2.6)
16
- actionview (= 5.2.6)
17
- activejob (= 5.2.6)
15
+ actionmailbox (6.1.5)
16
+ actionpack (= 6.1.5)
17
+ activejob (= 6.1.5)
18
+ activerecord (= 6.1.5)
19
+ activestorage (= 6.1.5)
20
+ activesupport (= 6.1.5)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.5)
23
+ actionpack (= 6.1.5)
24
+ actionview (= 6.1.5)
25
+ activejob (= 6.1.5)
26
+ activesupport (= 6.1.5)
18
27
  mail (~> 2.5, >= 2.5.4)
19
28
  rails-dom-testing (~> 2.0)
20
- actionpack (5.2.6)
21
- actionview (= 5.2.6)
22
- activesupport (= 5.2.6)
23
- rack (~> 2.0, >= 2.0.8)
29
+ actionpack (6.1.5)
30
+ actionview (= 6.1.5)
31
+ activesupport (= 6.1.5)
32
+ rack (~> 2.0, >= 2.0.9)
24
33
  rack-test (>= 0.6.3)
25
34
  rails-dom-testing (~> 2.0)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.2.6)
28
- activesupport (= 5.2.6)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.5)
37
+ actionpack (= 6.1.5)
38
+ activerecord (= 6.1.5)
39
+ activestorage (= 6.1.5)
40
+ activesupport (= 6.1.5)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.5)
43
+ activesupport (= 6.1.5)
29
44
  builder (~> 3.1)
30
45
  erubi (~> 1.4)
31
46
  rails-dom-testing (~> 2.0)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
- activejob (5.2.6)
34
- activesupport (= 5.2.6)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.5)
49
+ activesupport (= 6.1.5)
35
50
  globalid (>= 0.3.6)
36
- activemodel (5.2.6)
37
- activesupport (= 5.2.6)
38
- activerecord (5.2.6)
39
- activemodel (= 5.2.6)
40
- activesupport (= 5.2.6)
41
- arel (>= 9.0)
42
- activestorage (5.2.6)
43
- actionpack (= 5.2.6)
44
- activerecord (= 5.2.6)
45
- marcel (~> 1.0.0)
46
- activesupport (5.2.6)
51
+ activemodel (6.1.5)
52
+ activesupport (= 6.1.5)
53
+ activerecord (6.1.5)
54
+ activemodel (= 6.1.5)
55
+ activesupport (= 6.1.5)
56
+ activestorage (6.1.5)
57
+ actionpack (= 6.1.5)
58
+ activejob (= 6.1.5)
59
+ activerecord (= 6.1.5)
60
+ activesupport (= 6.1.5)
61
+ marcel (~> 1.0)
62
+ mini_mime (>= 1.1.0)
63
+ activesupport (6.1.5)
47
64
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
- i18n (>= 0.7, < 2)
49
- minitest (~> 5.1)
50
- tzinfo (~> 1.1)
51
- appraisal (2.3.0)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ appraisal (2.4.1)
52
70
  bundler
53
71
  rake
54
72
  thor (>= 0.14.0)
55
- arel (9.0.0)
56
73
  ast (2.4.1)
57
74
  bootsnap (1.7.2)
58
75
  msgpack (~> 1.0)
@@ -60,32 +77,41 @@ GEM
60
77
  byebug (11.1.3)
61
78
  climate_control (0.2.0)
62
79
  coderay (1.1.3)
63
- concurrent-ruby (1.1.9)
80
+ concurrent-ruby (1.1.10)
64
81
  crass (1.0.6)
65
82
  diff-lcs (1.4.4)
83
+ digest (3.1.0)
66
84
  erubi (1.10.0)
67
85
  ffi (1.15.1)
68
- globalid (0.4.2)
69
- activesupport (>= 4.2.0)
70
- i18n (1.8.10)
86
+ globalid (1.0.0)
87
+ activesupport (>= 5.0)
88
+ i18n (1.10.0)
71
89
  concurrent-ruby (~> 1.0)
90
+ io-wait (0.2.1)
72
91
  listen (3.5.1)
73
92
  rb-fsevent (~> 0.10, >= 0.10.3)
74
93
  rb-inotify (~> 0.9, >= 0.9.10)
75
- loofah (2.10.0)
94
+ loofah (2.15.0)
76
95
  crass (~> 1.0.2)
77
96
  nokogiri (>= 1.5.9)
78
97
  mail (2.7.1)
79
98
  mini_mime (>= 0.1.1)
80
- marcel (1.0.1)
99
+ marcel (1.0.2)
81
100
  method_source (1.0.0)
82
- mini_mime (1.1.0)
83
- mini_portile2 (2.5.3)
84
- minitest (5.14.4)
101
+ mini_mime (1.1.2)
102
+ mini_portile2 (2.8.0)
103
+ minitest (5.15.0)
85
104
  msgpack (1.4.2)
86
- nio4r (2.5.7)
87
- nokogiri (1.11.7)
88
- mini_portile2 (~> 2.5.0)
105
+ net-protocol (0.1.2)
106
+ io-wait
107
+ timeout
108
+ net-smtp (0.3.1)
109
+ digest
110
+ net-protocol
111
+ timeout
112
+ nio4r (2.5.8)
113
+ nokogiri (1.13.3)
114
+ mini_portile2 (~> 2.8.0)
89
115
  racc (~> 1.4)
90
116
  parallel (1.19.2)
91
117
  parser (2.7.1.4)
@@ -96,36 +122,38 @@ GEM
96
122
  pry-byebug (3.9.0)
97
123
  byebug (~> 11.0)
98
124
  pry (~> 0.13.0)
99
- racc (1.5.2)
125
+ racc (1.6.0)
100
126
  rack (2.2.3)
101
127
  rack-test (1.1.0)
102
128
  rack (>= 1.0, < 3)
103
- rails (5.2.6)
104
- actioncable (= 5.2.6)
105
- actionmailer (= 5.2.6)
106
- actionpack (= 5.2.6)
107
- actionview (= 5.2.6)
108
- activejob (= 5.2.6)
109
- activemodel (= 5.2.6)
110
- activerecord (= 5.2.6)
111
- activestorage (= 5.2.6)
112
- activesupport (= 5.2.6)
113
- bundler (>= 1.3.0)
114
- railties (= 5.2.6)
129
+ rails (6.1.5)
130
+ actioncable (= 6.1.5)
131
+ actionmailbox (= 6.1.5)
132
+ actionmailer (= 6.1.5)
133
+ actionpack (= 6.1.5)
134
+ actiontext (= 6.1.5)
135
+ actionview (= 6.1.5)
136
+ activejob (= 6.1.5)
137
+ activemodel (= 6.1.5)
138
+ activerecord (= 6.1.5)
139
+ activestorage (= 6.1.5)
140
+ activesupport (= 6.1.5)
141
+ bundler (>= 1.15.0)
142
+ railties (= 6.1.5)
115
143
  sprockets-rails (>= 2.0.0)
116
144
  rails-dom-testing (2.0.3)
117
145
  activesupport (>= 4.2.0)
118
146
  nokogiri (>= 1.6)
119
- rails-html-sanitizer (1.3.0)
147
+ rails-html-sanitizer (1.4.2)
120
148
  loofah (~> 2.3)
121
- railties (5.2.6)
122
- actionpack (= 5.2.6)
123
- activesupport (= 5.2.6)
149
+ railties (6.1.5)
150
+ actionpack (= 6.1.5)
151
+ activesupport (= 6.1.5)
124
152
  method_source
125
- rake (>= 0.8.7)
126
- thor (>= 0.19.0, < 2.0)
153
+ rake (>= 12.2)
154
+ thor (~> 1.0)
127
155
  rainbow (3.0.0)
128
- rake (13.0.3)
156
+ rake (13.0.6)
129
157
  rb-fsevent (0.11.0)
130
158
  rb-inotify (0.10.1)
131
159
  ffi (~> 1.0)
@@ -159,23 +187,24 @@ GEM
159
187
  rubocop-ast (0.4.2)
160
188
  parser (>= 2.7.1.4)
161
189
  ruby-progressbar (1.10.1)
162
- sprockets (4.0.2)
190
+ sprockets (4.0.3)
163
191
  concurrent-ruby (~> 1.0)
164
192
  rack (> 1, < 3)
165
- sprockets-rails (3.2.2)
166
- actionpack (>= 4.0)
167
- activesupport (>= 4.0)
193
+ sprockets-rails (3.4.2)
194
+ actionpack (>= 5.2)
195
+ activesupport (>= 5.2)
168
196
  sprockets (>= 3.0.0)
169
197
  sqlite3 (1.4.2)
170
- thor (1.1.0)
171
- thread_safe (0.3.6)
172
- tzinfo (1.2.9)
173
- thread_safe (~> 0.1)
198
+ thor (1.2.1)
199
+ timeout (0.2.0)
200
+ tzinfo (2.0.4)
201
+ concurrent-ruby (~> 1.0)
174
202
  unicode-display_width (1.7.0)
175
- websocket-driver (0.7.4)
203
+ websocket-driver (0.7.5)
176
204
  websocket-extensions (>= 0.1.0)
177
205
  websocket-extensions (0.1.5)
178
206
  yard (0.9.26)
207
+ zeitwerk (2.5.4)
179
208
 
180
209
  PLATFORMS
181
210
  ruby
@@ -183,13 +212,14 @@ PLATFORMS
183
212
  DEPENDENCIES
184
213
  appraisal
185
214
  bootsnap (>= 1.1.0)
186
- bundler (< 2)
187
215
  climate_control (~> 0.2)
188
216
  declare_schema!
189
217
  listen
218
+ mail
219
+ net-smtp
190
220
  pry
191
221
  pry-byebug
192
- rails (~> 5.2, >= 5.2.4.3)
222
+ rails (~> 6.0)
193
223
  responders
194
224
  rspec
195
225
  rubocop
@@ -197,4 +227,4 @@ DEPENDENCIES
197
227
  yard
198
228
 
199
229
  BUNDLED WITH
200
- 1.17.3
230
+ 2.2.29
data/README.md CHANGED
@@ -8,10 +8,10 @@ Make a model and declare your schema within a `declare_schema do ... end` block:
8
8
  ```ruby
9
9
  class Company < ActiveRecord::Base
10
10
  declare_schema do
11
- company_name :string, limit: 100
12
- ticker_symbol :string, limit: 4, null: true, index: true, unique: true
13
- employee_count :integer
14
- comments :text
11
+ string :company_name, limit: 100
12
+ string :ticker_symbol, limit: 4, null: true, index: true, unique: true
13
+ integer :employee_count
14
+ text :comments
15
15
 
16
16
  timestamps
17
17
  end
@@ -50,6 +50,16 @@ Migration filename: [<enter>=declare_schema_migration_1|<custom_name>]: add_comp
50
50
  ```
51
51
  Note that the migration generator is interactive -- it can't tell the difference between renaming something vs. adding one thing and removing another, so sometimes it will ask you to clarify.
52
52
 
53
+ ## declare_schema macro options
54
+
55
+ Any options provided to the `declare_schema` macro will be passed on to `create_table`. For example, to set the `id` column of the table explicitly to `:bigint`:
56
+ ```
57
+ declare_schema id: :bigint do
58
+ string :company_name, limit: 100
59
+ ...
60
+ end
61
+ ```
62
+
53
63
  ## Migrator Configuration
54
64
 
55
65
  The following configuration options are available for the gem and can be used
@@ -224,8 +234,8 @@ like the following:
224
234
 
225
235
  class Comment < ActiveRecord::Base
226
236
  declare_schema charset: "utf8mb4", collation: "utf8mb4_bin" do
227
- subject :string, limit: 255
228
- content :text, limit: 0xffff_ffff
237
+ string :subject, limit: 255
238
+ text :content, limit: 0xffff_ffff
229
239
  end
230
240
  end
231
241
  ```
@@ -244,8 +254,8 @@ look like the following:
244
254
 
245
255
  class Comment < ActiveRecord::Base
246
256
  declare_schema do
247
- subject :string, limit: 255
248
- context :text, limit: 0xffff_ffff, charset: "utf8mb4", collation: "utf8mb4_bin"
257
+ string :subject, limit: 255
258
+ text :context, limit: 0xffff_ffff, charset: "utf8mb4", collation: "utf8mb4_bin"
249
259
  end
250
260
  end
251
261
  ```
data/Rakefile CHANGED
@@ -50,7 +50,7 @@ namespace "test" do
50
50
  echo \"gem 'irb', :group => :development\") >> Gemfile"
51
51
  sh "echo '' > app/models/.gitignore" # because git reset --hard would rm the dir
52
52
  rm ".gitignore" # we need to reset everything in a testapp
53
- sh "git init && git add . && git commit -m \"initial commit\""
53
+ sh "git init && git add . && git commit -nm \"initial commit\""
54
54
  sh "rake db:create"
55
55
  puts "The testapp has been created in '#{TESTAPP_PATH}'"
56
56
  else
@@ -3,7 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "bundler", "< 2"
7
6
  gem "climate_control", "~> 0.2"
8
7
  gem "pry"
9
8
  gem "pry-byebug"
@@ -3,7 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "bundler", "< 2"
7
6
  gem "climate_control", "~> 0.2"
8
7
  gem "pry"
9
8
  gem "pry-byebug"
@@ -3,8 +3,9 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "bundler", "< 2"
7
6
  gem "climate_control", "~> 0.2"
7
+ gem "mail"
8
+ gem "net-smtp"
8
9
  gem "pry"
9
10
  gem "pry-byebug"
10
11
  gem "rails", "~> 6.1"
@@ -3,8 +3,9 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "bundler", "< 2"
7
6
  gem "climate_control", "~> 0.2"
7
+ gem "mail"
8
+ gem "net-smtp"
8
9
  gem "pry"
9
10
  gem "pry-byebug"
10
11
  gem "rails", "~> 6.1"
@@ -16,7 +16,7 @@ module DeclareSchema
16
16
  EOS
17
17
 
18
18
  class << self
19
- def run(gem, args, version, gemfile_options = {})
19
+ def run(gem, args, version, **gemfile_options)
20
20
  command = args.shift
21
21
 
22
22
  case command
@@ -12,7 +12,7 @@ module DeclareSchema
12
12
  end
13
13
  end
14
14
 
15
- def initialize(model, options = {})
15
+ def initialize(model, **options)
16
16
  @model = model
17
17
  @options = options
18
18
  end
@@ -9,24 +9,6 @@ module DeclareSchema
9
9
  module Macros
10
10
  attr_reader :_table_options
11
11
 
12
- def fields(table_options = {}, &block)
13
- # Any model that calls 'fields' gets DeclareSchema::Model behavior
14
- DeclareSchema::Model.mix_in(self)
15
-
16
- @include_in_migration = true
17
- @_table_options = table_options
18
-
19
- if block
20
- dsl = DeclareSchema::FieldDeclarationDsl.new(self)
21
- if block.arity == 1
22
- yield dsl
23
- else
24
- dsl.instance_eval(&block)
25
- end
26
- end
27
- end
28
- deprecate :fields, deprecator: ActiveSupport::Deprecation.new('1.0', 'DeclareSchema')
29
-
30
12
  def declare_schema(default_schema: true, **table_options, &block)
31
13
  # Any model that calls 'fields' gets DeclareSchema::Model behavior
32
14
  DeclareSchema::Model.mix_in(self)
@@ -12,7 +12,7 @@ module DeclareSchema
12
12
  end
13
13
  end
14
14
 
15
- def initialize(model, options = {})
15
+ def initialize(model, **options)
16
16
  @model = model
17
17
  @options = options
18
18
  end
@@ -29,11 +29,11 @@ module DeclareSchema
29
29
  end
30
30
 
31
31
  def field(name, type, *args, **options)
32
- @model.declare_field(name, type, *[*args, @options.merge(options)])
32
+ @model.declare_field(name, type, *args, **@options.merge(options))
33
33
  end
34
34
 
35
- def method_missing(name, *args)
36
- field(name, *args)
35
+ def method_missing(name, *args, **options)
36
+ field(name, *args, **options)
37
37
  end
38
38
  end
39
39
  end
@@ -10,7 +10,7 @@ module DeclareSchema
10
10
  attr_reader :constraint_name, :model, :foreign_key, :foreign_key_name, :parent_table_name, :child_table_name, :options, :on_delete_cascade
11
11
 
12
12
 
13
- def initialize(model, foreign_key, options = {})
13
+ def initialize(model, foreign_key, **options)
14
14
  @model = model
15
15
  @foreign_key = foreign_key.to_s.presence
16
16
  @options = options
@@ -38,7 +38,7 @@ module DeclareSchema
38
38
  }
39
39
  options[:dependent] = :delete if fkc['ON DELETE CASCADE']
40
40
 
41
- new(model, foreign_key, options)
41
+ new(model, foreign_key, **options)
42
42
  end
43
43
  end
44
44
  end
@@ -14,7 +14,7 @@ module DeclareSchema
14
14
  PRIMARY_KEY_NAME = "PRIMARY"
15
15
  MYSQL_INDEX_NAME_MAX_LENGTH = 64
16
16
 
17
- def initialize(model, fields, options = {})
17
+ def initialize(model, fields, **options)
18
18
  @model = model
19
19
  @table = options.delete(:table_name) || model.table_name
20
20
  @fields = Array.wrap(fields).map(&:to_s)