#18: Add utilities for assisting with common migration logic #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add: file utils, common utils for use in migration logic by users
Working example for using utils to write a migration
Update docs to mention utils
BDDs
Scenario: I can leverage migration utilities from Baton in my custom migration implementations
** Given I have created a new baton migration that imports the baton utils class
** And the util methods are used or extended inside the custom migration
** When The migration runs
** Then The the migration should finish successfully
Scenario: I want to easily replace a string in a file using a regex expression
** Given I have a file containing the string "123abc456"
** When I use the regex "(?<=123).*(?=456)" to substitute "def"
** Then the file should now contain the string "123def456"
Scenario: I want to easily replace a substring of a string in a file using a regex expression
** Given I have a file containing the string "123abc456"
** When I use the regex "123.*456" to substitute "abc" with "def"
** Then the file should now contain the string "123def456"
Scenario: I want to easily test if a string is present in a file using a regex expression
** Given I have a file containing the string "123abc456"
** When I use the regex "123.*456" to search for matches in a file
** Then the match result should be "true"
Scenario: I want to easily be able to pull out specific substrings from a string using regex capture groups
** Given I have a string containing "123abc456"
** When I use the regex "123(.*)456" to retrieve capture groups
** Then the size of the retrieved capture groups should be "1"
** And the capture groups should include
|abc|
Scenario: I want to easily be able to pull out specific strings from a file using regex capture groups
** Given I have a file containing the string "123abc456"
** When I use the regex "(123).*(456)" to retrieve capture groups
** Then the size of the retrieved capture groups should be "2"
** And the capture groups should include
|123|
|456|
Test Steps
git clone [email protected]:TechnologyBrewery/baton
mvn clean install -Pbootstrap -Dmaven.build.cache.enabled=false
mvn clean install -Pdefault -Dmaven.build.cache.enabled=false