purl 0.1.0 → 1.1.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/CHANGELOG.md +43 -2
- data/CODE_OF_CONDUCT.md +1 -1
- data/CONTRIBUTING.md +167 -0
- data/LICENSE +21 -0
- data/README.md +409 -13
- data/Rakefile +538 -0
- data/SECURITY.md +164 -0
- data/lib/purl/errors.rb +64 -0
- data/lib/purl/package_url.rb +520 -0
- data/lib/purl/registry_url.rb +543 -0
- data/lib/purl/version.rb +1 -1
- data/lib/purl.rb +133 -1
- data/purl-types.json +583 -0
- data/schemas/purl-types.schema.json +154 -0
- data/schemas/test-suite-data.schema.json +134 -0
- data/test-suite-data.json +710 -0
- metadata +15 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 25661f74cff7bd498cd8b82d64887231cd1a576b8ce0ef59c5397c6d378759eb
|
|
4
|
+
data.tar.gz: 0e82bbe5c1600601b3f27a82c79d9ea579587961ae97df1f1272ce31da35877e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d95b6ca47f39eccb13394340e6a63a9acfa9c0efc8a031897e876fe0350e354ae1d1e4f45f747463e14e1060b89e455e03e3dcbedcefca3a99522fe4f4b54fa1
|
|
7
|
+
data.tar.gz: 3e5322963a75161291bead8050759a0578c07c8e2b8a732a6a3ca7180b0ffa5a099a63f9cb95785e9dcc42674f1933b10aa6acc9450f4e30ec8f233aa9bb6983
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
1
8
|
## [Unreleased]
|
|
2
9
|
|
|
3
|
-
## [
|
|
10
|
+
## [1.0.0] - 2025-01-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- 🎯 Comprehensive PURL parsing and validation with all 32 official package types
|
|
14
|
+
- 🔥 Namespaced error handling with contextual information (`InvalidSchemeError`, `InvalidTypeError`, `ValidationError`, etc.)
|
|
15
|
+
- 🔄 Bidirectional registry URL conversion - generate registry URLs from PURLs and parse PURLs from registry URLs
|
|
16
|
+
- 🌐 Registry URL generation for 13+ package ecosystems (npm, gem, maven, pypi, cargo, golang, etc.)
|
|
17
|
+
- 🎨 Rails-style route patterns for registry URL templates
|
|
18
|
+
- 📋 Type-specific validation for conan, cran, and swift packages
|
|
19
|
+
- 🤝 Cross-language compatibility with JSON-based configuration in `purl-types.json`
|
|
20
|
+
- 📊 69.5% compliance with official PURL specification test suite (41/59 tests passing)
|
|
21
|
+
- 🛠️ Comprehensive rake tasks for spec compliance testing and type management
|
|
22
|
+
- 📚 Full documentation and usage examples
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
- Parse PURL strings with full component extraction (type, namespace, name, version, qualifiers, subpath)
|
|
26
|
+
- Create PURL objects programmatically with validation
|
|
27
|
+
- Generate registry URLs for supported package types
|
|
28
|
+
- Reverse parse registry URLs back to PURL objects
|
|
29
|
+
- Query package type information and capabilities
|
|
30
|
+
- Validate PURLs according to type-specific rules
|
|
31
|
+
- Support for all official PURL types from the specification
|
|
32
|
+
|
|
33
|
+
### Supported Package Types
|
|
34
|
+
- **Registry URL Generation (13 types):** cargo, cocoapods, composer, conda, gem, golang, hex, maven, npm, nuget, pub, pypi, swift
|
|
35
|
+
- **Reverse Parsing (6 types):** cargo, gem, golang, maven, npm, pypi
|
|
36
|
+
- **All 32 Official Types:** alpm, apk, bitbucket, bitnami, cargo, cocoapods, composer, conan, conda, cpan, cran, deb, docker, gem, generic, github, golang, hackage, hex, huggingface, luarocks, maven, mlflow, npm, nuget, oci, pub, pypi, qpkg, rpm, swid, swift
|
|
37
|
+
|
|
38
|
+
### Development Tools
|
|
39
|
+
- `rake spec:update` - Fetch latest test cases from official PURL spec repository
|
|
40
|
+
- `rake spec:compliance` - Run compliance tests against official test suite
|
|
41
|
+
- `rake spec:types` - Show information about all PURL types and their support
|
|
42
|
+
- `rake spec:verify_types` - Verify types list against official specification
|
|
43
|
+
- `rake spec:debug` - Show detailed info about failing test cases
|
|
4
44
|
|
|
5
|
-
-
|
|
45
|
+
### Major Release - Production Ready
|
|
46
|
+
This marks the first major release of the Purl gem, indicating API stability and production readiness. The library provides comprehensive PURL parsing with better error handling and more features than existing PURL libraries for Ruby, including bidirectional registry URL conversion and cross-language JSON configuration compatibility.
|
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
|
+
[andrew@ecosyste.ms](mailto:andrew@ecosyste.ms).
|
|
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
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Contributing to Purl
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the Purl Ruby library! This document provides guidelines and information for contributors.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
|
8
|
+
|
|
9
|
+
## How to Contribute
|
|
10
|
+
|
|
11
|
+
### Reporting Issues
|
|
12
|
+
|
|
13
|
+
Before creating an issue, please:
|
|
14
|
+
1. Search existing issues to avoid duplicates
|
|
15
|
+
2. Use the latest version of the gem
|
|
16
|
+
3. Provide a clear, descriptive title
|
|
17
|
+
4. Include steps to reproduce the issue
|
|
18
|
+
5. Share relevant code examples or error messages
|
|
19
|
+
|
|
20
|
+
### Suggesting Enhancements
|
|
21
|
+
|
|
22
|
+
Enhancement suggestions are welcome! Please:
|
|
23
|
+
1. Check if the enhancement is already requested
|
|
24
|
+
2. Explain the use case and expected behavior
|
|
25
|
+
3. Consider if it fits the project's scope
|
|
26
|
+
4. Be willing to help implement if accepted
|
|
27
|
+
|
|
28
|
+
### Pull Requests
|
|
29
|
+
|
|
30
|
+
1. **Fork** the repository
|
|
31
|
+
2. **Create** a feature branch (`git checkout -b my-new-feature`)
|
|
32
|
+
3. **Make** your changes following our coding standards
|
|
33
|
+
4. **Add** tests for your changes
|
|
34
|
+
5. **Ensure** all tests pass (`rake test`)
|
|
35
|
+
6. **Run** the full test suite including compliance tests
|
|
36
|
+
7. **Commit** your changes with clear, descriptive messages
|
|
37
|
+
8. **Push** to your branch (`git push origin my-new-feature`)
|
|
38
|
+
9. **Create** a Pull Request with a clear description
|
|
39
|
+
|
|
40
|
+
## Development Setup
|
|
41
|
+
|
|
42
|
+
### Prerequisites
|
|
43
|
+
|
|
44
|
+
- Ruby 3.1 or higher
|
|
45
|
+
- Bundler gem
|
|
46
|
+
|
|
47
|
+
### Setup
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/package-url/purl-ruby.git
|
|
51
|
+
cd purl-ruby
|
|
52
|
+
bundle install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Running Tests
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Run all tests
|
|
59
|
+
rake test
|
|
60
|
+
|
|
61
|
+
# Run PURL specification compliance tests
|
|
62
|
+
rake spec:compliance
|
|
63
|
+
|
|
64
|
+
# Validate JSON schemas
|
|
65
|
+
rake spec:validate_schemas
|
|
66
|
+
|
|
67
|
+
# Validate PURL examples
|
|
68
|
+
rake spec:validate_examples
|
|
69
|
+
|
|
70
|
+
# Show all available tasks
|
|
71
|
+
rake -T
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Coding Standards
|
|
75
|
+
|
|
76
|
+
- Follow Ruby best practices and conventions
|
|
77
|
+
- Use meaningful variable and method names
|
|
78
|
+
- Add documentation for public methods
|
|
79
|
+
- Keep methods focused and concise
|
|
80
|
+
- Follow the existing code style
|
|
81
|
+
|
|
82
|
+
### Testing Requirements
|
|
83
|
+
|
|
84
|
+
All contributions must include appropriate tests:
|
|
85
|
+
|
|
86
|
+
- **Unit tests** for new functionality
|
|
87
|
+
- **Integration tests** for feature interactions
|
|
88
|
+
- **Compliance tests** must continue to pass
|
|
89
|
+
- **Example validation** for any new PURL examples
|
|
90
|
+
|
|
91
|
+
### Documentation
|
|
92
|
+
|
|
93
|
+
- Update the README.md if adding new features
|
|
94
|
+
- Add inline documentation for complex methods
|
|
95
|
+
- Update CHANGELOG.md following the format
|
|
96
|
+
- Include examples in documentation
|
|
97
|
+
|
|
98
|
+
## Project Structure
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
├── lib/
|
|
102
|
+
│ ├── purl.rb # Main module
|
|
103
|
+
│ └── purl/
|
|
104
|
+
│ ├── errors.rb # Error classes
|
|
105
|
+
│ ├── package_url.rb # Core PURL parsing
|
|
106
|
+
│ └── registry_url.rb # Registry URL handling
|
|
107
|
+
├── test/ # Test files
|
|
108
|
+
├── schemas/ # JSON schemas
|
|
109
|
+
├── purl-types.json # Package types configuration
|
|
110
|
+
└── test-suite-data.json # Official test cases
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Adding New Package Types
|
|
114
|
+
|
|
115
|
+
To add support for a new package type:
|
|
116
|
+
|
|
117
|
+
1. **Add type definition** to `purl-types.json`
|
|
118
|
+
2. **Include examples** from the official specification
|
|
119
|
+
3. **Add registry configuration** if applicable
|
|
120
|
+
4. **Update tests** to verify the new type
|
|
121
|
+
5. **Run validation** to ensure compliance
|
|
122
|
+
|
|
123
|
+
## JSON Schema Updates
|
|
124
|
+
|
|
125
|
+
When modifying JSON files:
|
|
126
|
+
|
|
127
|
+
1. **Validate** against schemas: `rake spec:validate_schemas`
|
|
128
|
+
2. **Update schemas** if structure changes
|
|
129
|
+
3. **Test examples** are valid: `rake spec:validate_examples`
|
|
130
|
+
|
|
131
|
+
## PURL Specification Compliance
|
|
132
|
+
|
|
133
|
+
This library maintains 100% compliance with the official PURL specification:
|
|
134
|
+
|
|
135
|
+
- All changes must maintain compliance
|
|
136
|
+
- Run `rake spec:compliance` before submitting
|
|
137
|
+
- New features should align with the spec
|
|
138
|
+
- Report spec issues upstream when discovered
|
|
139
|
+
|
|
140
|
+
## Release Process
|
|
141
|
+
|
|
142
|
+
Releases are handled by maintainers:
|
|
143
|
+
|
|
144
|
+
1. Update version in `lib/purl/version.rb`
|
|
145
|
+
2. Update `CHANGELOG.md` with changes
|
|
146
|
+
3. Run full test suite
|
|
147
|
+
4. Create release tag
|
|
148
|
+
5. Publish to RubyGems
|
|
149
|
+
|
|
150
|
+
## Getting Help
|
|
151
|
+
|
|
152
|
+
- **Issues**: Use GitHub issues for bugs and feature requests
|
|
153
|
+
- **Discussions**: Use GitHub discussions for questions
|
|
154
|
+
- **Security**: Follow our [Security Policy](SECURITY.md)
|
|
155
|
+
|
|
156
|
+
## Recognition
|
|
157
|
+
|
|
158
|
+
Contributors will be recognized in:
|
|
159
|
+
- Git commit history
|
|
160
|
+
- CHANGELOG.md for significant contributions
|
|
161
|
+
- Project documentation where appropriate
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
By contributing to Purl, you agree that your contributions will be licensed under the [MIT License](LICENSE).
|
|
166
|
+
|
|
167
|
+
Thank you for contributing to make Purl better for everyone!
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Andrew Nesbitt
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|