func NewDetectionResult(typ model.DevfileType, registry api.Registry, appPorts []int, devfileVersion, name string) *api.DetectionResult
type Alizer struct {
// contains filtered or unexported fields
}
func NewAlizerClient(registryClient registry.Client) *Alizer
func (o *Alizer) DetectFramework(ctx context.Context, path string) (DetectedFramework, error)
DetectFramework uses the alizer library in order to detect the devfile to use depending on the files in the path
func (o *Alizer) DetectName(path string) (string, error)
DetectName retrieves the name of the project (if available). If source code is detected: 1. Detect the name (pom.xml for java, package.json for nodejs, etc.) 2. If unable to detect the name, use the directory name
If no source is detected: 1. Use the directory name
Last step. Sanitize the name so it's valid for a component name
Use: import "github.com/redhat-developer/alizer/pkg/apis/recognizer" components, err := recognizer.DetectComponents("./")
In order to detect the name, the name will first try to find out the name based on the program (pom.xml, etc.) but then if not, it will use the dir name.
func (o *Alizer) DetectPorts(path string) ([]int, error)
type Client interface { DetectFramework(ctx context.Context, path string) (DetectedFramework, error) DetectName(path string) (string, error) DetectPorts(path string) ([]int, error) }
type DetectedFramework struct { Type model.DevfileType DefaultVersion string Registry api.Registry Architectures []string }
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) DetectFramework(ctx context.Context, path string) (DetectedFramework, error)
DetectFramework mocks base method.
func (m *MockClient) DetectName(path string) (string, error)
DetectName mocks base method.
func (m *MockClient) DetectPorts(path string) ([]int, error)
DetectPorts mocks base method.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) DetectFramework(ctx, path interface{}) *gomock.Call
DetectFramework indicates an expected call of DetectFramework.
func (mr *MockClientMockRecorder) DetectName(path interface{}) *gomock.Call
DetectName indicates an expected call of DetectName.
func (mr *MockClientMockRecorder) DetectPorts(path interface{}) *gomock.Call
DetectPorts indicates an expected call of DetectPorts.