arfi 0.5.0 → 1.0.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/.env.sample +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +8 -1
- data/.rubocop_todo.yml +12 -0
- data/CHANGELOG.md +94 -0
- data/CODE_OF_CONDUCT.md +5 -1
- data/CONTRIBUTING.md +26 -0
- data/README.md +327 -118
- data/SECURITY.md +17 -0
- data/Steepfile +1 -29
- data/compose.yml +33 -0
- data/docscribe.yml +92 -0
- data/gemfiles/rails_6_0.gemfile +11 -0
- data/gemfiles/rails_6_1.gemfile +11 -0
- data/gemfiles/rails_7_0.gemfile +9 -0
- data/gemfiles/rails_7_1.gemfile +10 -0
- data/gemfiles/rails_7_2.gemfile +10 -0
- data/gemfiles/rails_8_0.gemfile +10 -0
- data/gemfiles/rails_8_1.gemfile +10 -0
- data/lib/arfi/cli.rb +24 -9
- data/lib/arfi/commands/f_idx.rb +5 -230
- data/lib/arfi/commands/functions.rb +128 -0
- data/lib/arfi/commands/functions_candidates.rb +133 -0
- data/lib/arfi/commands/functions_creation.rb +157 -0
- data/lib/arfi/commands/functions_helpers.rb +181 -0
- data/lib/arfi/commands/functions_paths.rb +131 -0
- data/lib/arfi/commands/functions_rendering.rb +137 -0
- data/lib/arfi/commands/init.rb +88 -0
- data/lib/arfi/commands/project.rb +5 -51
- data/lib/arfi/errors.rb +15 -3
- data/lib/arfi/extensions/active_record/base.rb +33 -23
- data/lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rb +159 -24
- data/lib/arfi/sql_function_loader.rb +291 -88
- data/lib/arfi/tasks/db.rake +60 -18
- data/lib/arfi/version.rb +1 -1
- data/lib/arfi.rb +2 -0
- data/rbs_collection.lock.yaml +93 -61
- data/sig/compat/active_record_base_compat.rbs +17 -0
- data/sig/compat/thor_dsl.rbs +8 -0
- data/sig/lib/arfi/commands/f_idx.rbs +5 -103
- data/sig/lib/arfi/commands/functions.rbs +99 -0
- data/sig/lib/arfi/commands/functions_candidates.rbs +25 -0
- data/sig/lib/arfi/commands/functions_creation.rbs +29 -0
- data/sig/lib/arfi/commands/functions_helpers.rbs +41 -0
- data/sig/lib/arfi/commands/functions_paths.rbs +25 -0
- data/sig/lib/arfi/commands/functions_rendering.rbs +25 -0
- data/sig/lib/arfi/commands/init.rbs +22 -0
- data/sig/lib/arfi/commands/project.rbs +5 -24
- data/sig/lib/arfi/extensions/active_record/base.rbs +5 -10
- data/sig/lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rbs +28 -0
- data/sig/lib/arfi/sql_function_loader.rbs +45 -87
- data/sig/lib/arfi/tasks/db.rbs +3 -0
- data/sig/lib/arfi/version.rbs +1 -1
- metadata +125 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bf85a9c94dff04b2907eb38de2c9d93ee81a3181b2c20fefe1c06175040b7d2
|
|
4
|
+
data.tar.gz: a3c95aceeaa4d699c945f43388f36bc5d8f386f85e9c011b5bc896d786fce69a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a213ffc24830392dc6cbb212a4d7b664078fefd0a52df1e48780ea81d5a1f950915811bc5af76ad75c8728630a2ec90a8dfcc9c5c782c4f05c4f749ffb2b9275
|
|
7
|
+
data.tar.gz: 315adf729a16f687bebb3d66d20951f8a09495e7863e0731516c0821fcd4c4adca660cbf173815264245158a17db21092b4f3a813f4f358b531139565c0cc6d2
|
data/.env.sample
ADDED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
|
2
|
+
|
|
1
3
|
AllCops:
|
|
2
|
-
TargetRubyVersion:
|
|
4
|
+
TargetRubyVersion: 2.7
|
|
3
5
|
NewCops: enable
|
|
4
6
|
Exclude:
|
|
5
7
|
- lib/arfi/extensions/active_record/connection_adapters/postgresql/database_statements.rb
|
|
6
8
|
- 'vendor/**/*'
|
|
7
9
|
|
|
10
|
+
plugins:
|
|
11
|
+
- rubocop-sorted_methods_by_call
|
|
12
|
+
- rubocop-rspec
|
|
13
|
+
- rubocop-performance
|
|
14
|
+
|
|
8
15
|
Gemspec/DevelopmentDependencies:
|
|
9
16
|
EnforcedStyle: gemspec
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2026-06-13 13:57:26 UTC using RuboCop version 1.87.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# Configuration parameters: CountComments, CountAsOne.
|
|
11
|
+
Metrics/ClassLength:
|
|
12
|
+
Max: 164
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,99 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
### v1.0.0 - 2026-06-13
|
|
4
|
+
|
|
5
|
+
#### Added
|
|
6
|
+
|
|
7
|
+
- **Database adapters**: MySQL, MariaDB, and Trilogy (Rails 7.1+) support — built-in, not a third-party gem
|
|
8
|
+
- **Multi-database Rails support**: iterate over all DB configs for the current environment; works with suffixed Rake tasks (`db:migrate:animals`) and non-suffixed tasks
|
|
9
|
+
- **Runtime recovery**: `PG::UndefinedFunction` auto-reload — catches the error, reloads function files on the same connection, retries the query once (thread-guarded)
|
|
10
|
+
- **CLI (Thor-based)**:
|
|
11
|
+
- `arfi init` — bootstrap `db/functions/` directory structure
|
|
12
|
+
- `arfi functions create/destroy` — manage function SQL files
|
|
13
|
+
- `--template` option for custom Ruby templates (variables: `function_name`, `schema_name`, `qualified_name`, `original_ref`)
|
|
14
|
+
- `--adapter postgresql|mysql|trilogy` for adapter-specific placement and skeletons
|
|
15
|
+
- `--schema <name>` for PostgreSQL schema-qualified functions
|
|
16
|
+
- Backward-compatible aliases: `arfi project create`, `arfi f_idx create/destroy`
|
|
17
|
+
- **Directory layout (1.0.0+)**: `db/functions/public/`, `db/functions/postgresql/{public,schema}/`, `db/functions/mysql/public/` with adapter-over-generic override resolution
|
|
18
|
+
- **Rake integration**: hooks into `db:migrate`, `db:prepare`, `db:setup`, `db:test:prepare`, `db:schema:load` for both single-DB and multi-DB
|
|
19
|
+
- **RBS type signatures** for all public and private methods (`sig/`)
|
|
20
|
+
- **Steep type checking** in CI
|
|
21
|
+
- **RuboCop** with sorted-methods-by-call enforcement
|
|
22
|
+
- **RSpec test suite** with Docker Compose (PostgreSQL + MySQL) for integration specs
|
|
23
|
+
- **GitHub Actions CI**: lint, typecheck, docscribe verification, matrix tests (Rails 6.0–8.1, Ruby 2.7–4.0, MariaDB)
|
|
24
|
+
- **Docscribe integration** for YARD documentation validation
|
|
25
|
+
- **Community files**: `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, issue/PR templates
|
|
26
|
+
|
|
27
|
+
#### Fixed
|
|
28
|
+
|
|
29
|
+
- **Multi-DB connection restore**: `populate_multiple_db` now saves the original connection config before iterating databases and restores it in `ensure`, matching the pattern used in `run_with_connection_switch` (db.rake). Previously the original connection was never restored.
|
|
30
|
+
|
|
31
|
+
#### Changed
|
|
32
|
+
|
|
33
|
+
- **CLI architecture**: migrated from Rake-based commands to Thor CLI with `functions` and `init` command groups
|
|
34
|
+
- **YARD documentation**: auto-generated via docscribe with `--rbs-collection` flag
|
|
35
|
+
- **Dependency management**: unified Gemfile with versioned gemfiles for Rails 6.0–8.1
|
|
36
|
+
|
|
37
|
+
#### Removed
|
|
38
|
+
|
|
39
|
+
- SQL function versioning system (single-file-per-function current-state model replaces versioned SQL files)
|
|
40
|
+
|
|
41
|
+
### [0.5.1] - 2025-06-13
|
|
42
|
+
|
|
43
|
+
#### Fixed
|
|
44
|
+
|
|
45
|
+
- Connection creation with ActiveRecord (`sql_function_loader.rb`) — improved compatibility with various AR connection pool configurations (#11)
|
|
46
|
+
|
|
47
|
+
### [0.5.0] - 2025-05-25
|
|
48
|
+
|
|
49
|
+
#### Added
|
|
50
|
+
|
|
51
|
+
- **YARD documentation generator**: `rakelib/yard_docs_generator.rake` for automated YARD docs generation
|
|
52
|
+
- **RBS signatures** for CLI and project commands
|
|
53
|
+
- **CI improvements**: expanded GitHub Actions workflow with broader Ruby/Rails matrix coverage
|
|
54
|
+
- **README documentation**: expanded with configuration details and usage examples
|
|
55
|
+
|
|
56
|
+
#### Changed
|
|
57
|
+
|
|
58
|
+
- **CLI commands**: updated project and f_idx commands with improved output formatting
|
|
59
|
+
- **SQL function loader**: refined SQL content extraction logic
|
|
60
|
+
- **Database statements**: added annotation to PostgreSQL database_statements extension
|
|
61
|
+
|
|
62
|
+
### [0.4.0] - 2025-05-18
|
|
63
|
+
|
|
64
|
+
#### Added
|
|
65
|
+
|
|
66
|
+
- **Multi-database support**: iterate over all DB configs for the current environment; works with suffixed Rake tasks (`db:migrate:animals`) and non-suffixed tasks
|
|
67
|
+
- **Rake tasks for multi-DB**: `db.rake` handles multiple database configurations
|
|
68
|
+
- **RBS signatures**: complete RBS type signatures for all public modules and classes
|
|
69
|
+
- **Steepfile**: Steep type checking configuration
|
|
70
|
+
- **rbs_collection**: dependency management for RBS types
|
|
71
|
+
|
|
72
|
+
#### Changed
|
|
73
|
+
|
|
74
|
+
- **SQL function loader**: refactored to support multiple database connections
|
|
75
|
+
- **Railtie**: updated to register tasks for multi-DB environments
|
|
76
|
+
- **CI workflow**: expanded to test against Rails 6.0–8.0 across multiple Ruby versions
|
|
77
|
+
- **CLI commands**: updated to accept database configuration parameters
|
|
78
|
+
|
|
79
|
+
### [0.3.1] - 2025-05-06
|
|
80
|
+
|
|
81
|
+
#### Added
|
|
82
|
+
|
|
83
|
+
- **Custom SQL templates**: `--template` flag with Ruby evaluation for standardized function patterns (supports `function_name`, `schema_name`, `qualified_name`, `original_ref` variables)
|
|
84
|
+
- **RBS type signatures**: initial type signatures for commands, errors, extensions, and SQL function loader
|
|
85
|
+
- **RSpec test suite**: specs for CLI commands and functional index management
|
|
86
|
+
- **GitHub Actions CI**: automated linting, type checking, and test runs
|
|
87
|
+
|
|
88
|
+
#### Fixed
|
|
89
|
+
|
|
90
|
+
- **Rake task registration**: non-migration tasks (`db:create`, `db:drop`) no longer interfere with Rails' default task execution (#2)
|
|
91
|
+
|
|
92
|
+
#### Changed
|
|
93
|
+
|
|
94
|
+
- **Gem renamed to `arfi`**: `ActiveRecord Functions Integration` — previously had a different gem name
|
|
95
|
+
- **CLI migrated to Thor**: added `arfi` executable with `project` and `f_idx` command groups
|
|
96
|
+
|
|
3
97
|
## [0.1.0] - 2025-04-22
|
|
4
98
|
|
|
5
99
|
- Initial release
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -60,7 +60,7 @@ representative at an online or offline event.
|
|
|
60
60
|
|
|
61
61
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
62
|
reported to the community leaders responsible for enforcement at
|
|
63
|
-
|
|
63
|
+
https://github.com/unurgunite/arfi/issues.
|
|
64
64
|
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
65
|
|
|
66
66
|
All community leaders are obligated to respect the privacy and security of the
|
|
@@ -126,7 +126,11 @@ For answers to common questions about this code of conduct, see the FAQ at
|
|
|
126
126
|
[https://www.contributor-covenant.org/translations][translations].
|
|
127
127
|
|
|
128
128
|
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
|
|
129
130
|
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
131
|
+
|
|
130
132
|
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
133
|
+
|
|
131
134
|
[FAQ]: https://www.contributor-covenant.org/faq
|
|
135
|
+
|
|
132
136
|
[translations]: https://www.contributor-covenant.org/translations
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Bug reports and pull requests are welcome.
|
|
4
|
+
|
|
5
|
+
## Pull Requests
|
|
6
|
+
|
|
7
|
+
1. Fork the repository.
|
|
8
|
+
2. Create a feature branch from `master`: `git checkout -b feature/my-change`
|
|
9
|
+
3. Make your changes.
|
|
10
|
+
4. Run the tests: `bundle exec rspec`
|
|
11
|
+
5. Run the linter: `bundle exec rubocop`
|
|
12
|
+
6. Run the type checker: `bundle exec steep check`
|
|
13
|
+
7. If you changed any YARD-documented methods, regenerate docs:
|
|
14
|
+
```shell
|
|
15
|
+
bundle exec docscribe lib spec --rbs-collection
|
|
16
|
+
```
|
|
17
|
+
8. Commit with a conventional commit message (e.g. `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`).
|
|
18
|
+
9. Push your branch and open a pull request.
|
|
19
|
+
|
|
20
|
+
## Development Setup
|
|
21
|
+
|
|
22
|
+
See [Development](README.md#development) in the README.
|
|
23
|
+
|
|
24
|
+
## Code of Conduct
|
|
25
|
+
|
|
26
|
+
This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md).
|