Пример #1
0
func (appGallery *AppGallery) resolveAppDir(bootDescriptor descriptors.AppDescriptor) (appDir string) {
	baseURL := bootDescriptor.GetDeclaredBaseURL()

	hostComponent := strings.Replace(baseURL.Host, ":", "_", -1)

	appDirComponents := []string{
		appGallery.Directory,
		hostComponent}

	trimmedBasePath := strings.Trim(baseURL.Path, "/")
	baseComponents := strings.Split(trimmedBasePath, "/")

	appDirComponents = append(appDirComponents, baseComponents...)

	if hostComponent == "github.com" &&
		len(appDirComponents) > 2 &&
		appDirComponents[len(appDirComponents)-2] == "releases" &&
		appDirComponents[len(appDirComponents)-1] == "latest" {
		appDirComponents = appDirComponents[0 : len(appDirComponents)-2]
	}

	appDir = filepath.Join(appDirComponents...)

	return appDir
}
Пример #2
0
func FormatSecureFirstRunPrompt(bootDescriptor descriptors.AppDescriptor) string {
	const basicFirstRunTemplate = "You are running an application for the first time." +
		"\n\n\nTitle:   %v" +
		"\n\nPublisher:   %v" +
		"\n\nAddress:   %v\n\n\nDo you wish to proceed?"

	return fmt.Sprintf(basicFirstRunTemplate,

		bootDescriptor.GetTitle(),
		bootDescriptor.GetPublisher(),
		bootDescriptor.GetDeclaredBaseURL())
}