diff --git a/syft/pkg/cataloger/cataloger.go b/syft/pkg/cataloger/cataloger.go index c02c7e233..3b836ee88 100644 --- a/syft/pkg/cataloger/cataloger.go +++ b/syft/pkg/cataloger/cataloger.go @@ -57,7 +57,7 @@ func ImageCatalogers(cfg Config) []pkg.Cataloger { python.NewPythonPackageCataloger(), r.NewPackageCataloger(), rpm.NewRpmDBCataloger(), - ruby.NewGemSpecCataloger(), + ruby.NewInstalledGemSpecCataloger(), sbom.NewSBOMCataloger(), }, cfg.Catalogers) } @@ -93,6 +93,7 @@ func DirectoryCatalogers(cfg Config) []pkg.Cataloger { rpm.NewFileCataloger(), rpm.NewRpmDBCataloger(), ruby.NewGemFileLockCataloger(), + ruby.NewGemSpecCataloger(), rust.NewCargoLockCataloger(), sbom.NewSBOMCataloger(), swift.NewCocoapodsCataloger(), @@ -136,6 +137,7 @@ func AllCatalogers(cfg Config) []pkg.Cataloger { rpm.NewRpmDBCataloger(), ruby.NewGemFileLockCataloger(), ruby.NewGemSpecCataloger(), + ruby.NewInstalledGemSpecCataloger(), rust.NewAuditBinaryCataloger(), rust.NewCargoLockCataloger(), sbom.NewSBOMCataloger(), diff --git a/syft/pkg/cataloger/ruby/catalogers.go b/syft/pkg/cataloger/ruby/catalogers.go index e3e173a21..aa6344847 100644 --- a/syft/pkg/cataloger/ruby/catalogers.go +++ b/syft/pkg/cataloger/ruby/catalogers.go @@ -13,8 +13,14 @@ func NewGemFileLockCataloger() *generic.Cataloger { WithParserByGlobs(parseGemFileLockEntries, "**/Gemfile.lock") } -// NewGemSpecCataloger returns a new Bundler cataloger object tailored for detecting installations of gems (e.g. Gemspec). -func NewGemSpecCataloger() *generic.Cataloger { +// NewInstalledGemSpecCataloger returns a new Bundler cataloger object tailored for detecting installations of gems (e.g. Gemspec). +func NewInstalledGemSpecCataloger() *generic.Cataloger { return generic.NewCataloger("ruby-gemspec-cataloger"). WithParserByGlobs(parseGemSpecEntries, "**/specifications/**/*.gemspec") } + +// NewGemSpecCataloger looks for gems with a broader scope. +func NewGemSpecCataloger() *generic.Cataloger { + return generic.NewCataloger("ruby-gemspec-cataloger"). + WithParserByGlobs(parseGemSpecEntries, "**/*.gemspec") +} diff --git a/test/integration/catalog_packages_cases_test.go b/test/integration/catalog_packages_cases_test.go index 52bd6f287..3ff8d307d 100644 --- a/test/integration/catalog_packages_cases_test.go +++ b/test/integration/catalog_packages_cases_test.go @@ -94,6 +94,7 @@ var dirOnlyTestCases = []testCase{ "arel": "5.0.1.20140414130214", "bootstrap-sass": "3.1.1.1", "builder": "3.2.2", + "bundler": "2.1.4", "coffee-rails": "4.0.1", "coffee-script": "2.2.0", "coffee-script-source": "1.7.0", @@ -136,6 +137,7 @@ var dirOnlyTestCases = []testCase{ "turbolinks": "3.0.0", "tzinfo": "1.2.0", "uglifier": "2.5.0", + "unbundler": "3.1.4", "unicorn": "4.8.3", }, },