Skip to content

Conversation

@pboling
Copy link
Contributor

@pboling pboling commented Oct 26, 2025

# 📍 NOTE What
1️⃣ This one first Modernize gem structure <=== You are here
2️⃣ Then see #37 next Upgrade to v1.7 spec
3️⃣ Then see #39 Add --validate feature
4️⃣ Then see #40 Add --include-metadata feature

🎨 modernize for 2025

Added

  • CONTRIBUTING.md file to help people find their way to contributing
  • CHANGELOG.md file to document notable changes in keep-a-changelog format
  • Cyclonedx::BomHelpers module to house helper methods, replacing global methods
  • Cyclonedx::BomBuilder class, replacing Bombuilder (note the capitalization change)
  • Cyclonedx::BomComponent class, replacing BomComponent
  • Cyclonedx::Ruby::Version::VERSION constant to hold the version number (also available as Cyclonedx::VERSION)
  • Cyclonedx::Ruby::Deprecation module to help manage deprecations
  • dev dependency: stone_checksums
    • For SHA-256 and SHA-512 checksum generation for each release.
  • signed gem releases
  • CI matrix testing on Ruby 3.3, 3.4

Changed

  • Updated gemspec metadata for clarity and consistency
  • Modernized Rakefile, dotfiles, and test setup
  • LICENSE => LICENSE.txt to simplify parsing consistency on various platforms and tools
  • cucumber v8 => v10
  • aruba v2.1 => v2.2

Deprecated

  • BomComponent => Cyclonedx::BomComponent
  • Bombuilder => Cyclonedx::BomBuilder (note the capitalization change)
  • Object.purl => Cyclonedx::BomHelpers.purl
  • Object.random_urn_uuid => Cyclonedx::BomHelpers.random_urn_uuid
  • Object.build_bom => Cyclonedx::BomHelpers.build_bom
  • Object.build_json_bom => Cyclonedx::BomHelpers.build_json_bom
  • Object.build_bom_xml => Cyclonedx::BomHelpers.build_bom_xml
  • Object.get_gem => Cyclonedx::BomHelpers.get_gem

Fixed

  • Nokogiri::XML::Builder context relies on method_missing
    • Globally defined Object#purl conflicted with <purl>.
    • Moved to Cyclonedx::BomHelpers.purl to avoid conflict in v2.0.0 (along with all other global methods)
    • Fixed existing usage via the built-in Nokogiri workaround of adding an underscore purl_
    • The XML tag is unchanged as <purl>

Signed-off-by: Peter H. Boling [email protected]

Copilot AI review requested due to automatic review settings October 26, 2025 03:19
@pboling pboling changed the title 🔨 binstubs: console, setup, rake, rspec, cucumber 🎨 modernize for 2025 Oct 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the cyclonedx-ruby gem for 2025 by refactoring the codebase to use proper namespacing under the Cyclonedx module, introducing a deprecation system for backward compatibility, and updating dependencies. The changes prepare for a v2.0.0 release while maintaining compatibility with existing code through deprecated aliases.

Key changes:

  • Refactored global methods and classes into the Cyclonedx namespace with deprecation warnings for legacy usage
  • Fixed Nokogiri XML builder conflict with globally-scoped purl method
  • Updated development dependencies (cucumber v8→v10, aruba v2.1→v2.2)

Reviewed Changes

Copilot reviewed 25 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/cyclonedx/ruby.rb New main entry point that requires all Cyclonedx module components
lib/cyclonedx/bom_helpers.rb Refactored helper methods into Cyclonedx::BomHelpers module
lib/cyclonedx/bom_component.rb Moved BomComponent class into Cyclonedx namespace
lib/cyclonedx/bom_builder.rb Moved Bombuilder class into Cyclonedx namespace as BomBuilder
lib/cyclonedx/ruby/version.rb New version constant structure
lib/cyclonedx/ruby/deprecation.rb New deprecation management module
lib/cyclonedx_deprecated.rb Compatibility layer providing deprecated aliases
lib/bom_*.rb Legacy entry points now redirect to new namespaced code
spec/spec_helper.rb Updated test configuration and loading logic
spec/cyclonedx/*.rb New namespaced test files
cyclonedx-ruby.gemspec Updated metadata and dependency versions
exe/cyclonedx-ruby Updated executable with backward compatibility logic
CHANGELOG.md New changelog documenting all changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jkowalleck
Copy link
Member

@pboling
Copy link
Contributor Author

pboling commented Oct 27, 2025

@jkowalleck there are 10 minor and 60 medium SCA violations. I'd like to focus on this PR not changing much runtime logic. Would you prefer to fix them in a separate PR, or just the medium ones here, or all of them here?

@jkowalleck
Copy link
Member

@jkowalleck there are 10 minor and 60 medium SCA violations. I'd like to focus on this PR not changing much runtime logic. Would you prefer to fix them in a separate PR, or just the medium ones here, or all of them here?

I dont know whether the SCA issue already existed, and were reported only because the code moved from one file to another.
Anyway, i believe in continuous improvements and small iterations. I would be okay with a follow-up ticket and PR to address these findings later, especially since we have PRs that build on the code in this PR.

@jkowalleck
Copy link
Member

jkowalleck commented Oct 28, 2025

there seams to be some CI/CT failing.
could you have a look? https://github.com/CycloneDX/cyclonedx-ruby-gem/actions/runs/18813396802?pr=38

@pboling
Copy link
Contributor Author

pboling commented Oct 28, 2025

Looking into the CI failures, and will fix the license link in README, and add CONTRIBUTING.md. I looked at other projects in this org, and it seems the are using contributor covenant v2.0. So following that pattern I'm adding contributor covenant v2.1, using the same contact email as the other projects have.
Rebasing the PRs that are on top of this one, is effort, but not horrible; the splits are pretty clean. :)

@mperham
Copy link

mperham commented Oct 29, 2025

I’d like to see this work integrated too. Thanks @pboling!

one request: remove unnecessary 3rd party dependencies. No real reason this lib needs nokogiri or rest-client.

@pboling pboling requested a review from a team as a code owner October 30, 2025 06:57
Signed-off-by: Peter H. Boling <[email protected]>
- .gitignore
- .rspec

Signed-off-by: Peter H. Boling <[email protected]>
Signed-off-by: Peter H. Boling <[email protected]>
### Added

- `CHANGELOG.md` file to document notable changes in keep-a-changelog format
- `Cyclonedx::BomHelpers` module to house helper methods, replacing global methods
- `Cyclonedx::BomBuilder` class, replacing `Bombuilder` (note the capitalization change)
- `Cyclonedx::BomComponent` class, replacing `BomComponent`
- `Cyclonedx::Ruby::Version::VERSION` constant to hold the version number (also available as `Cyclonedx::VERSION`)
- `Cyclonedx::Ruby::Deprecation` module to help manage deprecations

### Changed

- Updated gemspec metadata for clarity and consistency
- Modernized Rakefile, dotfiles, and test setup
- `LICENSE` => `LICENSE.txt` to simplify parsing consistency on various platforms and tools
- `cucumber` v8 => v10
- `aruba` v2.1 => v2.2

### Deprecated

- `BomComponent` => `Cyclonedx::BomComponent`
- `Bombuilder` => `Cyclonedx::BomBuilder` (note the capitalization change)
- `Object.purl` => `Cyclonedx::BomHelpers.purl`
- `Object.random_urn_uuid` => `Cyclonedx::BomHelpers.random_urn_uuid`
- `Object.build_bom` => `Cyclonedx::BomHelpers.build_bom`
- `Object.build_json_bom` => `Cyclonedx::BomHelpers.build_json_bom`
- `Object.build_bom_xml` => `Cyclonedx::BomHelpers.build_bom_xml`
- `Object.get_gem` => `Cyclonedx::BomHelpers.get_gem`

Signed-off-by: Peter H. Boling <[email protected]>
### Added

- `CHANGELOG.md` file to document notable changes in keep-a-changelog format
- `Cyclonedx::BomHelpers` module to house helper methods, replacing global methods
- `Cyclonedx::BomBuilder` class, replacing `Bombuilder` (note the capitalization change)
- `Cyclonedx::BomComponent` class, replacing `BomComponent`
- `Cyclonedx::Ruby::Version::VERSION` constant to hold the version number (also available as `Cyclonedx::VERSION`)
- `Cyclonedx::Ruby::Deprecation` module to help manage deprecations

### Changed

- Updated gemspec metadata for clarity and consistency
- Modernized Rakefile, dotfiles, and test setup
- `LICENSE` => `LICENSE.txt` to simplify parsing consistency on various platforms and tools
- `cucumber` v8 => v10
- `aruba` v2.1 => v2.2

### Deprecated

- `BomComponent` => `Cyclonedx::BomComponent`
- `Bombuilder` => `Cyclonedx::BomBuilder` (note the capitalization change)
- `Object.purl` => `Cyclonedx::BomHelpers.purl`
- `Object.random_urn_uuid` => `Cyclonedx::BomHelpers.random_urn_uuid`
- `Object.build_bom` => `Cyclonedx::BomHelpers.build_bom`
- `Object.build_json_bom` => `Cyclonedx::BomHelpers.build_json_bom`
- `Object.build_bom_xml` => `Cyclonedx::BomHelpers.build_bom_xml`
- `Object.get_gem` => `Cyclonedx::BomHelpers.get_gem`

### Fixed

- `Nokogiri::XML::Builder` context relies on `method_missing`
  - Globally defined `Object#purl` conflicted with `<purl>`.
  - Moved to `Cyclonedx::BomHelpers.purl` to avoid conflict in v2.0.0 (along with all other global methods)
  - Fixed existing usage via the built-in Nokogiri workaround of adding an underscore `purl_`
  - The XML tag is unchanged as `<purl>`

Signed-off-by: Peter H. Boling <[email protected]>
Signed-off-by: Peter H. Boling <[email protected]>
Signed-off-by: Peter H. Boling <[email protected]>
@pboling pboling force-pushed the fix/nokogiri-incompatible-with-global-purl branch from 1352653 to 6ebe091 Compare October 30, 2025 06:59
@pboling pboling force-pushed the fix/nokogiri-incompatible-with-global-purl branch 2 times, most recently from 39b4cb3 to 23ef3f8 Compare October 30, 2025 07:24
- Bigger build matrix changes are needed to continue running against older bunlders.
- will introduce the appraisal pattern later

Signed-off-by: Peter H. Boling <[email protected]>
Signed-off-by: Peter H. Boling <[email protected]>
@pboling
Copy link
Contributor Author

pboling commented Oct 30, 2025

@jkowalleck this is done, I tihnk. CI matrix should be passing now, and all comments have been addressed. LMK if there is anything else to be done here. I've got a lot more improvements I'd like to make, so these initial 4 PRs are just the beginning.
I had to drop the older versions of ruby, and added the newer ones to replace them.
The older ones will not work with latest version of bundler, because they are EOL, and thus continuing to run them in CI requires additional configuration, but I'd like to do that in an isolated PR, because it will be many lines of code (appraisals is a useful pattern for this usecase).

@pboling pboling requested a review from jkowalleck October 30, 2025 16:33
@pboling
Copy link
Contributor Author

pboling commented Oct 30, 2025

@mperham - yes, I'll be trimming the dependencies in a future PR.

jkowalleck and others added 5 commits October 30, 2025 20:57
Signed-off-by: Jan Kowalleck <[email protected]>
- cleanup spec.files

Signed-off-by: Peter H. Boling <[email protected]>
Signed-off-by: Peter H. Boling <[email protected]>
@pboling
Copy link
Contributor Author

pboling commented Oct 31, 2025

@jkowalleck I'm not sure what happened, but it seems the Codacy issues are no longer extant. Maybe the linting auto-fixes resolved them? :)

@pboling pboling requested a review from jkowalleck November 1, 2025 05:32
@jkowalleck jkowalleck requested a review from Copilot November 3, 2025 13:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 34 out of 44 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pboling pboling requested review from Copilot and jkowalleck November 3, 2025 19:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 34 out of 44 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jkowalleck jkowalleck changed the title 🎨 modernize for 2025 refactor: 🎨 modernize for 2025 Nov 5, 2025
@jkowalleck jkowalleck changed the title refactor: 🎨 modernize for 2025 🎨 modernize for 2025 (chores & slight refactoring) Nov 5, 2025
@jkowalleck jkowalleck merged commit 004b462 into CycloneDX:master Nov 5, 2025
6 checks passed
@jkowalleck
Copy link
Member

thank you so much for this, @pboling .

thank you for reviewing, @seuros .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants