Ejemplo n.º 1
0
func searchInArtifactory(specFile string) (result []commands.SearchResult, err error) {
	searchFlags := new(commands.SearchFlags)
	searchFlags.ArtDetails = artifactoryDetails
	searchSpec, _ := utils.CreateSpecFromFile(specFile)
	result, err = commands.Search(searchSpec, searchFlags)
	return
}
Ejemplo n.º 2
0
func getPathsToDelete(specFile string) []utils.AqlSearchResultItem {
	flags := new(commands.DeleteFlags)
	flags.ArtDetails = artifactoryDetails
	deleteSpec, _ := utils.CreateSpecFromFile(specFile)
	artifactsToDelete, _ := commands.GetPathsToDelete(deleteSpec, flags)
	return artifactsToDelete
}
Ejemplo n.º 3
0
func getSearchSpec(c *cli.Context) (searchSpec *utils.SpecFiles, err error) {
	searchSpec, err = utils.CreateSpecFromFile(c.String("spec"))
	if err != nil {
		return
	}
	//Override spec with CLI options
	for i := 0; i < len(searchSpec.Files); i++ {
		overrideStringIfSet(&searchSpec.Get(i).Props, c, "props")
		overrideStringIfSet(&searchSpec.Get(i).Recursive, c, "recursive")
	}
	return
}
Ejemplo n.º 4
0
func getDownloadSpec(c *cli.Context) (downloadSpec *utils.SpecFiles, err error) {
	downloadSpec, err = utils.CreateSpecFromFile(c.String("spec"))
	if err != nil {
		return
	}
	fixWinDownloadFilesPath(downloadSpec)
	//Override spec with CLI options
	for i := 0; i < len(downloadSpec.Files); i++ {
		downloadSpec.Get(i).Pattern = strings.TrimPrefix(downloadSpec.Get(i).Pattern, "/")
		overrideStringIfSet(&downloadSpec.Get(i).Props, c, "props")
		overrideStringIfSet(&downloadSpec.Get(i).Flat, c, "flat")
		overrideStringIfSet(&downloadSpec.Get(i).Recursive, c, "recursive")
	}
	return
}
Ejemplo n.º 5
0
func getUploadSpec(c *cli.Context) (uploadSpec *utils.SpecFiles, err error) {
	uploadSpec, err = utils.CreateSpecFromFile(c.String("spec"))
	if err != nil {
		return
	}
	fixWinUploadFilesPath(uploadSpec)
	//Override spec with CLI options
	for i := 0; i < len(uploadSpec.Files); i++ {
		uploadSpec.Get(i).Target = strings.TrimPrefix(uploadSpec.Get(i).Target, "/")
		overrideStringIfSet(&uploadSpec.Get(i).Props, c, "props")
		overrideStringIfSet(&uploadSpec.Get(i).Flat, c, "flat")
		overrideStringIfSet(&uploadSpec.Get(i).Recursive, c, "recursive")
		overrideStringIfSet(&uploadSpec.Get(i).Regexp, c, "regexp")
	}
	return
}
Ejemplo n.º 6
0
func cleanArtifactory() {
	deleteFlags := new(commands.DeleteFlags)
	deleteFlags.ArtDetails = artifactoryDetails
	deleteSpec, _ := utils.CreateSpecFromFile(tests.GetFilePath(tests.DeleteSpec))
	commands.Delete(deleteSpec, deleteFlags)
}