-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to update expected files for test sites
Developers have to update the expected folder for test sites by hand. Updating the expected folders for each site manually becomes especially unwieldy as the number of test sites increase. Let's have a script which automates the updating of expected folders in all of the test sites.
- Loading branch information
Marvin Chin
committed
Apr 12, 2019
1 parent
1aab519
commit 45cc920
Showing
3 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@ECHO off | ||
|
||
for /f "tokens=* delims=" %%a in (test_sites) do ( | ||
|
||
echo( | ||
echo Updating %%a | ||
|
||
node ../../index.js build %%a | ||
|
||
rmdir /s /q %%a\expected | ||
xcopy /e /y /i /q %%a\_site %%a\expected | ||
) | ||
|
||
for /f "tokens=* delims=" %%a in (test_convert_sites) do ( | ||
|
||
echo( | ||
echo Updating %%a | ||
|
||
node ../../index.js init %%a\non_markbind_site -c | ||
|
||
node ../../index.js build %%a\non_markbind_site | ||
|
||
rmdir /s /q %%a\expected | ||
xcopy /e /y /i /q %%a\non_markbind_site\_site %%a\expected | ||
|
||
rmdir /s /q %%a\_site | ||
rmdir /q %%a\non_markbind_site\_markbind | ||
rmdir /s /q %%a\non_markbind_site\_site | ||
del %%a\non_markbind_site\about.md %%a\non_markbind_site\index.md %%a\non_markbind_site\site.json | ||
) | ||
|
||
echo Updated all test sites | ||
exit /b %errorlevel% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
for site in $(cat test_sites); | ||
do | ||
# print site name | ||
echo "Updating $site" | ||
|
||
# build site | ||
node ../../index.js build "$site" | ||
|
||
# replace the expected folder with the newly generated files | ||
rm -rf $site/expected | ||
cp -r $site/_site $site/expected | ||
done | ||
|
||
function cleanup_convert { | ||
# delete generated files | ||
rm -rf $site_convert/_site | ||
rm -rf $site_convert/non_markbind_site/_markbind $site_convert/non_markbind_site/_site | ||
rm -f $site_convert/non_markbind_site/about.md $site_convert/non_markbind_site/index.md "$site_convert"/non_markbind_site/site.json | ||
} | ||
|
||
for site_convert in $(cat test_convert_sites); | ||
do | ||
# print site name | ||
echo "Updating $site_convert test" | ||
|
||
# set cleanup trap | ||
trap cleanup_convert EXIT | ||
|
||
# convert site | ||
node ../../index.js init $site_convert/non_markbind_site -c | ||
|
||
# build site | ||
node ../../index.js build $site_convert/non_markbind_site | ||
|
||
# replace the expected folder with the newly generated files | ||
rm -rf $site_convert/expected | ||
cp -r $site_convert/non_markbind_site/_site $site_convert/expected | ||
|
||
# cleanup generated files | ||
cleanup_convert | ||
|
||
# remove trap | ||
trap - EXIT | ||
done | ||
|
||
echo "Updated all test sites" | ||
exit 0 |