Skip to content

Instantly share code, notes, and snippets.

@grantwinney
Last active August 7, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantwinney/2cd7e963873b0a206b9d5c1582ee0fa2 to your computer and use it in GitHub Desktop.
Save grantwinney/2cd7e963873b0a206b9d5c1582ee0fa2 to your computer and use it in GitHub Desktop.
A script to make mentoring C# solutions on Exercism a little easier
#!/bin/bash
### check for proper usage
if [ $# -ne 1 ]; then
echo $0: usage: uuid_for_solution
exit 1
fi
cd ~
### download solution
local_solution_path=`exercism download --uuid=$1` # where exercism downloaded solution
printf "$local_solution_path\n\n"
### append '_orig' to original file name; rename user's solution that starts with \\
cd $local_solution_path
find . -name '\\\\*.cs' | while read fname; do
norm_name=`echo "$fname" | tr -d '\\'`
mv "$norm_name" "$norm_name"_orig
mv "\\`basename $fname`" "$norm_name"
done
### enable all tests (remove skip attribute)
sed -i '' 's/(Skip = "Remove to run test")//g' *Test.cs
### opt out of data collection and trust the ASP.NET Core HTTPS Development Certificate
export DOTNET_CLI_TELEMETRY_OPTOUT='true' # https://aka.ms/dotnet-cli-telemetry
dotnet dev-certs https --trust # https://go.microsoft.com/fwlink/?linkid=848054
# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?tabs=netcore21#additional-tools
### run tests and open the solution (add -n to open a new window)
dotnet test # https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test
open $local_solution_path/*.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment