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,94 @@
1
+ module Arfi
2
+ # +Arfi::SqlFunctionLoader+ is a class which loads user defined SQL functions into database.
3
+ class SqlFunctionLoader
4
+ attr_accessor self.task_name: nil | String
5
+
6
+ # +Arfi::SqlFunctionLoader.load!+ -> (nil | void)
7
+ #
8
+ # Loads user defined SQL functions into database.
9
+ #
10
+ # @param task_name [String|nil] Name of the task.
11
+ # @return [nil] if there is no `db/functions` directory.
12
+ # @return [void] if there is no errors.
13
+ # @raise [Arfi::Errors::AdapterNotSupported] if database adapter is SQLite.
14
+ def self.load!: (task_name: nil | String) -> (nil | untyped)
15
+
16
+ # +Arfi::SqlFunctionLoader#sql_functions_by_adapter+ -> Array<String>
17
+ #
18
+ # Helper method to get list of SQL files for specific database adapter.
19
+ #
20
+ # @!visibility private
21
+ # @private
22
+ # @return [Array<String>] List of SQL files.
23
+ # @raise [Arfi::Errors::AdapterNotSupported] if database adapter is not supported.
24
+ def self.sql_functions_by_adapter: -> Array[String]
25
+
26
+ # +Arfi::SqlFunctionLoader#multi_db?+ -> Boolean
27
+ #
28
+ # Checks if the application has been configured to work with multiple databases.
29
+ #
30
+ # @return [Boolean]
31
+ def self.multi_db?: -> bool
32
+
33
+ # +Arfi::SqlFunctionLoader#populate_multiple_db+ -> void
34
+ #
35
+ # Loads user defined SQL functions into all databases.
36
+ #
37
+ # @!visibility private
38
+ # @private
39
+ # @return [void]
40
+ # @see Arfi::SqlFunctionLoader#multi_db?
41
+ # @see Arfi::SqlFunctionLoader#populate_db
42
+ def self.populate_multiple_db: -> void
43
+
44
+ # +Arfi::SqlFunctionLoader#raise_unless_supported_adapter+ -> void
45
+ #
46
+ # Checks if the database adapter is supported.
47
+ #
48
+ # @return [void]
49
+ # @raise [Arfi::Errors::AdapterNotSupported]
50
+ def self.raise_unless_supported_adapter: -> void
51
+
52
+ # +Arfi::SqlFunctionLoader#handle_db_population+ -> void
53
+ #
54
+ # Loads user defined SQL functions into database. This conditional branch was written this way because if we
55
+ # call db:migrate:db_name, then task_name will not be nil, but it will be zero if we call db:migrate. Then we
56
+ # check that the application has been configured to work with multiple databases in order to populate all
57
+ # databases, and only after this check can we populate the database in case the db:migrate (or any other) task
58
+ # has been called for configuration with a single database. Go to `lib/arfi/tasks/db.rake` for additional info.
59
+ #
60
+ # @!visibility private
61
+ # @private
62
+ # @return [void]
63
+ def self.handle_db_population: -> untyped
64
+
65
+ private
66
+
67
+ # +Arfi::SqlFunctionLoader#populate_db+ -> void
68
+ #
69
+ # Loads user defined SQL functions into database.
70
+ #
71
+ # @!visibility private
72
+ # @private
73
+ # @return [void]
74
+ def self.populate_db: () -> untyped
75
+
76
+ # +Arfi::SqlFunctionLoader#sql_files+ -> Array<String>
77
+ #
78
+ # Helper method to get list of SQL files.
79
+ #
80
+ # @!visibility private
81
+ # @private
82
+ # @return [Array<String>] List of SQL files.
83
+ def self.sql_files: () -> Array[String]
84
+
85
+ # +Arfi::SqlFunctionLoader#conn+ -> ActiveRecord::ConnectionAdapters::AbstractAdapter
86
+ #
87
+ # Helper method to get database connection.
88
+ #
89
+ # @!visibility private
90
+ # @private
91
+ # @return [ActiveRecord::ConnectionAdapters::AbstractAdapter] Database connection.
92
+ def self.conn: () -> ::ActiveRecord::ConnectionAdapters::AbstractAdapter
93
+ end
94
+ end
@@ -0,0 +1,3 @@
1
+ module Arfi
2
+ VERSION: "0.5.0"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arfi
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
  - unurgunite
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.0'
18
+ version: '6.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '7.0'
25
+ version: '6.0'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -113,24 +113,75 @@ dependencies:
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '1.10'
116
+ version: '1.3'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.3'
124
+ - !ruby/object:Gem::Dependency
125
+ name: yard
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.9.37
117
131
  type: :development
118
132
  prerelease: false
119
133
  version_requirements: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: '1.10'
124
- description: 'ARFI — ActiveRecord Functional Indexes. Bring the ability to create
125
- and maintain functional indexes without transition to structure.sql.
137
+ version: 0.9.37
138
+ description: 'ARFI — ActiveRecord Functional Indexes. Provides the ability to create
139
+ and maintain functions that can be used as indexes, as well as in other parts of
140
+ the project without switching to structure.sql.
126
141
 
127
142
  '
128
143
  email:
129
144
  - senpaiguru1488@gmail.com
130
- executables: []
145
+ executables:
146
+ - arfi
131
147
  extensions: []
132
148
  extra_rdoc_files: []
133
- files: []
149
+ files:
150
+ - ".rspec"
151
+ - ".rubocop.yml"
152
+ - ".ruby-version"
153
+ - CHANGELOG.md
154
+ - CODE_OF_CONDUCT.md
155
+ - LICENSE.txt
156
+ - README.md
157
+ - Rakefile
158
+ - Steepfile
159
+ - exe/arfi
160
+ - lib/arfi.rb
161
+ - lib/arfi/Rakefile
162
+ - lib/arfi/cli.rb
163
+ - lib/arfi/commands/f_idx.rb
164
+ - lib/arfi/commands/project.rb
165
+ - lib/arfi/errors.rb
166
+ - lib/arfi/extensions/active_record/base.rb
167
+ - lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rb
168
+ - lib/arfi/extensions/extensions.rb
169
+ - lib/arfi/railtie.rb
170
+ - lib/arfi/sql_function_loader.rb
171
+ - lib/arfi/tasks/db.rake
172
+ - lib/arfi/version.rb
173
+ - rakelib/yard_docs_generator.rake
174
+ - rbs_collection.lock.yaml
175
+ - rbs_collection.yaml
176
+ - sig/arfi.rbs
177
+ - sig/lib/arfi/cli.rbs
178
+ - sig/lib/arfi/commands/f_idx.rbs
179
+ - sig/lib/arfi/commands/project.rbs
180
+ - sig/lib/arfi/errors.rbs
181
+ - sig/lib/arfi/extensions/active_record/base.rbs
182
+ - sig/lib/arfi/railtie.rbs
183
+ - sig/lib/arfi/sql_function_loader.rbs
184
+ - sig/lib/arfi/version.rbs
134
185
  homepage: https://github.com/unurgunite/arfi
135
186
  licenses:
136
187
  - MIT
@@ -147,7 +198,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
198
  requirements:
148
199
  - - ">="
149
200
  - !ruby/object:Gem::Version
150
- version: 3.1.0
201
+ version: '3.1'
151
202
  required_rubygems_version: !ruby/object:Gem::Requirement
152
203
  requirements:
153
204
  - - ">="