From e26b291bd124b3d18271b1567af6e2f6366ee6db Mon Sep 17 00:00:00 2001 From: John Bryan Sazon Date: Wed, 25 Apr 2018 22:08:08 +0800 Subject: [PATCH] Refactor, docs update and directory update * Update documentation * Added the build number for the nexus folder creation for the assets * Added the download link to the html appicon image * Use log instead of fmt for printing output in cobra --- README.md | 20 +++++++++++--------- cmd/nexus.go | 3 +-- nexus/nexus_upload.go | 6 +++--- parser/templates.go | 3 ++- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 67512d7..9b5fb4c 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,13 @@ Upload an APK file to a Nexus Site Repository --destDir android \ --srcFile pkg/resources/DarkSouls.apk \ -uploaded to nexus: http://localhost:8081/repository/site/android/version.json -uploaded to nexus: http://localhost:8081/repository/site/android/1.0.0.10222333/index.html -uploaded to nexus: http://localhost:8081/repository/site/android/1.0.0.10222333/DarkSouls.apk +file uploaded: http://localhost:8081/repository/site/nexus_android_repo/1.0.0/10222333/appicon.png +file uploaded: http://localhost:8081/repository/site/nexus_android_repo/version.json +file uploaded: http://localhost:8081/repository/site/nexus_android_repo/1.0.0/10222333/index.html +file uploaded: http://localhost:8081/repository/site/nexus_android_repo/1.0.0/10222333/DarkSouls.apk ``` -You should now be able to install the APK file from your Android Phone by accessing the http://localhost:8081/repository/site/android/1.0.0.10222333/index.html URL. +Access the index.html file url from your Android device! Uploaded site structure @@ -61,13 +62,14 @@ Upload an IPA file to a Nexus Site Repository --destDir ios \ --srcFile pkg/resources/DarkSouls.ipa \ -uploaded to nexus: http://localhost:8081/repository/site/ios/version.json -uploaded to nexus: http://localhost:8081/repository/site/ios/1.0.0.1/DarkSouls.plist -uploaded to nexus: http://localhost:8081/repository/site/ios/1.0.0.1/index.html -uploaded to nexus: http://localhost:8081/repository/site/ios/1.0.0.1/DarkSouls.ipa +file uploaded: http://localhost:8081/repository/site/nexus_ios_repo/1.0.0/4/appicon.png +file uploaded: http://localhost:8081/repository/site/nexus_ios_repo/version.json +file uploaded: http://localhost:8081/repository/site/nexus_ios_repo/1.0.0/4/index.html +file uploaded: http://localhost:8081/repository/site/nexus_ios_repo/1.0.0/4/DarkSouls.ipa +file uploaded: http://localhost:8081/repository/site/nexus_ios_repo/1.0.0/4/app.plist ``` -You should now be able to install the IPA file from your iPhone by accessing the http://localhost:8081/repository/site/ios/1.0.0.1/index.html URL. +Access the index.html file url from your iPhone device! Uploaded site structure diff --git a/cmd/nexus.go b/cmd/nexus.go index da3dd3e..54b4b06 100644 --- a/cmd/nexus.go +++ b/cmd/nexus.go @@ -15,7 +15,6 @@ package cmd import ( - "fmt" "log" "os" @@ -39,7 +38,7 @@ var nexusCmd = &cobra.Command{ log.Fatal(err) } for _, v := range assets { - fmt.Println("nexus asset url:", v) + log.Println("file uploaded:", v) } }, } diff --git a/nexus/nexus_upload.go b/nexus/nexus_upload.go index 696f0de..707f773 100644 --- a/nexus/nexus_upload.go +++ b/nexus/nexus_upload.go @@ -56,9 +56,9 @@ func (n *Nexus) getRepoURL() string { // NexusUploadAssets uploads the generated files by the parser package along with the ipa or apk file func (n *Nexus) NexusUploadAssets(app *parser.MobileApp, dir string) ([]string, error) { // create the site path names and assume the url before uploaded for templating - appIconPath := app.Version + "/" + parser.AppIconFile - appSitePath := app.Version + "/" + filepath.Base(app.File) - appIndexHTMLSitePath := app.Version + "/" + parser.IndexHTMLFile + appIconPath := app.Version + "/" + app.Build + "/" + parser.AppIconFile + appSitePath := app.Version + "/" + app.Build + "/" + filepath.Base(app.File) + appIndexHTMLSitePath := app.Version + "/" + app.Build + "/" + parser.IndexHTMLFile app.DownloadURL = n.getRepoURL() + "/" + dir + "/" + appSitePath // default directory of assets diff --git a/parser/templates.go b/parser/templates.go index ba7128d..ed81f6e 100644 --- a/parser/templates.go +++ b/parser/templates.go @@ -92,9 +92,9 @@ var indexHTMLTemplateString = `

{{.Name}}

- {{if .IsIOS -}} +
@@ -109,6 +109,7 @@ var indexHTMLTemplateString = ` App is being installed. Close your Browser using the home button.

{{- else}} +