Documentation
¶
Overview ¶
Package recognizer implements functions that are used by every cobra cli command. Uses the enricher and model packages to return a result.
Index ¶
- Constants
- Variables
- func Analyze(path string) ([]model.Language, error)
- func AnalyzeFile(configFile string, targetLanguage string) (model.Language, error)
- func DetectComponents(path string) ([]model.Component, error)
- func DetectComponentsFromFilesList(files []string, settings model.DetectionSettings, ctx *context.Context) []model.Component
- func DetectComponentsInRoot(path string) ([]model.Component, error)
- func DetectComponentsInRootWithPathAndPortStartegy(path string, portDetectionStrategy []model.PortDetectionAlgorithm) ([]model.Component, error)
- func DetectComponentsInRootWithSettings(settings model.DetectionSettings) ([]model.Component, error)
- func DetectComponentsWithPathAndPortStartegy(path string, portDetectionStrategy []model.PortDetectionAlgorithm) ([]model.Component, error)
- func DetectComponentsWithSettings(settings model.DetectionSettings) ([]model.Component, error)
- func GetUrlWithVersions(url, minSchemaVersion, maxSchemaVersion string) (string, error)
- func MatchDevfiles(path string, url string, filter model.DevfileFilter) ([]model.DevFileType, error)
- func SelectDevFileFromRegistry(path string, url string) (model.DevFileType, error)
- func SelectDevFileFromTypes(path string, devFileTypes []model.DevFileType) (int, error)
- func SelectDevFileUsingLanguagesFromTypes(languages []model.Language, devFileTypes []model.DevFileType) (int, error)
- func SelectDevFilesFromRegistry(path string, url string) ([]model.DevFileType, error)
- func SelectDevFilesFromTypes(path string, devFileTypes []model.DevFileType) ([]int, error)
- func SelectDevFilesUsingLanguagesFromTypes(languages []model.Language, devFileTypes []model.DevFileType) ([]int, error)
Constants ¶
View Source
const MinimumAllowedVersion = "2.0.0"
Variables ¶
View Source
var DownloadDevFileTypesFromRegistry = func(url string, filter model.DevfileFilter) ([]model.DevFileType, error) { url = adaptUrl(url) tmpUrl := appendIndexPath(url) url, err := GetUrlWithVersions(tmpUrl, filter.MinSchemaVersion, filter.MaxSchemaVersion) if err != nil { return nil, err } resp, err := http.Get(url) if err != nil { return []model.DevFileType{}, err } defer func() error { if err := resp.Body.Close(); err != nil { return fmt.Errorf("error closing file: %s", err) } return nil }() if resp.StatusCode != http.StatusOK { return []model.DevFileType{}, errors.New("unable to fetch devfiles from the registry") } body, err2 := ioutil.ReadAll(resp.Body) if err2 != nil { return []model.DevFileType{}, errors.New("unable to fetch devfiles from the registry") } var devFileTypes []model.DevFileType err = json.Unmarshal(body, &devFileTypes) if err != nil { return []model.DevFileType{}, errors.New("unable to fetch devfiles from the registry") } return devFileTypes, nil }
DownloadDevFileTypesFromRegistry is exposed as a global variable for the purpose of running mock tests
Functions ¶
func AnalyzeFile ¶
func DetectComponentsFromFilesList ¶
func DetectComponentsFromFilesList(files []string, settings model.DetectionSettings, ctx *context.Context) []model.Component
DetectComponentsFromFilesList detect components by analyzing all files. Uses the settings to perform component detection on files.
func DetectComponentsInRootWithSettings ¶
func DetectComponentsInRootWithSettings(settings model.DetectionSettings) ([]model.Component, error)
func DetectComponentsWithSettings ¶
func DetectComponentsWithSettings(settings model.DetectionSettings) ([]model.Component, error)
func GetUrlWithVersions ¶ added in v1.0.1
func MatchDevfiles ¶ added in v1.0.1
func MatchDevfiles(path string, url string, filter model.DevfileFilter) ([]model.DevFileType, error)
func SelectDevFileFromRegistry ¶
func SelectDevFileFromRegistry(path string, url string) (model.DevFileType, error)
func SelectDevFileFromTypes ¶
func SelectDevFileFromTypes(path string, devFileTypes []model.DevFileType) (int, error)
func SelectDevFilesFromRegistry ¶
func SelectDevFilesFromRegistry(path string, url string) ([]model.DevFileType, error)
func SelectDevFilesFromTypes ¶
func SelectDevFilesFromTypes(path string, devFileTypes []model.DevFileType) ([]int, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.