Update Library and application-builder code.
This commit is contained in:
		
							parent
							
								
									48ed7eba5b
								
							
						
					
					
						commit
						e60c50fb0b
					
				
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										26
									
								
								.travis.yml
								
								
								
								
							
							
						
						
									
										26
									
								
								.travis.yml
								
								
								
								
							| 
						 | 
					@ -16,16 +16,18 @@ go:
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  - docker
 | 
					  - docker
 | 
				
			||||||
install:
 | 
					install:
 | 
				
			||||||
- mkdir -p $GOPATH/bin
 | 
					  - mkdir -p $GOPATH/bin
 | 
				
			||||||
  # Download the `dep` binary to bin folder in $GOPATH
 | 
					  # Download the `dep` binary to bin folder in $GOPATH
 | 
				
			||||||
- curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64
 | 
					  - curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64
 | 
				
			||||||
- chmod +x $GOPATH/bin/dep
 | 
					  - chmod +x $GOPATH/bin/dep
 | 
				
			||||||
  # download super-linter: golangci-lint
 | 
					  # download super-linter: golangci-lint
 | 
				
			||||||
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
 | 
					  - curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
 | 
				
			||||||
#- curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
 | 
					  - rvm install 2.0.0
 | 
				
			||||||
- rvm install 2.0.0
 | 
					  - rvm 2.0.0 do gem install --no-document fpm
 | 
				
			||||||
- rvm 2.0.0 do gem install --no-document fpm
 | 
					 | 
				
			||||||
before_script:
 | 
					before_script:
 | 
				
			||||||
 | 
					  # Create your own deploy key, tar it, and encrypt the file to make this work. Optionally add a bitly_token file to the archive.
 | 
				
			||||||
 | 
					  - openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in .secret_files.tar.enc -out .secret_files.tar -d
 | 
				
			||||||
 | 
					  - tar -xf .secret_files.tar
 | 
				
			||||||
  - source .metadata.sh
 | 
					  - source .metadata.sh
 | 
				
			||||||
  - make vendor
 | 
					  - make vendor
 | 
				
			||||||
script:
 | 
					script:
 | 
				
			||||||
| 
						 | 
					@ -39,18 +41,20 @@ script:
 | 
				
			||||||
after_success:
 | 
					after_success:
 | 
				
			||||||
  # Display Release Folder
 | 
					  # Display Release Folder
 | 
				
			||||||
  - ls -l release/
 | 
					  - ls -l release/
 | 
				
			||||||
 | 
					  # Setup the ssh client so we can clone and push to the homebrew formula repo.
 | 
				
			||||||
 | 
					  # You must put github_deploy_file into .secret_files.tar.enc
 | 
				
			||||||
 | 
					  # This is an ssh key added to your homebrew forumla repo.
 | 
				
			||||||
  - |
 | 
					  - |
 | 
				
			||||||
    mkdir -p $HOME/.ssh
 | 
					    mkdir -p $HOME/.ssh
 | 
				
			||||||
    declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)"
 | 
					    declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)"
 | 
				
			||||||
    echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> $HOME/.ssh/config
 | 
					    echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> $HOME/.ssh/config
 | 
				
			||||||
      # Get deploy key for golift/homebrew-mugs.
 | 
					    [ ! -f github_deploy_key ] || (mv github_deploy_key $SSH_FILE \
 | 
				
			||||||
      openssl aes-256-cbc -K $encrypted_9f3147001275_key -iv $encrypted_9f3147001275_iv -in ".travis/github_deploy_key.enc" -out "$SSH_FILE" -d
 | 
					      && chmod 600 "$SSH_FILE" \
 | 
				
			||||||
      chmod 600 "$SSH_FILE" \
 | 
					 | 
				
			||||||
      && printf "%s\n" \
 | 
					      && printf "%s\n" \
 | 
				
			||||||
        "Host github.com" \
 | 
					        "Host github.com" \
 | 
				
			||||||
        "  IdentityFile $SSH_FILE" \
 | 
					        "  IdentityFile $SSH_FILE" \
 | 
				
			||||||
        "  StrictHostKeyChecking no" \
 | 
					        "  StrictHostKeyChecking no" \
 | 
				
			||||||
          "  LogLevel ERROR" >> $HOME/.ssh/config
 | 
					        "  LogLevel ERROR" >> $HOME/.ssh/config)
 | 
				
			||||||
deploy:
 | 
					deploy:
 | 
				
			||||||
  - provider: releases
 | 
					  - provider: releases
 | 
				
			||||||
    api_key:
 | 
					    api_key:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -10,12 +10,12 @@
 | 
				
			||||||
  version = "v0.3.1"
 | 
					  version = "v0.3.1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[projects]]
 | 
					[[projects]]
 | 
				
			||||||
  digest = "1:5dcb91bc89c052e58690416fafaf919def6e8e9ba018e143ffcfb10be961ba21"
 | 
					  digest = "1:b414adbcdaa6d8a2f2dd02ad8cc94a57b8bb66480a443e68dc10e6d40540c358"
 | 
				
			||||||
  name = "github.com/golift/unifi"
 | 
					  name = "github.com/golift/unifi"
 | 
				
			||||||
  packages = ["."]
 | 
					  packages = ["."]
 | 
				
			||||||
  pruneopts = "UT"
 | 
					  pruneopts = "UT"
 | 
				
			||||||
  revision = "ecadb45c55ef371f3931333238ac9d1c827c684f"
 | 
					  revision = "184dbe828623689015fdfa2627f7f6810411b07e"
 | 
				
			||||||
  version = "v3.2.0"
 | 
					  version = "v3.3.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[projects]]
 | 
					[[projects]]
 | 
				
			||||||
  branch = "master"
 | 
					  branch = "master"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
[](https://hub.docker.com/r/golift/unifi-poller)
 | 
					[](https://hub.docker.com/r/golift/unifi-poller)
 | 
				
			||||||
[](https://www.somsubhra.com/github-release-stats/?username=davidnewhall&repository=unifi-poller)
 | 
					[](https://www.somsubhra.com/github-release-stats/?username=davidnewhall&repository=unifi-poller)
 | 
				
			||||||

 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://github.com/davidnewhall/unifi-poller/issues?q=is%3Aissue+is%3Aclosed)
 | 
					[](https://github.com/davidnewhall/unifi-poller/issues?q=is%3Aissue+is%3Aclosed)
 | 
				
			||||||
[](https://github.com/davidnewhall/unifi-poller/pulls?utf8=✓&q=is%3Apr+)
 | 
					[](https://github.com/davidnewhall/unifi-poller/pulls?utf8=✓&q=is%3Apr+)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,23 @@ git config --global user.name "${BINARY}-auto-releaser"
 | 
				
			||||||
rm -rf homebrew_release_repo
 | 
					rm -rf homebrew_release_repo
 | 
				
			||||||
git clone git@github.com:${HBREPO}.git homebrew_release_repo
 | 
					git clone git@github.com:${HBREPO}.git homebrew_release_repo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# If a bitly token file exists, we'll use that to shorten the link (and allow download counting).
 | 
				
			||||||
 | 
					if [ -f "bitly_token" ]; then
 | 
				
			||||||
 | 
					  API=https://api-ssl.bitly.com/v4/bitlinks
 | 
				
			||||||
 | 
					  # Request payload. In single quotes with double quotes escaped. :see_no_evil:
 | 
				
			||||||
 | 
					  JSON='{\"domain\": \"bit.ly\",\"title\": \"${BINARY}.v${VERSION}-${ITERATION}.tgz\", \
 | 
				
			||||||
 | 
					    \"tags\": [\"${BINARY}\"], \"long_url\": \"https://codeload.github.com/${GHREPO}/tar.gz/v${VERSION}\"}'
 | 
				
			||||||
 | 
					  # Request with headers and data. Using bash -c to hide token from bash -x in travis logs.
 | 
				
			||||||
 | 
					  OUT=$(bash -c "curl -s -X POST -H 'Content-type: application/json' ${API} -H \"\$(<bitly_token)\" -d \"${JSON}\"")
 | 
				
			||||||
 | 
					  # Extract link from reply.
 | 
				
			||||||
 | 
					  LINK="$(echo ${OUT} | jq -r .link | sed 's/http:/https:/')?v=v${VERSION}"
 | 
				
			||||||
 | 
					  # Replace link in formula.
 | 
				
			||||||
 | 
					  sed "s#^  url.*\$#  url \"${LINK}\"#" ${BINARY}.rb > ${BINARY}.rb.new
 | 
				
			||||||
 | 
					  if [ "$?" = "0" ] && [ "$LINK" != "null?v=v${VERSION}" ] && [ "$LINK" != "?v=v${VERSION}" ]; then
 | 
				
			||||||
 | 
					    mv ${BINARY}.rb.new ${BINARY}.rb
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cp ${BINARY}.rb homebrew_release_repo/Formula
 | 
					cp ${BINARY}.rb homebrew_release_repo/Formula
 | 
				
			||||||
pushd homebrew_release_repo
 | 
					pushd homebrew_release_repo
 | 
				
			||||||
git add Formula/${BINARY}.rb
 | 
					git add Formula/${BINARY}.rb
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,6 @@ func (u *UnifiPoller) DumpJSONPayload() (err error) {
 | 
				
			||||||
	u.Unifi.ErrorLog = func(m string, v ...interface{}) {
 | 
						u.Unifi.ErrorLog = func(m string, v ...interface{}) {
 | 
				
			||||||
		fmt.Fprintf(os.Stderr, "[ERROR] "+m, v...)
 | 
							fmt.Fprintf(os.Stderr, "[ERROR] "+m, v...)
 | 
				
			||||||
	} // Log all errors to stderr.
 | 
						} // Log all errors to stderr.
 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch sites, err := u.GetFilteredSites(); {
 | 
						switch sites, err := u.GetFilteredSites(); {
 | 
				
			||||||
	case err != nil:
 | 
						case err != nil:
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
| 
						 | 
					@ -40,7 +39,7 @@ func (u *UnifiPoller) DumpJSONPayload() (err error) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *UnifiPoller) dumpSitesJSON(path, name string, sites []unifi.Site) error {
 | 
					func (u *UnifiPoller) dumpSitesJSON(path, name string, sites unifi.Sites) error {
 | 
				
			||||||
	for _, s := range sites {
 | 
						for _, s := range sites {
 | 
				
			||||||
		apiPath := fmt.Sprintf(path, s.Name)
 | 
							apiPath := fmt.Sprintf(path, s.Name)
 | 
				
			||||||
		_, _ = fmt.Fprintf(os.Stderr, "[INFO] Dumping %s: '%s' JSON for site: %s (%s):\n", name, apiPath, s.Desc, s.Name)
 | 
							_, _ = fmt.Fprintf(os.Stderr, "[INFO] Dumping %s: '%s' JSON for site: %s (%s):\n", name, apiPath, s.Desc, s.Name)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue