Merge branch 'master' into study/aws-ecr-1

This commit is contained in:
Erik Evenson 2016-02-29 07:18:33 -06:00
commit 019c650ee7
4 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,8 @@
## 0.3.1 (UNRELEASED)
BUG FIXES:
* client: Allow dashes in variable names during interprelation [GH-857]
## 0.3.0 ## 0.3.0
__BACKWARDS INCOMPATIBILITIES:__ __BACKWARDS INCOMPATIBILITIES:__

View file

@ -3,7 +3,7 @@ package args
import "regexp" import "regexp"
var ( var (
envRe = regexp.MustCompile(`\${[a-zA-Z0-9_\.]+}`) envRe = regexp.MustCompile(`\${[a-zA-Z0-9_\-\.]+}`)
) )
// ReplaceEnv takes an arg and replaces all occurences of environment variables. // ReplaceEnv takes an arg and replaces all occurences of environment variables.

View file

@ -13,6 +13,8 @@ const (
portVal = ":80" portVal = ":80"
periodKey = "NOMAD.PERIOD" periodKey = "NOMAD.PERIOD"
periodVal = "period" periodVal = "period"
dashKey = "NOMAD-DASH"
dashVal = "dash"
) )
var ( var (
@ -20,6 +22,7 @@ var (
ipKey: ipVal, ipKey: ipVal,
portKey: portVal, portKey: portVal,
periodKey: periodVal, periodKey: periodVal,
dashKey: dashVal,
} }
) )
@ -53,6 +56,16 @@ func TestArgs_ReplaceEnv_Period(t *testing.T) {
} }
} }
func TestArgs_ReplaceEnv_Dash(t *testing.T) {
input := fmt.Sprintf(`"${%v}"!`, dashKey)
exp := fmt.Sprintf("\"%s\"!", dashVal)
act := ReplaceEnv(input, envVars)
if !reflect.DeepEqual(act, exp) {
t.Fatalf("ReplaceEnv(%v, %v) returned %#v; want %#v", input, envVars, act, exp)
}
}
func TestArgs_ReplaceEnv_Chained(t *testing.T) { func TestArgs_ReplaceEnv_Chained(t *testing.T) {
input := fmt.Sprintf("${%s}${%s}", ipKey, portKey) input := fmt.Sprintf("${%s}${%s}", ipKey, portKey)
exp := fmt.Sprintf("%s%s", ipVal, portVal) exp := fmt.Sprintf("%s%s", ipVal, portVal)

View file

@ -5,9 +5,9 @@ var GitCommit string
var GitDescribe string var GitDescribe string
// The main version number that is being run at the moment. // The main version number that is being run at the moment.
const Version = "0.3.0" const Version = "0.3.1"
// A pre-release marker for the version. If this is "" (empty string) // A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release // then it means that it is a final release. Otherwise, this is a pre-release
// such as "dev" (in development), "beta", "rc1", etc. // such as "dev" (in development), "beta", "rc1", etc.
const VersionPrerelease = "" const VersionPrerelease = "dev"