MCPcopy Index your code
hub / github.com/cloudfoundry/multiapps-cli-plugin / getMtaArchive

Method getMtaArchive

commands/deploy_command.go:639–664  ·  view source on GitHub ↗
(parsedArguments []string, mtaElementsCalculator mtaElementsToAddCalculator)

Source from the content-addressed store, hash-verified

637}
638
639func (c *DeployCommand) getMtaArchive(parsedArguments []string, mtaElementsCalculator mtaElementsToAddCalculator) (interface{}, error) {
640 if len(parsedArguments) == 0 {
641 fileUrl := c.tryReadingFileUrl()
642 if len(fileUrl) > 0 {
643 return url.Parse(fileUrl)
644 }
645
646 currentWorkingDirectory, err := os.Getwd()
647 if err != nil {
648 return "", fmt.Errorf("Could not get the current working directory: %s", err.Error())
649 }
650 return buildMtaArchiveFromDirectory(currentWorkingDirectory, mtaElementsCalculator)
651 }
652
653 mtaArgument := parsedArguments[0]
654 fileInfo, err := os.Stat(mtaArgument)
655 if err != nil && os.IsNotExist(err) {
656 return "", fmt.Errorf("Could not find MTA %s", mtaArgument)
657 }
658
659 if !fileInfo.IsDir() {
660 return mtaArgument, nil
661 }
662
663 return buildMtaArchiveFromDirectory(mtaArgument, mtaElementsCalculator)
664}
665
666func (c *DeployCommand) tryReadingFileUrl() string {
667 stat, err := c.FileUrlReader.Stat()

Callers 1

executeInternalMethod · 0.95

Calls 6

tryReadingFileUrlMethod · 0.95
StatMethod · 0.80
IsDirMethod · 0.80
ParseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected