0

When I run the build, I want to search for a config key rollbackversion in a config file and replace the value against it (null) with the current branch of the deployment server (prior to rollout). This is how I am storing the values -

destination = /home/sandeepan/mock_del_servers/box1
rollbackbranch = null

I already found ways to find and replace a value, but that is not what I am looking for. I want to specify a key and replace the value against it.

find replace text in file with Phing

How can I conditionally replace tokens in a config file with Capistrano or Phing?

Community
  • 1
  • 1
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144

1 Answers1

-1

I could not find any solution which is kind of more native to phing, but this regex which does the replacement, and put it in phing's replaceregexp filter -

<reflexive>
            <fileset dir="config/">
                <include pattern="generic.build.properties" />
            </fileset>
            <filterchain>
                <replaceregexp>
                    <regexp pattern="(rollbackbranch[\s]*=[\s]*)[a-z]*(\n)" replace="REPLACEMENT"/>
                </replaceregexp>
            </filterchain>
</reflexive>
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144