jpie 0.4.3 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17c72f6974e3f671d772c5acec6ccd40541e06c36797603b4e0625b2235834f2
4
- data.tar.gz: 6e13c925f6c6605278a0f3544165c8c3f7c9c6feaf3f97c54265c033f0a498e5
3
+ metadata.gz: 8d3cbfd72c12a023879f10c3314c321bf0210c861cffd838dc860d0497b53ae5
4
+ data.tar.gz: c8caf96a60fe557f7f07ce74e9cb725370b2d410856e33c2138f0bef7f1ba141
5
5
  SHA512:
6
- metadata.gz: 8a9d2f4a6505c5bd7e94798fd63c382150b4170f8cd610548439161bec82dc9bfc07807468e32cc50d980018e7bc5625724db509742a97281e32dfb069acbe47
7
- data.tar.gz: 8e1eb70f4967a8d83c25583b234172a6fd9e9767ef1ea816a2fe5b6dc447f7bd11a68e67cab7e27851eee342395e616249d32033680cdc83050d896bd5726ec9
6
+ metadata.gz: dd2a288d7526fd45c3f2a30881019656a0772942d83f208e9a031d976223a8497ea29f00295d37d2c045805dae791a79f2d6d6be5c1835007dfd9ba1b6b8b4c2
7
+ data.tar.gz: 99a5f5e5fb484a394ce36c6ac9f5635c2f06c820dc6c41f16d89903e7135fde2b1e32d6a1a7df5277ee3ee3f248b15651a1353fb83315e96c9525a47b8638221
@@ -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,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/lib/jpie/rspec.rb ADDED
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/expectations'
4
+
5
+ module JPie
6
+ # RSpec matchers and helpers for testing JPie resources
7
+ module RSpec
8
+ # Configure RSpec with JPie helpers and matchers
9
+ def self.configure!
10
+ ::RSpec.configure do |config|
11
+ config.include JPie::RSpec::Matchers
12
+ config.include JPie::RSpec::Helpers
13
+ end
14
+ end
15
+
16
+ # Custom matchers for JPie resources
17
+ module Matchers
18
+ extend ::RSpec::Matchers::DSL
19
+
20
+ matcher :have_attribute do |attribute_name|
21
+ match do |actual|
22
+ actual.respond_to?(attribute_name) &&
23
+ actual.attributes.key?(attribute_name.to_s)
24
+ end
25
+
26
+ failure_message do |actual|
27
+ "expected #{actual.inspect} to have attribute '#{attribute_name}'"
28
+ end
29
+ end
30
+
31
+ matcher :have_relationship do |relationship_name|
32
+ match do |actual|
33
+ actual.respond_to?(relationship_name) &&
34
+ actual.relationships.key?(relationship_name.to_s)
35
+ end
36
+
37
+ failure_message do |actual|
38
+ "expected #{actual.inspect} to have relationship '#{relationship_name}'"
39
+ end
40
+ end
41
+ end
42
+
43
+ # Helper methods for testing JPie resources
44
+ module Helpers
45
+ # Build a JPie resource without saving it
46
+ def build_jpie_resource(type, attributes = {}, relationships = {})
47
+ JPie::Resource.new(
48
+ type: type,
49
+ attributes: attributes,
50
+ relationships: relationships
51
+ )
52
+ end
53
+
54
+ # Create a JPie resource and save it
55
+ def create_jpie_resource(type, attributes = {}, relationships = {})
56
+ resource = build_jpie_resource(type, attributes, relationships)
57
+ resource.save
58
+ resource
59
+ end
60
+
61
+ # Clean up test data after specs
62
+ def cleanup_jpie_resources(resources)
63
+ Array(resources).each do |resource|
64
+ resource.destroy if resource.persisted?
65
+ rescue StandardError => e
66
+ warn "Failed to cleanup resource #{resource.inspect}: #{e.message}"
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
data/lib/jpie/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JPie
4
- VERSION = '0.4.3'
4
+ VERSION = '0.4.4'
5
5
  end
data/lib/jpie.rb CHANGED
@@ -3,14 +3,18 @@
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/client'
8
+ require_relative 'jpie/errors'
9
+
10
+ # Load RSpec support if RSpec is defined
11
+ require_relative 'jpie/rspec' if defined?(RSpec)
6
12
 
7
13
  module JPie
8
- autoload :Resource, 'jpie/resource'
9
14
  autoload :Serializer, 'jpie/serializer'
10
15
  autoload :Deserializer, 'jpie/deserializer'
11
16
  autoload :Controller, 'jpie/controller'
12
17
  autoload :Configuration, 'jpie/configuration'
13
- autoload :Errors, 'jpie/errors'
14
18
  autoload :Routing, 'jpie/routing'
15
19
 
16
20
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp
@@ -169,7 +169,13 @@ executables: []
169
169
  extensions: []
170
170
  extra_rdoc_files: []
171
171
  files:
172
- - ".cursorrules"
172
+ - ".cursor/rules/dependencies.mdc"
173
+ - ".cursor/rules/examples.mdc"
174
+ - ".cursor/rules/git.mdc"
175
+ - ".cursor/rules/project_structure.mdc"
176
+ - ".cursor/rules/security.mdc"
177
+ - ".cursor/rules/style.mdc"
178
+ - ".cursor/rules/testing.mdc"
173
179
  - ".overcommit.yml"
174
180
  - ".rubocop.yml"
175
181
  - CHANGELOG.md
@@ -207,6 +213,7 @@ files:
207
213
  - lib/jpie/resource/inferrable.rb
208
214
  - lib/jpie/resource/sortable.rb
209
215
  - lib/jpie/routing.rb
216
+ - lib/jpie/rspec.rb
210
217
  - lib/jpie/serializer.rb
211
218
  - lib/jpie/version.rb
212
219
  homepage: https://github.com/emk-klaay/jpie
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