arfi 0.4.0 → 0.5.0

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.
@@ -0,0 +1,452 @@
1
+ ---
2
+ path: ".gem_rbs_collection"
3
+ gems:
4
+ - name: actioncable
5
+ version: '7.1'
6
+ source:
7
+ type: git
8
+ name: ruby/gem_rbs_collection
9
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
10
+ remote: https://github.com/ruby/gem_rbs_collection.git
11
+ repo_dir: gems
12
+ - name: actionmailer
13
+ version: '7.0'
14
+ source:
15
+ type: git
16
+ name: ruby/gem_rbs_collection
17
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
18
+ remote: https://github.com/ruby/gem_rbs_collection.git
19
+ repo_dir: gems
20
+ - name: actionpack
21
+ version: '7.2'
22
+ source:
23
+ type: git
24
+ name: ruby/gem_rbs_collection
25
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
26
+ remote: https://github.com/ruby/gem_rbs_collection.git
27
+ repo_dir: gems
28
+ - name: actiontext
29
+ version: '7.2'
30
+ source:
31
+ type: git
32
+ name: ruby/gem_rbs_collection
33
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
34
+ remote: https://github.com/ruby/gem_rbs_collection.git
35
+ repo_dir: gems
36
+ - name: actionview
37
+ version: '6.0'
38
+ source:
39
+ type: git
40
+ name: ruby/gem_rbs_collection
41
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
42
+ remote: https://github.com/ruby/gem_rbs_collection.git
43
+ repo_dir: gems
44
+ - name: activejob
45
+ version: '6.0'
46
+ source:
47
+ type: git
48
+ name: ruby/gem_rbs_collection
49
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
50
+ remote: https://github.com/ruby/gem_rbs_collection.git
51
+ repo_dir: gems
52
+ - name: activemodel
53
+ version: '7.1'
54
+ source:
55
+ type: git
56
+ name: ruby/gem_rbs_collection
57
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
58
+ remote: https://github.com/ruby/gem_rbs_collection.git
59
+ repo_dir: gems
60
+ - name: activerecord
61
+ version: '8.0'
62
+ source:
63
+ type: git
64
+ name: ruby/gem_rbs_collection
65
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
66
+ remote: https://github.com/ruby/gem_rbs_collection.git
67
+ repo_dir: gems
68
+ - name: activestorage
69
+ version: '7.0'
70
+ source:
71
+ type: git
72
+ name: ruby/gem_rbs_collection
73
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
74
+ remote: https://github.com/ruby/gem_rbs_collection.git
75
+ repo_dir: gems
76
+ - name: activesupport
77
+ version: '7.0'
78
+ source:
79
+ type: git
80
+ name: ruby/gem_rbs_collection
81
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
82
+ remote: https://github.com/ruby/gem_rbs_collection.git
83
+ repo_dir: gems
84
+ - name: ast
85
+ version: '2.4'
86
+ source:
87
+ type: git
88
+ name: ruby/gem_rbs_collection
89
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
90
+ remote: https://github.com/ruby/gem_rbs_collection.git
91
+ repo_dir: gems
92
+ - name: base64
93
+ version: '0.1'
94
+ source:
95
+ type: git
96
+ name: ruby/gem_rbs_collection
97
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
98
+ remote: https://github.com/ruby/gem_rbs_collection.git
99
+ repo_dir: gems
100
+ - name: benchmark
101
+ version: '0'
102
+ source:
103
+ type: stdlib
104
+ - name: bigdecimal
105
+ version: '3.1'
106
+ source:
107
+ type: git
108
+ name: ruby/gem_rbs_collection
109
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
110
+ remote: https://github.com/ruby/gem_rbs_collection.git
111
+ repo_dir: gems
112
+ - name: cgi
113
+ version: '0'
114
+ source:
115
+ type: stdlib
116
+ - name: concurrent-ruby
117
+ version: '1.1'
118
+ source:
119
+ type: git
120
+ name: ruby/gem_rbs_collection
121
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
122
+ remote: https://github.com/ruby/gem_rbs_collection.git
123
+ repo_dir: gems
124
+ - name: connection_pool
125
+ version: '2.4'
126
+ source:
127
+ type: git
128
+ name: ruby/gem_rbs_collection
129
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
130
+ remote: https://github.com/ruby/gem_rbs_collection.git
131
+ repo_dir: gems
132
+ - name: csv
133
+ version: '3.3'
134
+ source:
135
+ type: git
136
+ name: ruby/gem_rbs_collection
137
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
138
+ remote: https://github.com/ruby/gem_rbs_collection.git
139
+ repo_dir: gems
140
+ - name: date
141
+ version: '0'
142
+ source:
143
+ type: stdlib
144
+ - name: delegate
145
+ version: '0'
146
+ source:
147
+ type: stdlib
148
+ - name: diff-lcs
149
+ version: '1.5'
150
+ source:
151
+ type: git
152
+ name: ruby/gem_rbs_collection
153
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
154
+ remote: https://github.com/ruby/gem_rbs_collection.git
155
+ repo_dir: gems
156
+ - name: digest
157
+ version: '0'
158
+ source:
159
+ type: stdlib
160
+ - name: erb
161
+ version: '0'
162
+ source:
163
+ type: stdlib
164
+ - name: ffi
165
+ version: 1.17.2
166
+ source:
167
+ type: rubygems
168
+ - name: fileutils
169
+ version: '0'
170
+ source:
171
+ type: stdlib
172
+ - name: forwardable
173
+ version: '0'
174
+ source:
175
+ type: stdlib
176
+ - name: globalid
177
+ version: '1.1'
178
+ source:
179
+ type: git
180
+ name: ruby/gem_rbs_collection
181
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
182
+ remote: https://github.com/ruby/gem_rbs_collection.git
183
+ repo_dir: gems
184
+ - name: i18n
185
+ version: '1.10'
186
+ source:
187
+ type: git
188
+ name: ruby/gem_rbs_collection
189
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
190
+ remote: https://github.com/ruby/gem_rbs_collection.git
191
+ repo_dir: gems
192
+ - name: io-console
193
+ version: '0'
194
+ source:
195
+ type: stdlib
196
+ - name: json
197
+ version: '0'
198
+ source:
199
+ type: stdlib
200
+ - name: listen
201
+ version: '3.9'
202
+ source:
203
+ type: git
204
+ name: ruby/gem_rbs_collection
205
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
206
+ remote: https://github.com/ruby/gem_rbs_collection.git
207
+ repo_dir: gems
208
+ - name: logger
209
+ version: '0'
210
+ source:
211
+ type: stdlib
212
+ - name: mail
213
+ version: '2.8'
214
+ source:
215
+ type: git
216
+ name: ruby/gem_rbs_collection
217
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
218
+ remote: https://github.com/ruby/gem_rbs_collection.git
219
+ repo_dir: gems
220
+ - name: marcel
221
+ version: '1.0'
222
+ source:
223
+ type: git
224
+ name: ruby/gem_rbs_collection
225
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
226
+ remote: https://github.com/ruby/gem_rbs_collection.git
227
+ repo_dir: gems
228
+ - name: mini_mime
229
+ version: '0.1'
230
+ source:
231
+ type: git
232
+ name: ruby/gem_rbs_collection
233
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
234
+ remote: https://github.com/ruby/gem_rbs_collection.git
235
+ repo_dir: gems
236
+ - name: minitest
237
+ version: '5.25'
238
+ source:
239
+ type: git
240
+ name: ruby/gem_rbs_collection
241
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
242
+ remote: https://github.com/ruby/gem_rbs_collection.git
243
+ repo_dir: gems
244
+ - name: monitor
245
+ version: '0'
246
+ source:
247
+ type: stdlib
248
+ - name: mutex_m
249
+ version: 0.3.0
250
+ source:
251
+ type: rubygems
252
+ - name: net-protocol
253
+ version: '0'
254
+ source:
255
+ type: stdlib
256
+ - name: net-smtp
257
+ version: '0.5'
258
+ source:
259
+ type: git
260
+ name: ruby/gem_rbs_collection
261
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
262
+ remote: https://github.com/ruby/gem_rbs_collection.git
263
+ repo_dir: gems
264
+ - name: nokogiri
265
+ version: '1.11'
266
+ source:
267
+ type: git
268
+ name: ruby/gem_rbs_collection
269
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
270
+ remote: https://github.com/ruby/gem_rbs_collection.git
271
+ repo_dir: gems
272
+ - name: openssl
273
+ version: '0'
274
+ source:
275
+ type: stdlib
276
+ - name: optparse
277
+ version: '0'
278
+ source:
279
+ type: stdlib
280
+ - name: parallel
281
+ version: '1.20'
282
+ source:
283
+ type: git
284
+ name: ruby/gem_rbs_collection
285
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
286
+ remote: https://github.com/ruby/gem_rbs_collection.git
287
+ repo_dir: gems
288
+ - name: parser
289
+ version: '3.2'
290
+ source:
291
+ type: git
292
+ name: ruby/gem_rbs_collection
293
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
294
+ remote: https://github.com/ruby/gem_rbs_collection.git
295
+ repo_dir: gems
296
+ - name: pathname
297
+ version: '0'
298
+ source:
299
+ type: stdlib
300
+ - name: pp
301
+ version: '0'
302
+ source:
303
+ type: stdlib
304
+ - name: prettyprint
305
+ version: '0'
306
+ source:
307
+ type: stdlib
308
+ - name: prism
309
+ version: 1.4.0
310
+ source:
311
+ type: rubygems
312
+ - name: rack
313
+ version: '2.2'
314
+ source:
315
+ type: git
316
+ name: ruby/gem_rbs_collection
317
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
318
+ remote: https://github.com/ruby/gem_rbs_collection.git
319
+ repo_dir: gems
320
+ - name: rails-dom-testing
321
+ version: '2.0'
322
+ source:
323
+ type: git
324
+ name: ruby/gem_rbs_collection
325
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
326
+ remote: https://github.com/ruby/gem_rbs_collection.git
327
+ repo_dir: gems
328
+ - name: rails-html-sanitizer
329
+ version: '1.6'
330
+ source:
331
+ type: git
332
+ name: ruby/gem_rbs_collection
333
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
334
+ remote: https://github.com/ruby/gem_rbs_collection.git
335
+ repo_dir: gems
336
+ - name: railties
337
+ version: '6.0'
338
+ source:
339
+ type: git
340
+ name: ruby/gem_rbs_collection
341
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
342
+ remote: https://github.com/ruby/gem_rbs_collection.git
343
+ repo_dir: gems
344
+ - name: rainbow
345
+ version: '3.0'
346
+ source:
347
+ type: git
348
+ name: ruby/gem_rbs_collection
349
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
350
+ remote: https://github.com/ruby/gem_rbs_collection.git
351
+ repo_dir: gems
352
+ - name: rake
353
+ version: '13.0'
354
+ source:
355
+ type: git
356
+ name: ruby/gem_rbs_collection
357
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
358
+ remote: https://github.com/ruby/gem_rbs_collection.git
359
+ repo_dir: gems
360
+ - name: rbs
361
+ version: 3.9.4
362
+ source:
363
+ type: rubygems
364
+ - name: rdoc
365
+ version: '0'
366
+ source:
367
+ type: stdlib
368
+ - name: regexp_parser
369
+ version: '2.8'
370
+ source:
371
+ type: git
372
+ name: ruby/gem_rbs_collection
373
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
374
+ remote: https://github.com/ruby/gem_rbs_collection.git
375
+ repo_dir: gems
376
+ - name: repl_type_completor
377
+ version: 0.1.11
378
+ source:
379
+ type: rubygems
380
+ - name: rubocop
381
+ version: '1.57'
382
+ source:
383
+ type: git
384
+ name: ruby/gem_rbs_collection
385
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
386
+ remote: https://github.com/ruby/gem_rbs_collection.git
387
+ repo_dir: gems
388
+ - name: rubocop-ast
389
+ version: '1.30'
390
+ source:
391
+ type: git
392
+ name: ruby/gem_rbs_collection
393
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
394
+ remote: https://github.com/ruby/gem_rbs_collection.git
395
+ repo_dir: gems
396
+ - name: securerandom
397
+ version: '0'
398
+ source:
399
+ type: stdlib
400
+ - name: singleton
401
+ version: '0'
402
+ source:
403
+ type: stdlib
404
+ - name: socket
405
+ version: '0'
406
+ source:
407
+ type: stdlib
408
+ - name: stringio
409
+ version: '0'
410
+ source:
411
+ type: stdlib
412
+ - name: strscan
413
+ version: '0'
414
+ source:
415
+ type: stdlib
416
+ - name: tempfile
417
+ version: '0'
418
+ source:
419
+ type: stdlib
420
+ - name: thor
421
+ version: '1.2'
422
+ source:
423
+ type: git
424
+ name: ruby/gem_rbs_collection
425
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
426
+ remote: https://github.com/ruby/gem_rbs_collection.git
427
+ repo_dir: gems
428
+ - name: time
429
+ version: '0'
430
+ source:
431
+ type: stdlib
432
+ - name: timeout
433
+ version: '0'
434
+ source:
435
+ type: stdlib
436
+ - name: tsort
437
+ version: '0'
438
+ source:
439
+ type: stdlib
440
+ - name: tzinfo
441
+ version: '2.0'
442
+ source:
443
+ type: git
444
+ name: ruby/gem_rbs_collection
445
+ revision: a9830177c3fdbebb92f6db6a166ae3e368818162
446
+ remote: https://github.com/ruby/gem_rbs_collection.git
447
+ repo_dir: gems
448
+ - name: uri
449
+ version: '0'
450
+ source:
451
+ type: stdlib
452
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,19 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ # gems:
17
+ # # If you want to avoid installing rbs files for gems, you can specify them here.
18
+ # - name: GEM_NAME
19
+ # ignore: true
data/sig/arfi.rbs ADDED
@@ -0,0 +1,2 @@
1
+ module Arfi
2
+ end
@@ -0,0 +1,6 @@
1
+ module Arfi
2
+ # Top level CLI class
3
+ class CLI < Thor
4
+ def version: -> ::Integer
5
+ end
6
+ end
@@ -0,0 +1,107 @@
1
+ module Arfi
2
+ module Commands
3
+ class FIdx < Thor
4
+ ADAPTERS: Array[Symbol]
5
+
6
+ # +Arfi::Commands::FIdx#create+ -> void
7
+ #
8
+ # This command is used to create the functional index.
9
+ #
10
+ # @example
11
+ # bundle exec arfi f_idx create some_function
12
+ # @param index_name [String] Name of the index.
13
+ # @return [void]
14
+ # @raise [Arfi::Errors::InvalidSchemaFormat] if ActiveRecord.schema_format is not :ruby
15
+ # @raise [Arfi::Errors::NoFunctionsDir] if there is no `db/functions` directory
16
+ # @see Arfi::Commands::FIdx#validate_schema_format!
17
+ def create: (string index_name) -> untyped
18
+
19
+ # +Arfi::Commands::FIdx#destroy+ -> void
20
+ #
21
+ # This command is used to delete the functional index.
22
+ #
23
+ # @example
24
+ # bundle exec arfi f_idx destroy some_function [revision index (just an integer, 1 is by default)]
25
+ # @param index_name [String] Name of the index.
26
+ # @return [void]
27
+ # @raise [Arfi::Errors::InvalidSchemaFormat] if ActiveRecord.schema_format is not :ruby
28
+ def destroy: (string index_name) -> untyped
29
+
30
+ private
31
+
32
+ # +Arfi::Commands::FIdx#build_from_file+ -> String
33
+ #
34
+ # Helper method to build the SQL function. Used with flag `--template`.
35
+ #
36
+ # @!visibility private
37
+ # @private
38
+ # @param index_name [String] Name of the index.
39
+ # @return [String] SQL function body.
40
+ # @see Arfi::Commands::FIdx#create
41
+ # @see Arfi::Commands::FIdx#build_sql_function
42
+ def build_from_file: (string index_name) -> String
43
+
44
+ # +Arfi::Commands::FIdx#functions_dir+ -> Pathname
45
+ #
46
+ # Helper method to get path to `db/functions` directory.
47
+ #
48
+ # @!visibility private
49
+ # @private
50
+ # @return [Pathname] Path to `db/functions` directory
51
+ def functions_dir: () -> Pathname
52
+
53
+ # +Arfi::Commands::FIdx#validate_schema_format!+ -> void
54
+ #
55
+ # Helper method to validate the schema format.
56
+ #
57
+ # @!visibility private
58
+ # @private
59
+ # @raise [Arfi::Errors::InvalidSchemaFormat] if ActiveRecord.schema_format is not :ruby.
60
+ # @return [nil] if the schema format is valid.
61
+ def validate_schema_format!: () -> (untyped | nil)
62
+
63
+ # +Arfi::Commands::FIdx#build_sql_function+ -> String
64
+ #
65
+ # Helper method to build the SQL function.
66
+ #
67
+ # @!visibility private
68
+ # @private
69
+ # @param index_name [String] Name of the index.
70
+ # @return [String] SQL function body.
71
+ def build_sql_function: (string index_name) -> ::String
72
+
73
+ # +Arfi::Commands::FIdx#create_function_file+ -> void
74
+ #
75
+ # Helper method to create the index file.
76
+ #
77
+ # @!visibility private
78
+ # @private
79
+ # @param index_name [String] Name of the index.
80
+ # @param content [String] SQL function body.
81
+ # @return [void]
82
+ def create_function_file: (string index_name, ::String content) -> untyped
83
+
84
+ # +Arfi::Commands::FIdx#extract_latest_version+ -> String
85
+ #
86
+ # Helper method to extract the latest version of the index.
87
+ #
88
+ # @!visibility private
89
+ # @private
90
+ # @param files [Array<String>] List of files.
91
+ # @return [String] Latest version of the index.
92
+ def extract_latest_version: (Array[String] files) -> String
93
+
94
+ # +Arfi::Commands::FIdx#write_file+ -> void
95
+ #
96
+ # Helper method to write the index file.
97
+ #
98
+ # @!visibility private
99
+ # @private
100
+ # @param index_name [String] Name of the index.
101
+ # @param content [String] SQL function body.
102
+ # @param version [String|Integer] Version of the index.
103
+ # @return [void]
104
+ def write_file: (string index_name, ::String content, (::String | ::Integer) version) -> void
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,28 @@
1
+ module Arfi
2
+ module Commands
3
+ class Project
4
+ ADAPTERS: Array[Symbol]
5
+
6
+ # +Arfi::Commands::Project#create+ -> void
7
+ #
8
+ # This command is used to create `db/functions` directory.
9
+ #
10
+ # @example
11
+ # bundle exec arfi project create
12
+ # @return [void]
13
+ # @raise [Arfi::Errors::InvalidSchemaFormat] if ActiveRecord.schema_format is not :ruby.
14
+ def create: () -> void
15
+
16
+ private
17
+
18
+ # +Arfi::Commands::Project#functions_dir+ -> Pathname
19
+ #
20
+ # Helper method to get path to `db/functions` directory.
21
+ #
22
+ # @!visibility private
23
+ # @private
24
+ # @return [Pathname] Path to `db/functions` directory
25
+ def functions_dir: () -> Pathname
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ module Arfi
2
+ module Errors
3
+ class NoFunctionsDir < StandardError
4
+ @message: string
5
+
6
+ def initialize: (?::String message) -> void
7
+ end
8
+
9
+ class InvalidSchemaFormat < StandardError
10
+ @message: string
11
+
12
+ def initialize: (?::String message) -> void
13
+ end
14
+
15
+ class AdapterNotSupported < StandardError
16
+ @message: string
17
+
18
+ def initialize: (?::String message) -> void
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ module ActiveRecord
2
+ class Base
3
+ # +ActiveRecord::Base.function_exists?+ -> bool
4
+ #
5
+ # This method checks if a custom SQL function exists in the database.
6
+ #
7
+ # @example
8
+ # ActiveRecord::Base.function_exists?('my_function') #=> true
9
+ # ActiveRecord::Base.function_exists?('my_function123') #=> false
10
+ # @param [String] function_name The name of the function to check.
11
+ # @return [Boolean] Returns true if the function exists, false otherwise.
12
+ def self.function_exists?: (string function_name) -> bool
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ module Arfi
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end