G2A Many GEOs
SHARE
TWEET

turnitin.sh

a guest Apr 7th, 2020 326 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Creates a commit for turning items in. Does not automatically push.
  2.  
  3. set -eu; # Exit script upon failure (bash's "strict" mode), unset variables are dangerous
  4. submission_directory='./submission'; # Config submission directory here
  5.  
  6. # Switch to master branch
  7. current_branch=$(git branch);
  8. on_master='* master';
  9. if [[ "$current_branch" != *"$on_master"* ]];
  10. then
  11.   printf "Not on master branch. Switching to master branch..."
  12.   git checkout -f master
  13. fi
  14.  
  15. # Remove submission directory if it exists.
  16. if [[ -d "$submission_directory" ]];
  17. then
  18.   printf "Found existing submission directory located at: %s...\n" $submission_directory
  19.   rm -r "$submission_directory";
  20.   printf "Submission directory deleted.\n"
  21. fi
  22.  
  23. # Create submission "build" directory
  24. printf "\nMaking submission directory...\n";
  25. mkdir "$submission_directory";
  26. printf "Directory made at %s\n" $submission_directory;
  27.  
  28. # Copy relevant files to submission directory / TODO: change these to fit your directory structure
  29. printf "\nCopying relevant files...\n"
  30. cp -v src/*.js "$submission_directory"; # client-side React code
  31. cp -v src/*.css "$submission_directory"; # client-side stylesheets
  32. cp -v backend/*.js "$submission_directory"; # server-side backend auxiliary classes
  33. cp -v server.js "$submission_directory"; # server-side Express code
  34.  
  35. # Remove individual blacklisted files / TODO: change these to fit your directory structure
  36. printf "\nRemoving extraneous files..."
  37. rm -v "$submission_directory"/index.*; # do not submit index-related files
  38. rm -v "$submission_directory"/setupTests.js; # do not submit test config
  39. rm -v "$submission_directory"/serviceWorker.js; # do not submit service worker
  40. rm -v "$submission_directory"/*.test.js; # do not submit tests
  41.  
  42. printf "\nSubmission directory created. Located at: %s\n" $submission_directory;
  43.  
  44. printf "\nRemoving everything else from the root directory from GIT...\n";
  45. git rm -r --cached . --ignore-unmatch;
  46.  
  47. printf "\nAdding everything from submission directory to Git";
  48. git add -fv $submission_directory;
  49.  
  50. printf "\nMoving added files to root level"
  51. git mv -fv $submission_directory/* ./;
  52. git add server.js;
  53.  
  54. print "\nCommitting changes...";
  55. commits_ahead=$(git rev-list --left-right --count origin/master...master | awk '{print $2}');
  56. if [[ commits_ahead -lt 1 ]]; then
  57.   printf "\nCommit not detected. Making commit...\n";
  58.   git commit -m "Turning in files for submission to HW8";
  59. else
  60.   printf "\nCommit detected. Overwriting commit...\n";
  61.   git commit --amend --no-edit;
  62. fi
  63.  
  64. # you will need to push on your own.
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top