Merge pull request #3 from marcusholl/pr/handleSpaceWithSedCommand

handle space within sed command
This commit is contained in:
kbarnold
2017-11-13 13:25:37 +01:00
committed by GitHub
2 changed files with 6 additions and 11 deletions
+5 -10
View File
@@ -84,8 +84,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@@ -108,8 +107,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@@ -134,8 +132,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute(newDirName)
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/newDir\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@@ -155,8 +152,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
@@ -177,8 +173,7 @@ public class MTABuildTest extends BasePipelineTest {
def script = loadScript(pipeline)
def mtarFilePath = script.execute()
assert shellCalls[0].startsWith('sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ')
assert shellCalls[0].endsWith('/mta.yaml')
assert shellCalls[0] =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" ".*\/mta.yaml"$/
assert shellCalls[1].contains("PATH=./node_modules/.bin:/usr/bin")
+1 -1
View File
@@ -20,7 +20,7 @@ def call(Map parameters = [:]) {
def mtaYaml = readYaml file: "${pwd()}/mta.yaml"
//[Q]: Why not yaml.dump()? [A]: This reformats the whole file.
sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" ${pwd()}/mta.yaml"
sh "sed -ie \"s/\\\${timestamp}/`date +%Y%m%d%H%M%S`/g\" \"${pwd()}/mta.yaml\""
def id = mtaYaml.ID
if (!id) {