config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetActiveProfilePath added in v0.5.0

func GetActiveProfilePath() (string, error)

func GetCoPilotHomePath added in v0.5.0

func GetCoPilotHomePath() (string, error)

func GetProfilesPath added in v0.5.0

func GetProfilesPath() (string, error)

func GetProfilesPathFor added in v0.5.1

func GetProfilesPathFor(profile string) (string, error)

func InstallOrMigrateToProfiles added in v0.5.4

func InstallOrMigrateToProfiles() error

func ProjectConfigPath

func ProjectConfigPath(targetDir string) string

func SetLogger

func SetLogger(logger logrus.FieldLogger)

func SwitchProfile added in v0.5.0

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)
}

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 added in v0.4.4

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 Context

type Context struct {
	Recursive       bool
	DryRun          bool
	TargetDirectory string
	DisableGit      bool
	ForceCloudSync  bool
	OpenInBrowser   bool
	Projects        []Project
	Err             error
	ProfilesPath    string
	LocalConfig     LocalConfig
	CloudConfig     CloudConfig
}

func (*Context) FindAndPopulateMavenProjects

func (ctx *Context) FindAndPopulateMavenProjects() error

func (*Context) LoadProfile added in v0.6.0

func (ctx *Context) LoadProfile(profilePath string)

func (Context) OnEachProject

func (ctx Context) OnEachProject(description string, do ...func(project Project) error)

func (Context) OnRootProject added in v0.4.0

func (ctx Context) OnRootProject(description string, do ...func(project Project) error)

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 added in v0.5.0

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 added in v0.6.0

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

func (GitCloudConfig) GitHookFiles added in v0.4.6

func (gitCfg GitCloudConfig) GitHookFiles(path string) ([]string, 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 added in v0.4.4

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
	DisableCommit bool
}

func GetGitInfoFromPath

func GetGitInfoFromPath(targetDir string) (gitInfo GitInfo, err error)
type Links struct {
	Href      string `json:"href"`
	Title     string `json:"title,omitempty"`
	Templated bool   `json:"templated"`
}

type LocalConfig

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

func NewLocalConfig

func NewLocalConfig(absConfigDir string) (cfg LocalConfig)

func (LocalConfig) CheckOrCreateConfigDir

func (localCfg LocalConfig) CheckOrCreateConfigDir() error

func (LocalConfig) Config

func (localCfg LocalConfig) Config() (LocalConfiguration, error)

func (LocalConfig) Exists

func (localCfg LocalConfig) Exists() bool

func (LocalConfig) FilePath

func (localCfg LocalConfig) FilePath() string

func (LocalConfig) Implementation

func (localCfg LocalConfig) Implementation() DirConfig

func (LocalConfig) Print

func (localCfg LocalConfig) Print() error

func (LocalConfig) TouchFile

func (localCfg LocalConfig) TouchFile() 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"`
}

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 added in v0.4.4

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

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 added in v0.6.0

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"`
	} `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 added in v0.3.11

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"`
	DisableUpgradesFor        []Artifact    `json:"disableUpgradesFor"`
	MaxVersionForDependencies []MaxArtifact `json:"maxVersionForDependencies"`
}

func (ProjectSettings) DependencyIsIgnored

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

func (ProjectSettings) MaxVersionFor added in v0.4.4

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

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 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