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.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.rubocop.yml +9 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +267 -0
- data/Rakefile +12 -0
- data/Steepfile +35 -0
- data/exe/arfi +7 -0
- data/lib/arfi/Rakefile +6 -0
- data/lib/arfi/cli.rb +23 -0
- data/lib/arfi/commands/f_idx.rb +238 -0
- data/lib/arfi/commands/project.rb +59 -0
- data/lib/arfi/errors.rb +30 -0
- data/lib/arfi/extensions/active_record/base.rb +36 -0
- data/lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rb +32 -0
- data/lib/arfi/extensions/extensions.rb +7 -0
- data/lib/arfi/railtie.rb +15 -0
- data/lib/arfi/sql_function_loader.rb +153 -0
- data/lib/arfi/tasks/db.rake +38 -0
- data/lib/arfi/version.rb +5 -0
- data/lib/arfi.rb +11 -0
- data/rakelib/yard_docs_generator.rake +29 -0
- data/rbs_collection.lock.yaml +452 -0
- data/rbs_collection.yaml +19 -0
- data/sig/arfi.rbs +2 -0
- data/sig/lib/arfi/cli.rbs +6 -0
- data/sig/lib/arfi/commands/f_idx.rbs +107 -0
- data/sig/lib/arfi/commands/project.rbs +28 -0
- data/sig/lib/arfi/errors.rbs +21 -0
- data/sig/lib/arfi/extensions/active_record/base.rbs +14 -0
- data/sig/lib/arfi/railtie.rbs +4 -0
- data/sig/lib/arfi/sql_function_loader.rbs +94 -0
- data/sig/lib/arfi/version.rbs +3 -0
- metadata +61 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40e55ca1e1481bb0b4e2c0e52dba409acee9cab6dc52b175c8ea07c43a8ff480
|
4
|
+
data.tar.gz: 54cf735abda9f80045e1d5dd182993fdbe3b9a82f4b1280a5bd0f9ca96664551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47e45b99ccccac4149e6fe340b72ff1a418c245fb6f151890d473c2ef18c0ef7d435e0faf95483cafbeee64478db2d1265281dc1fff8a8b32f0a39a9df10caa4
|
7
|
+
data.tar.gz: 6c008777c326d7f15afab77e1a6473ce6a4f94525898e2392d55664ff5d6b4213d2ed5a06050fdfd44a9e8f183cb66278bd17e832b15f4b256591129a73c95eb
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.2
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 daniil.lyubimcev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
# ARFI
|
2
|
+
|
3
|
+

|
4
|
+
[](https://badge.fury.io/rb/arfi)
|
5
|
+
|
6
|
+

|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
> [!WARNING]
|
11
|
+
> This project only supports PostgreSQL and MySQL databases. SQLite3 will be supported in the future as well as other
|
12
|
+
> databases supported by Rails.
|
13
|
+
|
14
|
+
> [!NOTE]
|
15
|
+
> This project requires Ruby 3.1.0+, in future updated 2.6+ Ruby versions will be supported.
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
ARFI – *ActiveRecord Functional Indexes*
|
20
|
+
|
21
|
+
The ARFI gem provides the ability to create and maintain custom SQL functions for ActiveRecord models without switching
|
22
|
+
to `structure.sql` (an SQL-based schema). You can use your own SQL functions in any part of the project, from migrations
|
23
|
+
and models to everything else. There is a working example in
|
24
|
+
the [demo project](https://github.com/unurgunite/poc_arfi_72). All instructions are described
|
25
|
+
in [README](https://github.com/unurgunite/poc_arfi_72/blob/master/README.md). ARFI supports all types of database
|
26
|
+
architectures implemented in Rails, suitable for both working with single databases and for simultaneous work with
|
27
|
+
multiple databases in the same environment.
|
28
|
+
|
29
|
+
* [ARFI](#arfi)
|
30
|
+
* [Installation](#installation)
|
31
|
+
* [Usage](#usage)
|
32
|
+
* [Internal documentation](#internal-documentation)
|
33
|
+
* [CLI](#cli)
|
34
|
+
* [Project creation](#project-creation)
|
35
|
+
* [Index creation](#index-creation)
|
36
|
+
* [Index destroy](#index-destroy)
|
37
|
+
* [Additional help](#additional-help)
|
38
|
+
* [Demo](#demo)
|
39
|
+
* [Library features](#library-features)
|
40
|
+
* [Roadmap](#roadmap)
|
41
|
+
* [Commands](#commands)
|
42
|
+
* [Function creation](#function-creation)
|
43
|
+
* [Function destroy](#function-destroy)
|
44
|
+
* [Options](#options)
|
45
|
+
* [`--template` option](#--template-option)
|
46
|
+
* [`--adapter` option](#--adapter-option)
|
47
|
+
* [Limitations](#limitations)
|
48
|
+
* [Development](#development)
|
49
|
+
* [Build from source](#build-from-source)
|
50
|
+
* [Requirements](#requirements)
|
51
|
+
* [Contributing](#contributing)
|
52
|
+
* [Miscellaneous](#miscellaneous)
|
53
|
+
* [License](#license)
|
54
|
+
* [Code of Conduct](#code-of-conduct)
|
55
|
+
|
56
|
+
## Installation
|
57
|
+
|
58
|
+
Install the gem and add to the application's Gemfile by executing:
|
59
|
+
|
60
|
+
```bash
|
61
|
+
bundle add arfi
|
62
|
+
```
|
63
|
+
|
64
|
+
## Usage
|
65
|
+
|
66
|
+
### Internal documentation
|
67
|
+
|
68
|
+
Internal documentation available at https://github.com/unurgunite/arfi_docs.
|
69
|
+
|
70
|
+
### CLI
|
71
|
+
|
72
|
+
ARFI uses Thor as a command line interface (CLI) instead of Rake, so it has a specific DSL.
|
73
|
+
|
74
|
+
### Project creation
|
75
|
+
|
76
|
+
Firstly, run `bundle exec arfi project create` to create a new project. This command will create `db/functions`
|
77
|
+
directory. ARFI uses `db/functions` directory to store your SQL functions.
|
78
|
+
|
79
|
+
### Function creation
|
80
|
+
|
81
|
+
Run `bundle exec arfi f_idx create function_name` to create a new function. New SQL function will be created in
|
82
|
+
`db/functions` directory under `function_name_v01.sql` name. Edit your function and run `bundle exec rails db:migrate`.
|
83
|
+
You can also use custom template for functions using `--template` flag, this behaviour is described below.
|
84
|
+
Type `bundle exec arfi f_idx help create` for additional info.
|
85
|
+
|
86
|
+
### Function destroy
|
87
|
+
|
88
|
+
If you want to destroy your function, run `bundle exec arfi f_idx destroy function_name [revision (default 1)]`. Please
|
89
|
+
note that after deleting the function, it will still be available, but if you run "bundle exec rails db:migrate" again,
|
90
|
+
an error will occur when using the function. Enter `bundle exec arfi f_idx help destroy` for more information.
|
91
|
+
|
92
|
+
### Additional help
|
93
|
+
|
94
|
+
Run `bundle exec arfi` for additional help.
|
95
|
+
|
96
|
+
## Demo
|
97
|
+
|
98
|
+
Demo available as separate project built with Rails 7.2 and PostgreSQL 14: https://github.com/unurgunite/poc_arfi_72.
|
99
|
+
README is also available.
|
100
|
+
|
101
|
+
## Library features
|
102
|
+
|
103
|
+
1. ARFI supports about all types of database initialization. It respects your database schema format and database
|
104
|
+
configuration.
|
105
|
+
|
106
|
+
| Task | Completed |
|
107
|
+
|------------------|--------------------------------------------------------------|
|
108
|
+
| db:migrate | :white_check_mark: |
|
109
|
+
| db:setup | :white_check_mark: |
|
110
|
+
| db:prepare | :white_check_mark: |
|
111
|
+
| db:schema:load | :white_check_mark: |
|
112
|
+
| db:reset | :white_check_mark: |
|
113
|
+
| db:setup:db_name | In progress (see [limitations][1]) :arrows_counterclockwise: |
|
114
|
+
|
115
|
+
2. Database support. ARFI supports PostgreSQL and MySQL databases and projects with multiple databases at the same time.
|
116
|
+
|
117
|
+
| DB adapter | Tested |
|
118
|
+
|------------|---------------------------------------|
|
119
|
+
| PostgreSQL | :white_check_mark: |
|
120
|
+
| MySQL | :white_check_mark: |
|
121
|
+
| SQLite3 | In progress :arrows_counterclockwise: |
|
122
|
+
|
123
|
+
3. Rails support
|
124
|
+
|
125
|
+
| Rails version | Tested |
|
126
|
+
|---------------|---------------------------------------|
|
127
|
+
| 8 | :white_check_mark: |
|
128
|
+
| 7 | :white_check_mark: |
|
129
|
+
| 6 | In progress :arrows_counterclockwise: |
|
130
|
+
|
131
|
+
## Roadmap
|
132
|
+
|
133
|
+
1. ~~Custom template for SQL functions using `--template` flag;~~
|
134
|
+
2. ~~Multidb support (Rails 6+ feature);~~
|
135
|
+
3. Add support for 4+ ActiveRecord;
|
136
|
+
4. Add RSpec tests;
|
137
|
+
5. ~~Add separate YARD doc page;~~
|
138
|
+
6. ~~Update CI/CD;~~
|
139
|
+
7. Add support for Ruby 2.6+.
|
140
|
+
|
141
|
+
## Commands
|
142
|
+
|
143
|
+
ARFI has a set of commands to work with SQL functions. Type `bundle exec arfi help` for additional help. As noted above,
|
144
|
+
ARFI uses Thor as a command line interface.
|
145
|
+
|
146
|
+
### Function creation
|
147
|
+
|
148
|
+
ARFI supports creation of SQL functions. To create a new function, run `bundle exec arfi f_idx create function_name`.
|
149
|
+
Also, there are some options:
|
150
|
+
|
151
|
+
| Option name | Description | Possible values | Default value |
|
152
|
+
|--------------|--------------------------------------------------------------------------------------|----------------------------|---------------------------------------------------------------|
|
153
|
+
| `--template` | use custom template | path within you filesystem | nil (will be used default template for each type of adapters) |
|
154
|
+
| `--adapter` | adapter specific function creation due to syntax differences between different RDBMS | postgresql, mysql | nil (function will be stored in generic `db/functions`) |
|
155
|
+
|
156
|
+
### Function destroy
|
157
|
+
|
158
|
+
ARFI supports destroy of SQL functions. To destroy a function, run
|
159
|
+
`bundle exec arfi f_idx destroy function_name [revision (1 by default)]`.
|
160
|
+
|
161
|
+
| Option name | Description | Possible values | Default value |
|
162
|
+
|--------------|------------------------------|-------------------|------------------------------------------------------------|
|
163
|
+
| `--revision` | Function revision to destroy | Integer | 1 |
|
164
|
+
| `--adapter` | adapter specific function | postgresql, mysql | nil (function will be destroyed in generic `db/functions`) |
|
165
|
+
|
166
|
+
#### Options
|
167
|
+
|
168
|
+
##### `--template` option
|
169
|
+
|
170
|
+
This option is used for creating an SQL function. In this case, the function will not be created with the default
|
171
|
+
template, but with user defined. There are some rules for templates:
|
172
|
+
|
173
|
+
1. The template must be written in a Ruby-compatible syntax: the function must be placed in a HEREDOC statement and must
|
174
|
+
use interpolation for variables. If you need to take a more comprehensive approach to the issue of function
|
175
|
+
generation, you can try using your own methods in the template file. No matter what you write there, the main rule is
|
176
|
+
that your main method should return a string with a function template, as described below.
|
177
|
+
2. ARFI supports dynamic variables in templates, but only one at the moment. You need to specify `index_name`
|
178
|
+
variable as below. In feature updated ARFI will support more variables. Here are default templates in ARFI for
|
179
|
+
PostgreSQL and MySQL:
|
180
|
+
|
181
|
+
PostgreSQL:
|
182
|
+
```ruby
|
183
|
+
<<~SQL
|
184
|
+
CREATE OR REPLACE FUNCTION #{index_name}() RETURNS TEXT[]
|
185
|
+
LANGUAGE SQL
|
186
|
+
IMMUTABLE AS
|
187
|
+
$$
|
188
|
+
-- Function body here
|
189
|
+
$$
|
190
|
+
SQL
|
191
|
+
```
|
192
|
+
MySQL:
|
193
|
+
```ruby
|
194
|
+
<<~SQL
|
195
|
+
CREATE FUNCTION #{index_name} ()
|
196
|
+
RETURNS return_type
|
197
|
+
BEGIN
|
198
|
+
-- Function body here
|
199
|
+
END;
|
200
|
+
SQL
|
201
|
+
```
|
202
|
+
3. By default ARFI uses PostgreSQL template.
|
203
|
+
|
204
|
+
##### `--adapter` option
|
205
|
+
|
206
|
+
This option is used both when destroying and when creating an SQL function. In this case, the function will not be
|
207
|
+
created in the default directory `db/functions`, but in the child `db/functions/#{adapter}`. Supported adapters:
|
208
|
+
`postgresql`and `mysql`, but there will be more in the future.
|
209
|
+
|
210
|
+
## Limitations
|
211
|
+
|
212
|
+
Currently, ARFI has a limitation for `db:setup:db_name` task due to the fact how Rails manage this rake task. More info
|
213
|
+
here: [limitations][1]. This command will work, but it is not recommended to use it. Note that this limitation applies
|
214
|
+
only to multi-db setup, default `db:setup` will work as expected.
|
215
|
+
|
216
|
+
## Development
|
217
|
+
|
218
|
+
### Build from source
|
219
|
+
|
220
|
+
The manual installation includes installation via command line interface. it is practically no different from what
|
221
|
+
happens during the automatic build of the project:
|
222
|
+
|
223
|
+
```shell
|
224
|
+
git clone https://github.com/unurgunite/arfi.git
|
225
|
+
cd arfi
|
226
|
+
bundle install
|
227
|
+
gem build arfi.gemspec
|
228
|
+
gem install arfi-0.5.0.gem
|
229
|
+
```
|
230
|
+
|
231
|
+
Also, you can run `bin/setup` to automatically install everything needed.
|
232
|
+
|
233
|
+
## Requirements
|
234
|
+
|
235
|
+
ARFI is built on top of the following gems:
|
236
|
+
|
237
|
+
| Dependencies | Description |
|
238
|
+
|--------------|--------------------------------------------------------------------------------------------|
|
239
|
+
| ActiveRecord | Used to patch `ActiveRecord::Base` module with new methods. |
|
240
|
+
| Rails | Used for fetching project settings (database connection settings, Rails environment, etc.) |
|
241
|
+
| Thor | For CLI development. |
|
242
|
+
| Rubocop | For static code analysis. |
|
243
|
+
| Rake | For patching built-in Rails Rake tasks. |
|
244
|
+
| Steep | For static type checking. |
|
245
|
+
| RBS | For static type checking. |
|
246
|
+
| YARD | For generating documentation. |
|
247
|
+
|
248
|
+
## Contributing
|
249
|
+
|
250
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/unurgunite/arfi. This project is intended to
|
251
|
+
be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
252
|
+
the [code of conduct](https://github.com/unurgunite/arfi/blob/master/CODE_OF_CONDUCT.md).
|
253
|
+
|
254
|
+
## Miscellaneous
|
255
|
+
|
256
|
+
ARFI is highly inspired by https://github.com/teoljungberg/fx project.
|
257
|
+
|
258
|
+
## License
|
259
|
+
|
260
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
261
|
+
|
262
|
+
## Code of Conduct
|
263
|
+
|
264
|
+
Everyone interacting in the ARFI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow
|
265
|
+
the [code of conduct](https://github.com/unurgunite/arfi/blob/master/CODE_OF_CONDUCT.md).
|
266
|
+
|
267
|
+
[1]: https://blog.saeloun.com/2021/10/27/rails-7-adds-database-specific-setup/#limitation
|
data/Rakefile
ADDED
data/Steepfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# D = Steep::Diagnostic
|
4
|
+
#
|
5
|
+
target :lib do
|
6
|
+
signature 'sig'
|
7
|
+
# ignore_signature "sig/test"
|
8
|
+
# use "rbs_collection"
|
9
|
+
check 'lib' # Directory name
|
10
|
+
# check "path/to/source.rb" # File name
|
11
|
+
# check "app/models/**/*.rb" # Glob
|
12
|
+
# ignore "lib/templates/*.rb"
|
13
|
+
ignore 'lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rb'
|
14
|
+
|
15
|
+
# library "pathname" # Standard libraries
|
16
|
+
# library "strong_json" # Gems
|
17
|
+
|
18
|
+
# configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
|
19
|
+
# configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
20
|
+
# configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
21
|
+
# configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
|
22
|
+
# configure_code_diagnostics do |hash| # You can setup everything yourself
|
23
|
+
# hash[D::Ruby::NoMethod] = :information
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
|
27
|
+
# target :test do
|
28
|
+
# unreferenced! # Skip type checking the `lib` code when types in `test` target is changed
|
29
|
+
# signature "sig/test" # Put RBS files for tests under `sig/test`
|
30
|
+
# check "test" # Type check Ruby scripts under `test`
|
31
|
+
#
|
32
|
+
# configure_code_diagnostics(D::Ruby.lenient) # Weak type checking for test code
|
33
|
+
#
|
34
|
+
# # library "pathname" # Standard libraries
|
35
|
+
# end
|
data/exe/arfi
ADDED
data/lib/arfi/Rakefile
ADDED
data/lib/arfi/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require_relative 'commands/project'
|
5
|
+
require_relative 'commands/f_idx'
|
6
|
+
|
7
|
+
# steep:ignore:start
|
8
|
+
module Arfi
|
9
|
+
# Top level CLI class
|
10
|
+
class CLI < Thor
|
11
|
+
desc 'project [COMMAND]', 'Project specific commands.'
|
12
|
+
subcommand 'project', Commands::Project
|
13
|
+
|
14
|
+
desc 'f_idx [COMMAND]', 'Command to handle functions.'
|
15
|
+
subcommand 'f_idx', Commands::FIdx
|
16
|
+
|
17
|
+
desc 'version', 'Print the version'
|
18
|
+
def version
|
19
|
+
$stdout.write(Arfi::VERSION, "\n")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# steep:ignore:end
|