Last active
August 29, 2015 14:16
-
-
Save layus/1b8926dcc4112aff29dd to your computer and use it in GitHub Desktop.
A script to refactor INGInious codebase for pip pacakging.
This file contains hidden or 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
| #!/bin/bash | |
| mod=(backend common frontend) | |
| mkdir inginious | |
| git mv templates static "${mod[@]}" inginious | |
| # fix all imports names | |
| sub='"s/\<\(backend\|common\|frontend\)\(\.\|\>\)/inginious.&/g"' | |
| find . -name '*.py' | parallel -m "sed -i $sub" | |
| parallel -m "sed -i.bak $sub" ::: configuration.json | |
| # copy modified files from branch 'egg' | |
| files=(setup.py app_frontend.py inginious/__init__.py) | |
| parallel 'wget -q https://raw.githubusercontent.com/layus/INGInious/egg-backup/{} -O {}' ::: "${files[@]}" | |
| # stage modifications | |
| find . -name '*.py' | parallel -m -j1 "git add" | |
| git add "${files[@]}" | |
| # Interact, then clean. | |
| sed -i "s#\./tasks#$(pwd)/tasks#" ./configuration.json | |
| bash | |
| git reset --hard HEAD | |
| git clean -df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment