Skip to content

Commit

Permalink
cross platform - macosx and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
npryce committed Feb 21, 2017
1 parent 756d1f3 commit 2fe20c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/adr-upgrade-repository
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ eval "$($(dirname $0)/adr-config)"
for f in $(adr list)
do
# Upgrade date format to ISO 8601
sed -E -i "" -e 's+Date: ([0-9]{2})/([0-9]{2})/([0-9]{4})+Date: \3-\2-\1+' "$f"
sed -E -e 's+Date: ([0-9]{2})/([0-9]{2})/([0-9]{4})+Date: \3-\2-\1+' "$f" > "$f.upgraded"
mv "$f.upgraded" "$f"
done
3 changes: 2 additions & 1 deletion tests/migrate-date-format.expected
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
doc/adr/0001-record-architecture-decisions.md
++ adr new With Old Date Format
+ adr_file=doc/adr/0002-with-old-date-format.md
+ sed -i '' -e 's+^Date: .*$+Date: 12/01/1992+' doc/adr/0002-with-old-date-format.md
+ sed -e 's+^Date: .*$+Date: 12/01/1992+' doc/adr/0002-with-old-date-format.md
+ mv doc/adr/0002-with-old-date-format.md.tmp doc/adr/0002-with-old-date-format.md
+ adr new With Current Date Format
doc/adr/0003-with-current-date-format.md
+ grep 'Date: ' doc/adr/0001-record-architecture-decisions.md doc/adr/0002-with-old-date-format.md doc/adr/0003-with-current-date-format.md
Expand Down
3 changes: 2 additions & 1 deletion tests/migrate-date-format.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
adr init
adr_file="`adr new With Old Date Format`"
sed -i "" -e 's+^Date: .*$+Date: 12/01/1992+' "$adr_file"
sed -e 's+^Date: .*$+Date: 12/01/1992+' "$adr_file" > "$adr_file.tmp"
mv "$adr_file.tmp" "$adr_file"
adr new With Current Date Format
grep 'Date: ' doc/adr/*
adr upgrade-repository
Expand Down

0 comments on commit 2fe20c2

Please sign in to comment.