jpie 0.4.3 → 0.4.5
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/.cursor/rules/dependencies.mdc +19 -0
- data/.cursor/rules/examples.mdc +16 -0
- data/.cursor/rules/git.mdc +14 -0
- data/.cursor/rules/project_structure.mdc +30 -0
- data/.cursor/rules/publish_gem.mdc +73 -0
- data/.cursor/rules/security.mdc +14 -0
- data/.cursor/rules/style.mdc +15 -0
- data/.cursor/rules/testing.mdc +16 -0
- data/PUBLISHING.md +111 -0
- data/examples/rspec_testing.md +130 -0
- data/lib/jpie/version.rb +1 -1
- data/lib/jpie.rb +2 -2
- metadata +12 -3
- data/.cursorrules +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47016b3f031cd5322fecf012737f1aaace980414f3ed27dd18f54e21e5c5b76b
|
4
|
+
data.tar.gz: 7f8164b1e49018f93838740dcf64d79c331608095e1aa6c58e6c3fbf756ce1b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81b14fd2264f3a2b930deec1f9328fea96c6b89e8fd0a2ef60379ec245789503304f013c442ff6e23b1eee304a8e3d34c064b8535a51edcbcf505b108f63acff
|
7
|
+
data.tar.gz: aad90976a22a42d6dcc038edfb0a28ef5f2a4923cf7a8d5083ad6d9c55198c93c59aab7b94cce408057597219f50f4f8ecad18651f7a774821d5906601be55e9
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Dependency Management
|
7
|
+
|
8
|
+
## Requirements
|
9
|
+
- Keep dependencies minimal and justified
|
10
|
+
- Document new dependencies in README.md
|
11
|
+
- Keep development dependencies in Gemfile
|
12
|
+
- Ensure compatibility with Ruby 3.4+
|
13
|
+
- Only support Rails 8+ features
|
14
|
+
- Use modern gem versions
|
15
|
+
|
16
|
+
## Compatibility Requirements
|
17
|
+
- Maintain Ruby 3.4+ compatibility
|
18
|
+
- Support Rails 8+ integration
|
19
|
+
- Follow JSON:API specification strictly
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Example Guidelines
|
7
|
+
|
8
|
+
- Examples must only include required code
|
9
|
+
- Examples must not include any unrelated or superfluous code
|
10
|
+
- Examples must be a single markdown file
|
11
|
+
- Examples must use the `http` code blocks for examples
|
12
|
+
- Examples must only include the minimum number of examples
|
13
|
+
- Examples must never include migrations
|
14
|
+
- Examples must not include a features section or similar
|
15
|
+
- Examples must include an introduction to the example
|
16
|
+
- Examples live in /examples/*.md
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Git Commit Guidelines
|
7
|
+
|
8
|
+
- Write clear, descriptive commit messages
|
9
|
+
- Keep commits focused and atomic
|
10
|
+
- Run and pass tests before committing
|
11
|
+
- Update documentation in the same commit as code changes
|
12
|
+
- Ignore spec/examples.txt and other files listed in .gitignore
|
13
|
+
- Include Ruby/Rails version requirements in relevant commits
|
14
|
+
- Update tests in the same commit as code changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Project Information
|
7
|
+
- Project Name: jpie
|
8
|
+
- Description: Ruby gem for JSON:API implementation
|
9
|
+
|
10
|
+
# Project Structure
|
11
|
+
|
12
|
+
## Core Structure
|
13
|
+
- Keep core functionality in lib/jpie/
|
14
|
+
- Place tests in spec/jpie/
|
15
|
+
- Use proper namespacing (JPie module)
|
16
|
+
- Follow Ruby gem best practices
|
17
|
+
|
18
|
+
## Protected Files
|
19
|
+
- Do not update spec/jpie/database.rb unless absolutely necessary
|
20
|
+
- Do not update spec/jpie/resources.rb unless absolutely necessary
|
21
|
+
|
22
|
+
## Documentation
|
23
|
+
- Keep README.md up to date with installation and usage instructions
|
24
|
+
- Include example usage in documentation
|
25
|
+
|
26
|
+
## Development Process
|
27
|
+
- Always read the .aiconfig file
|
28
|
+
- Always implement code slowly and methodically
|
29
|
+
- Always test as you go
|
30
|
+
- Always make sure rubocop passes
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Publish JPie Gem
|
2
|
+
|
3
|
+
This rule helps publish a new version of the JPie gem.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
# Publish JPie Gem
|
7
|
+
|
8
|
+
This rule helps publish a new version of the JPie gem.
|
9
|
+
|
10
|
+
## Requirements
|
11
|
+
|
12
|
+
1. You must have publishing rights on RubyGems.org
|
13
|
+
2. You must have 2FA enabled on RubyGems.org
|
14
|
+
3. The version must be updated in `lib/jpie/version.rb`
|
15
|
+
4. The changelog must be updated in `CHANGELOG.md`
|
16
|
+
|
17
|
+
## Steps
|
18
|
+
|
19
|
+
1. First, ensure the version and changelog are updated and committed
|
20
|
+
2. Build the gem
|
21
|
+
3. Get OTP code from user
|
22
|
+
4. Push to RubyGems with OTP
|
23
|
+
5. Update bundle
|
24
|
+
6. Tag the release
|
25
|
+
7. Push tags
|
26
|
+
|
27
|
+
## Example Chat
|
28
|
+
|
29
|
+
Human: Publish new version of JPie gem
|
30
|
+
|
31
|
+
Assistant: I will help you publish the gem. First, let me check if the version and changelog are updated.
|
32
|
+
[Checks version and changelog]
|
33
|
+
|
34
|
+
Now I will build the gem:
|
35
|
+
> gem build jpie.gemspec
|
36
|
+
|
37
|
+
The gem has been built. To publish it, I will need your OTP code from RubyGems.org.
|
38
|
+
What is your OTP code?
|
39
|
+
|
40
|
+
Human: 123456
|
41
|
+
|
42
|
+
Assistant: Thanks! I will now push the gem with your OTP:
|
43
|
+
> gem push jpie-x.y.z.gem --otp 123456
|
44
|
+
|
45
|
+
Great! The gem has been published. Now I will:
|
46
|
+
1. Update the bundle
|
47
|
+
> bundle update jpie
|
48
|
+
|
49
|
+
2. Tag the release
|
50
|
+
> git tag -a vx.y.z -m "Version x.y.z"
|
51
|
+
|
52
|
+
3. Push the tags
|
53
|
+
> git push origin --tags
|
54
|
+
|
55
|
+
The gem has been successfully published and all post-publish steps are complete!
|
56
|
+
|
57
|
+
## Automation
|
58
|
+
|
59
|
+
```bash
|
60
|
+
# Build the gem
|
61
|
+
gem build jpie.gemspec
|
62
|
+
|
63
|
+
# Push to RubyGems (OTP will be requested via chat)
|
64
|
+
gem push jpie-*.gem --otp ${OTP_CODE}
|
65
|
+
|
66
|
+
# Update bundle
|
67
|
+
bundle update jpie
|
68
|
+
|
69
|
+
# Tag and push
|
70
|
+
VERSION=$(ruby -r ./lib/jpie/version.rb -e "puts JPie::VERSION")
|
71
|
+
git tag -a v${VERSION} -m "Version ${VERSION}"
|
72
|
+
git push origin --tags
|
73
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Security Guidelines
|
7
|
+
|
8
|
+
- Never commit sensitive data or credentials
|
9
|
+
- Use environment variables for configuration
|
10
|
+
- Follow secure coding practices
|
11
|
+
- Keep dependencies up to date
|
12
|
+
- Follow Rails 8+ security best practices
|
13
|
+
- Use Ruby 3.4+ security features
|
14
|
+
- Implement proper input validation
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Style Guidelines
|
7
|
+
|
8
|
+
## Ruby Style
|
9
|
+
- Follow Ruby style guide and RuboCop rules defined in .rubocop.yml
|
10
|
+
- Prefer rubocop autocorrect
|
11
|
+
- Always pass rubocop before committing to git
|
12
|
+
- Use `{data:}` rather than `{data: data}`
|
13
|
+
- Only use code comments when absolutely necessary
|
14
|
+
- Keep any code comments short and concise
|
15
|
+
- Don't update .rubocop.yml unless absolutely necessary
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
description:
|
3
|
+
globs:
|
4
|
+
alwaysApply: false
|
5
|
+
---
|
6
|
+
# Testing Guidelines
|
7
|
+
|
8
|
+
- Write RSpec tests for all new features
|
9
|
+
- Maintain test coverage for all public methods
|
10
|
+
- Use meaningful test descriptions
|
11
|
+
- Follow the existing test structure in spec/
|
12
|
+
- Test both success and error cases
|
13
|
+
- Use modern RSpec features and syntax
|
14
|
+
- Don't reduce test coverage (line, file, branch, or other)
|
15
|
+
- Only care about coverage reduction when running all specs
|
16
|
+
- Do not add any functionality for new features to existing tests unless absolutely necessary
|
data/PUBLISHING.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Publishing JPie
|
2
|
+
|
3
|
+
This guide explains how to publish new versions of the JPie gem to RubyGems.org.
|
4
|
+
|
5
|
+
## Prerequisites
|
6
|
+
|
7
|
+
1. Ensure you have a RubyGems.org account
|
8
|
+
2. Ensure you have ownership/publishing rights to the gem
|
9
|
+
3. Configure your local credentials:
|
10
|
+
```bash
|
11
|
+
gem signin
|
12
|
+
```
|
13
|
+
|
14
|
+
## Publishing Process
|
15
|
+
|
16
|
+
### 1. Update Version
|
17
|
+
|
18
|
+
Update the version number in `lib/jpie/version.rb`:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
module JPie
|
22
|
+
VERSION = "x.y.z" # Use semantic versioning
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
### 2. Update Changelog
|
27
|
+
|
28
|
+
Update `CHANGELOG.md` with the changes in the new version:
|
29
|
+
|
30
|
+
```markdown
|
31
|
+
## [x.y.z] - YYYY-MM-DD
|
32
|
+
|
33
|
+
### Added
|
34
|
+
- New features
|
35
|
+
|
36
|
+
### Changed
|
37
|
+
- Changes in existing functionality
|
38
|
+
|
39
|
+
### Deprecated
|
40
|
+
- Soon-to-be removed features
|
41
|
+
|
42
|
+
### Removed
|
43
|
+
- Removed features
|
44
|
+
|
45
|
+
### Fixed
|
46
|
+
- Bug fixes
|
47
|
+
|
48
|
+
### Security
|
49
|
+
- Security fixes
|
50
|
+
```
|
51
|
+
|
52
|
+
### 3. Build the Gem
|
53
|
+
|
54
|
+
```bash
|
55
|
+
gem build jpie.gemspec
|
56
|
+
```
|
57
|
+
|
58
|
+
This will create a file named `jpie-x.y.z.gem`.
|
59
|
+
|
60
|
+
### 4. Test the Gem Locally (Optional)
|
61
|
+
|
62
|
+
```bash
|
63
|
+
# In a test project
|
64
|
+
gem install ../path/to/jpie-x.y.z.gem
|
65
|
+
```
|
66
|
+
|
67
|
+
### 5. Push to RubyGems
|
68
|
+
|
69
|
+
```bash
|
70
|
+
gem push jpie-x.y.z.gem
|
71
|
+
```
|
72
|
+
|
73
|
+
### 6. Tag the Release
|
74
|
+
|
75
|
+
```bash
|
76
|
+
git add lib/jpie/version.rb CHANGELOG.md
|
77
|
+
git commit -m "Release version x.y.z"
|
78
|
+
git tag -a vx.y.z -m "Version x.y.z"
|
79
|
+
git push origin main --tags
|
80
|
+
```
|
81
|
+
|
82
|
+
## Versioning Guidelines
|
83
|
+
|
84
|
+
Follow [Semantic Versioning](https://semver.org/):
|
85
|
+
|
86
|
+
- MAJOR version (x) - incompatible API changes
|
87
|
+
- MINOR version (y) - add functionality in a backward compatible manner
|
88
|
+
- PATCH version (z) - backward compatible bug fixes
|
89
|
+
|
90
|
+
## Troubleshooting
|
91
|
+
|
92
|
+
### Common Issues
|
93
|
+
|
94
|
+
1. **Authentication Failed**
|
95
|
+
```bash
|
96
|
+
gem signin # Re-authenticate with RubyGems
|
97
|
+
```
|
98
|
+
|
99
|
+
2. **Gem Name Conflict**
|
100
|
+
- Ensure the version number is unique
|
101
|
+
- Check if the gem name is available on RubyGems.org
|
102
|
+
|
103
|
+
3. **Build Errors**
|
104
|
+
- Ensure all dependencies are correctly specified in the gemspec
|
105
|
+
- Verify the gem builds locally before pushing
|
106
|
+
|
107
|
+
### Getting Help
|
108
|
+
|
109
|
+
- [RubyGems Guides](https://guides.rubygems.org/)
|
110
|
+
- [Semantic Versioning](https://semver.org/)
|
111
|
+
- Open an issue in the JPie repository
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# Testing JPie Resources with RSpec
|
2
|
+
|
3
|
+
This guide demonstrates how to use JPie's RSpec matchers and helpers to test your JSON:API resources.
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
Add to your `spec/rails_helper.rb` or `spec/spec_helper.rb`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
require 'jpie/rspec'
|
11
|
+
JPie::RSpec.configure!
|
12
|
+
```
|
13
|
+
|
14
|
+
## Example Usage
|
15
|
+
|
16
|
+
Given a basic resource setup:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# app/models/book.rb
|
20
|
+
class Book < ApplicationRecord
|
21
|
+
belongs_to :author
|
22
|
+
has_many :reviews
|
23
|
+
|
24
|
+
def reading_time_minutes
|
25
|
+
(content.split.length / 200.0).ceil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# app/resources/book_resource.rb
|
30
|
+
class BookResource < JPie::Resource
|
31
|
+
type :books
|
32
|
+
|
33
|
+
attribute :title
|
34
|
+
meta_attribute :reading_time
|
35
|
+
relationship :author
|
36
|
+
relationship :reviews
|
37
|
+
|
38
|
+
def reading_time
|
39
|
+
{ minutes: object.reading_time_minutes }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Here's how to test it:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# spec/resources/book_resource_spec.rb
|
48
|
+
RSpec.describe BookResource, type: :resource do
|
49
|
+
let(:author) { create(:author) }
|
50
|
+
let(:book) { create(:book, author: author) }
|
51
|
+
let(:resource) { described_class.new(model: book) }
|
52
|
+
|
53
|
+
# Test resource structure
|
54
|
+
it { is_expected.to have_type(:books) }
|
55
|
+
it { is_expected.to have_attribute(:title) }
|
56
|
+
it { is_expected.to have_meta_attribute(:reading_time) }
|
57
|
+
it { is_expected.to have_relationship(:author) }
|
58
|
+
it { is_expected.to have_relationship(:reviews) }
|
59
|
+
|
60
|
+
# Test meta values
|
61
|
+
it 'has correct reading time' do
|
62
|
+
expect(resource).to have_meta_value(:reading_time).including(
|
63
|
+
minutes: book.reading_time_minutes
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Test relationship linkage
|
68
|
+
it 'has correct author linkage' do
|
69
|
+
expect(resource).to have_relationship_linkage(:author).with_id(author.id.to_s)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# spec/requests/books_controller_spec.rb
|
74
|
+
RSpec.describe BooksController, type: :request do
|
75
|
+
let!(:books) { create_list(:book, 10) }
|
76
|
+
|
77
|
+
describe 'GET /books' do
|
78
|
+
it 'handles pagination and includes' do
|
79
|
+
get '/books', params: {
|
80
|
+
page: 1,
|
81
|
+
per_page: 5,
|
82
|
+
include: 'author,reviews'
|
83
|
+
}
|
84
|
+
|
85
|
+
# Test pagination
|
86
|
+
expect(response).to be_paginated
|
87
|
+
expect(response).to have_page_size(5)
|
88
|
+
expect(response).to have_pagination_links.including(:first, :last, :next)
|
89
|
+
|
90
|
+
# Test includes
|
91
|
+
expect(response).to include_related(:author)
|
92
|
+
expect(response).to include_related(:reviews)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
## Helper Methods
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
# Build without saving
|
102
|
+
book = build_jpie_resource(:books, { title: 'Test Book' })
|
103
|
+
|
104
|
+
# Create with relationships
|
105
|
+
author = create_jpie_resource(:authors, { name: 'Author' })
|
106
|
+
book = create_jpie_resource(:books, { title: 'Test Book' }, { author: author })
|
107
|
+
|
108
|
+
# Clean up
|
109
|
+
cleanup_jpie_resources([book, author])
|
110
|
+
```
|
111
|
+
|
112
|
+
## Best Practices
|
113
|
+
|
114
|
+
1. Always clean up your test resources using `cleanup_jpie_resources`
|
115
|
+
2. Test both the presence of attributes/relationships and their values
|
116
|
+
3. Group your tests logically by resource features (attributes, relationships, meta)
|
117
|
+
4. Test pagination with different page sizes and page numbers
|
118
|
+
5. Test relationship includes with various combinations
|
119
|
+
6. Test meta fields with both simple and complex values
|
120
|
+
7. Use factories (like FactoryBot) to create test data
|
121
|
+
8. Test edge cases and validations specific to your resource configuration
|
122
|
+
|
123
|
+
## Common Gotchas
|
124
|
+
|
125
|
+
- Remember that `have_attribute` and `have_relationship` check both the presence of the method and the attribute/relationship in the resource's configuration
|
126
|
+
- The cleanup helper will only destroy persisted resources
|
127
|
+
- When testing relationships, make sure to test both the relationship configuration and the actual related resources
|
128
|
+
- Meta field values should match exactly, including nested structures
|
129
|
+
- Pagination tests should verify both the metadata and the actual number of records returned
|
130
|
+
- When testing includes, verify both the presence of the included data and its structure
|
data/lib/jpie/version.rb
CHANGED
data/lib/jpie.rb
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
require 'active_support'
|
4
4
|
require 'active_support/core_ext'
|
5
5
|
require 'jpie/version'
|
6
|
+
require_relative 'jpie/resource'
|
7
|
+
require_relative 'jpie/errors'
|
6
8
|
|
7
9
|
module JPie
|
8
|
-
autoload :Resource, 'jpie/resource'
|
9
10
|
autoload :Serializer, 'jpie/serializer'
|
10
11
|
autoload :Deserializer, 'jpie/deserializer'
|
11
12
|
autoload :Controller, 'jpie/controller'
|
12
13
|
autoload :Configuration, 'jpie/configuration'
|
13
|
-
autoload :Errors, 'jpie/errors'
|
14
14
|
autoload :Routing, 'jpie/routing'
|
15
15
|
|
16
16
|
class << self
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Kampp
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -169,11 +169,19 @@ executables: []
|
|
169
169
|
extensions: []
|
170
170
|
extra_rdoc_files: []
|
171
171
|
files:
|
172
|
-
- ".
|
172
|
+
- ".cursor/rules/dependencies.mdc"
|
173
|
+
- ".cursor/rules/examples.mdc"
|
174
|
+
- ".cursor/rules/git.mdc"
|
175
|
+
- ".cursor/rules/project_structure.mdc"
|
176
|
+
- ".cursor/rules/publish_gem.mdc"
|
177
|
+
- ".cursor/rules/security.mdc"
|
178
|
+
- ".cursor/rules/style.mdc"
|
179
|
+
- ".cursor/rules/testing.mdc"
|
173
180
|
- ".overcommit.yml"
|
174
181
|
- ".rubocop.yml"
|
175
182
|
- CHANGELOG.md
|
176
183
|
- LICENSE.txt
|
184
|
+
- PUBLISHING.md
|
177
185
|
- README.md
|
178
186
|
- Rakefile
|
179
187
|
- examples/basic_example.md
|
@@ -182,6 +190,7 @@ files:
|
|
182
190
|
- examples/relationships.md
|
183
191
|
- examples/resource_attribute_configuration.md
|
184
192
|
- examples/resource_meta_configuration.md
|
193
|
+
- examples/rspec_testing.md
|
185
194
|
- examples/single_table_inheritance.md
|
186
195
|
- jpie.gemspec
|
187
196
|
- lib/jpie.rb
|
data/.cursorrules
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# AI Assistant Configuration
|
2
|
-
# This file contains rules and guidelines for AI assistants working on the jpie project
|
3
|
-
|
4
|
-
# Follow these code style guidelines
|
5
|
-
- Follow Ruby style guide and RuboCop rules defined in .rubocop.yml
|
6
|
-
- Prefer rubocop autocorrect
|
7
|
-
- Always pass rubocop before committing to git
|
8
|
-
- Use `{data:}` rather than `{data: data}`
|
9
|
-
- Only use code comments when abasolutely necessary
|
10
|
-
- Keep any code comments short and concise
|
11
|
-
- Don't update the .rubocop.yml unless it's absolutely necessarry
|
12
|
-
|
13
|
-
# Documentation requirements
|
14
|
-
- Keep README.md up to date with installation and usage instructions
|
15
|
-
- Include example usage in documentation
|
16
|
-
|
17
|
-
# Testing guidelines
|
18
|
-
- Write RSpec tests for all new features
|
19
|
-
- Maintain test coverage for all public methods
|
20
|
-
- Use meaningful test descriptions
|
21
|
-
- Follow the existing test structure in spec/
|
22
|
-
- Test both success and error cases
|
23
|
-
- Use modern RSpec features and syntax
|
24
|
-
- Don't reduce test coverage (line, file, branch, or other)
|
25
|
-
- Only care about coverge reduction when running all specs
|
26
|
-
|
27
|
-
# Git commit guidelines
|
28
|
-
- Write clear, descriptive commit messages
|
29
|
-
- Keep commits focused and atomic
|
30
|
-
- Run and pass tests before committing
|
31
|
-
- Update documentation in the same commit as code changes
|
32
|
-
- Ignore spec/examples.txt and other files listed in .gitignore
|
33
|
-
- Include Ruby/Rails version requirements in relevant commits
|
34
|
-
- Update tests in the same commit as code changes
|
35
|
-
|
36
|
-
# Maintain the following project structure
|
37
|
-
- Keep core functionality in lib/jpie/
|
38
|
-
- Place tests in spec/jpie/
|
39
|
-
- Use proper namespacing (JPie module)
|
40
|
-
- Follow Ruby gem best practices
|
41
|
-
- Do not update the spec/jpie/database.rb unless it's absolutely necessarry
|
42
|
-
- Do not update the spec/jpie/resources.rb unless it's absolutely necessarry
|
43
|
-
|
44
|
-
# Dependency management
|
45
|
-
- Keep dependencies minimal and justified
|
46
|
-
- Document new dependencies in README.md
|
47
|
-
- Keep development dependencies in Gemfile
|
48
|
-
- Ensure compatibility with Ruby 3.4+
|
49
|
-
- Only support Rails 8+ features
|
50
|
-
- Use modern gem versions
|
51
|
-
|
52
|
-
# Security guidelines
|
53
|
-
- Never commit sensitive data or credentials
|
54
|
-
- Use environment variables for configuration
|
55
|
-
- Follow secure coding practices
|
56
|
-
- Keep dependencies up to date
|
57
|
-
- Follow Rails 8+ security best practices
|
58
|
-
- Use Ruby 3.4+ security features
|
59
|
-
- Implement proper input validation
|
60
|
-
|
61
|
-
# Compatibility requirements
|
62
|
-
- Maintain Ruby 3.4+ compatibility
|
63
|
-
- Support Rails 8+ integration
|
64
|
-
- Follow JSON:API specification strictly
|
65
|
-
|
66
|
-
# When implementing new features or refactoring
|
67
|
-
- Always read the .aiconfig file
|
68
|
-
- Always implement code slowly and methodically
|
69
|
-
- Always test as you go
|
70
|
-
- Always make sure rubocop passes
|
71
|
-
- Do not add any functionality for the new feature to existing tests unless absolutely necessarry.
|
72
|
-
|
73
|
-
# Examples
|
74
|
-
- The examples must _only_ include _required_ code
|
75
|
-
- The examples must not include any unrelated or supurflous code
|
76
|
-
- Examples must be a single markdown file
|
77
|
-
- Examples must use the `http` code blocks for its exampels
|
78
|
-
- Examples must only include the minium number of examples
|
79
|
-
- Examples must never include migrations.
|
80
|
-
- Examples must not include a features section or similar
|
81
|
-
- Examples must include an introduction to the example
|
82
|
-
- Examples live in /examples/*.md
|