config

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActiveProfilePath

func GetActiveProfilePath() (string, error)

func GetPlyHomePath

func GetPlyHomePath() (string, error)

func GetProfilesPath

func GetProfilesPath() (string, error)

func GetProfilesPathFor

func GetProfilesPathFor(profile string) (string, error)

func InstallOrMigrateToProfiles

func InstallOrMigrateToProfiles() error

func ProjectConfigPath

func ProjectConfigPath(targetDir string) string

func SetLogger

func SetLogger(logger logrus.FieldLogger)

func SwitchProfile

func SwitchProfile(newProfile string) error

Types

type Artifact

type Artifact struct {
	GroupId    string `json:"groupId"`
	ArtifactId string `json:"artifactId"`
}

type CloudConfig

type CloudConfig interface {
	Implementation() Directory
	Refresh(localConfig LocalConfigFile) error
	Services() func() (CloudServices, error)
	LinkFromService(services func() (CloudServices, error), groupId string, artifactId string, linkKey string) (url string, err error)
	DefaultServiceEnvironmentUrl(service CloudService, key string) (url string, err error)
	Deprecated() (CloudDeprecated, error)
	ProjectDefaults() (CloudProjectDefaults, error)
	GitHookFiles(folderName string) ([]string, error)
	ListDeprecated() error
	HasTemplate(name string) bool
	ValidTemplatesFrom(list []string) (templates []CloudTemplate, err error)
	Templates() (templates []CloudTemplate, err error)
	Template(name string) (CloudTemplate, error)
	Examples() (templates []string, err error)
	GlobalCloudConfig() (globalCloudConfig GlobalCloudConfig, err error)
}

type CloudConfigSource

type CloudConfigSource struct {
	RootUrl        string `yaml:"rootUrl"`
	RelativFileUrl string `yaml:"relativFileUrl"`
}

type CloudDeprecated

type CloudDeprecated struct {
	Type string `json:"type"`
	Data struct {
		Dependencies []CloudDeprecatedDependency `json:"dependencies"`
	} `json:"data"`
}

type CloudDeprecatedDependency

type CloudDeprecatedDependency struct {
	GroupId    string   `json:"groupId"`
	ArtifactId string   `json:"artifactId"`
	Files      []string `json:"files"`
	Associated struct {
		Files        []string                    `json:"files"`
		Dependencies []CloudDeprecatedDependency `json:"dependencies"`
	} `json:"associated"`
	ReplacementTemplates []string `json:"replacement_templates"`
}

type CloudProjectDefaults

type CloudProjectDefaults struct {
	Type     string          `json:"type"`
	Settings ProjectSettings `json:"settings"`
}

type CloudService

type CloudService struct {
	GroupID            string `json:"groupId"`
	ArtifactID         string `json:"artifactId"`
	BuildInfo          string `json:"build-info"`
	DefaultEnvironment string `json:"defaultEnvironment"`
	Environments       []struct {
		Name  string           `json:"name"`
		Links map[string]Links `json:"_links"`
	} `json:"environments"`
}

type CloudServices

type CloudServices struct {
	Type string         `json:"type"`
	Data []CloudService `json:"data"`
}

type CloudTemplate

type CloudTemplate struct {
	Name    string
	Project Project
}

type DirConfig

type DirConfig struct {
	Path string
}

func (DirConfig) Dir

func (dirCfg DirConfig) Dir() string

func (DirConfig) FilePath

func (dirCfg DirConfig) FilePath(fileName string) (string, error)

type Directory

type Directory interface {
	Dir() string
	FilePath(fileName string) (string, error)
}

type Git

type Git struct {
	Url string `yaml:"url"`
}

type GitCloudConfig

type GitCloudConfig struct {
	Impl DirConfig
}

func OpenGitCloudConfig

func OpenGitCloudConfig(localConfigPath string) (cfg GitCloudConfig)

func (GitCloudConfig) DefaultServiceEnvironmentUrl

func (gitCfg GitCloudConfig) DefaultServiceEnvironmentUrl(service CloudService, key string) (url string, err error)

func (GitCloudConfig) Deprecated

func (gitCfg GitCloudConfig) Deprecated() (CloudDeprecated, error)

func (GitCloudConfig) Examples

func (gitCfg GitCloudConfig) Examples() (templates []string, err error)

func (GitCloudConfig) GitHookFiles

func (gitCfg GitCloudConfig) GitHookFiles(path string) ([]string, error)

func (GitCloudConfig) GlobalCloudConfig

func (gitCfg GitCloudConfig) GlobalCloudConfig() (globalCloudConfig GlobalCloudConfig, err error)

func (GitCloudConfig) HasTemplate

func (gitCfg GitCloudConfig) HasTemplate(name string) bool

func (GitCloudConfig) Implementation

func (gitCfg GitCloudConfig) Implementation() Directory

func (GitCloudConfig) LinkFromService

func (gitCfg GitCloudConfig) LinkFromService(services func() (CloudServices, error), groupId string, artifactId string, linkKey string) (url string, err error)

func (GitCloudConfig) ListDeprecated

func (gitCfg GitCloudConfig) ListDeprecated() error

func (GitCloudConfig) ProjectDefaults

func (gitCfg GitCloudConfig) ProjectDefaults() (CloudProjectDefaults, error)

func (GitCloudConfig) Refresh

func (gitCfg GitCloudConfig) Refresh(localConfig LocalConfigFile) error

func (GitCloudConfig) Services

func (gitCfg GitCloudConfig) Services() func() (CloudServices, error)

func (GitCloudConfig) Template

func (gitCfg GitCloudConfig) Template(name string) (CloudTemplate, error)

func (GitCloudConfig) Templates

func (gitCfg GitCloudConfig) Templates() (templates []CloudTemplate, err error)

func (GitCloudConfig) ValidTemplatesFrom

func (gitCfg GitCloudConfig) ValidTemplatesFrom(list []string) (templates []CloudTemplate, err error)

type GitInfo

type GitInfo struct {
	IsRepo       bool
	IsDirty      bool
	EnableCommit bool
}

func GetGitInfoFromPath

func GetGitInfoFromPath(targetDir string) (gitInfo GitInfo, err error)

type GlobalCloudConfig

type GlobalCloudConfig struct {
	CloudConfigSource CloudConfigSource `yaml:"cloudConfigSource"`
}

func (GlobalCloudConfig) SourceFor

func (globalCloudConfig GlobalCloudConfig) SourceFor(dir string, name string) string
type Links struct {
	Href      string `json:"href"`
	Title     string `json:"title,omitempty"`
	Templated bool   `json:"templated"`
}

type LocalConfigDir

type LocalConfigDir struct {
	// contains filtered or unexported fields
}

func OpenLocalConfig

func OpenLocalConfig(absConfigDir string) (cfg LocalConfigDir)

func (LocalConfigDir) CheckOrCreateConfigDir

func (localCfgDir LocalConfigDir) CheckOrCreateConfigDir() error

func (LocalConfigDir) Config

func (localCfgDir LocalConfigDir) Config() (LocalConfiguration, error)

func (LocalConfigDir) Exists

func (localCfgDir LocalConfigDir) Exists() bool

func (LocalConfigDir) FilePath

func (localCfgDir LocalConfigDir) FilePath() string

func (LocalConfigDir) GetTerminalConfig

func (localCfgDir LocalConfigDir) GetTerminalConfig() (TerminalConfig, error)

func (LocalConfigDir) Implementation

func (localCfgDir LocalConfigDir) Implementation() DirConfig

func (LocalConfigDir) Print

func (localCfgDir LocalConfigDir) Print() error

func (LocalConfigDir) TouchFile

func (localCfgDir LocalConfigDir) TouchFile() error

func (LocalConfigDir) UpdateLocalConfig

func (localCfgDir LocalConfigDir) UpdateLocalConfig(config LocalConfiguration) error

type LocalConfigFile

type LocalConfigFile interface {
	Implementation() DirConfig
	FilePath() string
	CheckOrCreateConfigDir() error
	TouchFile() error
	Config() (LocalConfiguration, error)
	Print() error
	Exists() bool
}

type LocalConfiguration

type LocalConfiguration struct {
	CloudConfig    LocalGitConfig `yaml:"cloudConfig"`
	SourceProvider SourceProvider `yaml:"sourceProvider"`
	Nexus          Nexus          `yaml:"nexus"`
	TerminalConfig TerminalConfig `yaml:"terminal"`
}

type LocalGitConfig

type LocalGitConfig struct {
	Git Git `yaml:"git"`
}

type MavenProject

type MavenProject struct {
	PomFile  string
	PomModel *pom.Model
}

func (MavenProject) FilePath

func (mvnProject MavenProject) FilePath() string

func (MavenProject) Model

func (mvnProject MavenProject) Model() *pom.Model

func (MavenProject) Type

func (mvnProject MavenProject) Type() ValidProjectType

type MavenProjectConfiguration

type MavenProjectConfiguration struct {
	Artifact
	Language        string `json:"language"`
	Package         string `json:"package"`
	ApplicationName string `json:"applicationName"`
}

type MaxArtifact

type MaxArtifact struct {
	Artifact
	MaxVersion string `json:"maxVersion"`
}

type Nexus

type Nexus struct {
	Url      string `yaml:"url"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Project

type Project struct {
	Path        string
	GitInfo     GitInfo
	ConfigFile  string
	Config      ProjectConfiguration
	Type        ProjectType
	CloudConfig CloudConfig
}

func InitProjectFromDirectory

func InitProjectFromDirectory(targetDir string) (project Project, err error)

func InitProjectFromPomFile

func InitProjectFromPomFile(pomFile string) (project Project, err error)

func (*Project) GitCommit

func (project *Project) GitCommit(message string) error

func (*Project) GitInit

func (project *Project) GitInit(msg string) error

func (*Project) InitProjectConfiguration

func (project *Project) InitProjectConfiguration() (err error)

func (*Project) IsDirtyGitRepo

func (project *Project) IsDirtyGitRepo() bool

func (*Project) IsGitRepo

func (project *Project) IsGitRepo() bool

func (*Project) IsMavenProject

func (project *Project) IsMavenProject() bool

func (*Project) IsMultiModule

func (project *Project) IsMultiModule() bool

func (*Project) SortAndWritePom

func (project *Project) SortAndWritePom() error

type ProjectConfig

type ProjectConfig interface {
	WriteTo(targetFile string) error
	SourceMainPath() string
	SourceTestPath() string
	FindApplicationName(targetDir string) (err error)
	GetLanguage() string
	Populate(targetDir string) error
}

type ProjectConfiguration

type ProjectConfiguration struct {
	MavenProjectConfiguration
	Profile     string `json:"profile,omitempty"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Team        struct {
		Name         string `json:"name"`
		Email        string `json:"email"`
		SlackChannel string `json:"slackChannel,omitempty"`
	} `json:"team"`
	Dependencies []string          `json:"dependencies"`
	Templates    []string          `json:"templates"`
	Settings     ProjectSettings   `json:"settings"`
	Render       map[string]string `json:"render"`
}

func InitProjectConfigurationFromDir

func InitProjectConfigurationFromDir(targetDir string) (ProjectConfiguration, error)

func InitProjectConfigurationFromFile

func InitProjectConfigurationFromFile(filePath string) (ProjectConfiguration, error)

func (*ProjectConfiguration) Empty

func (config *ProjectConfiguration) Empty() bool

func (*ProjectConfiguration) FindApplicationName

func (config *ProjectConfiguration) FindApplicationName(targetDir string) (err error)

func (*ProjectConfiguration) GetLanguage

func (config *ProjectConfiguration) GetLanguage() string

func (*ProjectConfiguration) Populate

func (config *ProjectConfiguration) Populate(targetDir string) error

func (*ProjectConfiguration) SourceMainPath

func (config *ProjectConfiguration) SourceMainPath() string

func (*ProjectConfiguration) SourceTestPath

func (config *ProjectConfiguration) SourceTestPath() string

func (*ProjectConfiguration) Validate

func (config *ProjectConfiguration) Validate() error

func (*ProjectConfiguration) WriteTo

func (config *ProjectConfiguration) WriteTo(targetFile string) error

type ProjectSettings

type ProjectSettings struct {
	DisableDependencySort     bool          `json:"disableDependencySort"`
	DisableSpringBootUpgrade  bool          `json:"disableSpringBootUpgrade"`
	DisableKotlinUpgrade      bool          `json:"disableKotlinUpgrade"`
	UseStealthMode            bool          `json:"searchReplacer,omitempty"`
	PomFileIndentation        string        `json:"pomFileIndentation"`
	DisableUpgradesFor        []Artifact    `json:"disableUpgradesFor"`
	MaxSpringBootVersion      string        `json:"maxSpringBootVersion"`
	MaxVersionForDependencies []MaxArtifact `json:"maxVersionForDependencies"`
}

func (*ProjectSettings) DependencyIsIgnored

func (projectSettings *ProjectSettings) DependencyIsIgnored(dep pom.Dependency) bool

func (*ProjectSettings) MaxVersionFor

func (projectSettings *ProjectSettings) MaxVersionFor(dep pom.Dependency) string

func (*ProjectSettings) MergeProjectDefaults

func (projectSettings *ProjectSettings) MergeProjectDefaults(defaults CloudProjectDefaults)

func (*ProjectSettings) PluginIsIgnored

func (projectSettings *ProjectSettings) PluginIsIgnored(plugin pom.Plugin) bool

type ProjectType

type ProjectType interface {
	Type() ValidProjectType
	FilePath() string
	Model() *pom.Model
}

type SourceProvider

type SourceProvider struct {
	Host            string   `yaml:"host"`
	AccessToken     string   `yaml:"access_token"`
	ExcludeProjects []string `yaml:"exclude_projects"`
}

type TerminalConfig

type TerminalConfig struct {
	Width  int    `yaml:"width"`
	Format string `yaml:"format"`
}

type ValidProjectType

type ValidProjectType string
const (
	Maven ValidProjectType = "Maven"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL