mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
35 lines
808 B
Go
35 lines
808 B
Go
package bundler
|
|
|
|
import (
|
|
"github.com/anchore/imgbom/imgbom/analyzer/common"
|
|
"github.com/anchore/imgbom/imgbom/pkg"
|
|
"github.com/anchore/stereoscope/pkg/file"
|
|
"github.com/anchore/stereoscope/pkg/tree"
|
|
)
|
|
|
|
type Analyzer struct {
|
|
analyzer common.GenericAnalyzer
|
|
}
|
|
|
|
func NewAnalyzer() *Analyzer {
|
|
globParserDispatch := map[string]common.ParserFn{
|
|
"*/Gemfile.lock": ParseGemfileLockEntries,
|
|
}
|
|
|
|
return &Analyzer{
|
|
analyzer: common.NewGenericAnalyzer(nil, globParserDispatch),
|
|
}
|
|
}
|
|
|
|
func (a *Analyzer) Name() string {
|
|
return "bundler-analyzer"
|
|
}
|
|
|
|
func (a *Analyzer) SelectFiles(trees []tree.FileTreeReader) []file.Reference {
|
|
return a.analyzer.SelectFiles(trees)
|
|
}
|
|
|
|
func (a *Analyzer) Analyze(contents map[file.Reference]string) ([]pkg.Package, error) {
|
|
return a.analyzer.Analyze(contents, a.Name())
|
|
}
|