Skip to content

Instantly share code, notes, and snippets.

@Y-Less
Created August 20, 2018 21:02
Show Gist options
  • Save Y-Less/5e2d8fa32c860b27d59423481519bbee to your computer and use it in GitHub Desktop.
Save Y-Less/5e2d8fa32c860b27d59423481519bbee to your computer and use it in GitHub Desktop.
File used to set remotes for all the YSI repos.
declare -a arr=(
"YSI-Coding/y_functional"
"YSI-Coding/y_hooks"
"YSI-Coding/y_inline"
"YSI-Coding/y_malloc"
"YSI-Coding/y_remote"
"YSI-Coding/y_stringhash"
"YSI-Coding/y_timers"
"YSI-Coding/y_unique"
"YSI-Coding/y_va"
"YSI-Core/y_als"
"YSI-Core/y_cell"
"YSI-Core/y_debug"
"YSI-Core/y_master"
"YSI-Core/y_profiling"
"YSI-Core/y_testing"
"YSI-Core/y_utils"
"YSI-Data/y_bintree"
"YSI-Data/y_bit"
"YSI-Data/y_foreach"
"YSI-Data/y_hashmap"
"YSI-Data/y_iterate"
"YSI-Data/y_jaggedarray"
"YSI-Data/y_playerarray"
"YSI-Data/y_playerset"
"YSI-Data/y_sortedarray"
"YSI-Data/y_sparsearray"
"YSI-Extra/y_extra"
"YSI-Extra/y_files"
"YSI-Extra/y_streamer_plugin"
"YSI-Game/y_vehicledata"
"YSI-Players/y_groups"
"YSI-Players/y_languages"
"YSI-Players/y_text"
"YSI-Players/y_users"
"YSI-Server/y_colors"
"YSI-Server/y_colours"
"YSI-Server/y_flooding"
"YSI-Server/y_lock"
"YSI-Server/y_punycode"
"YSI-Server/y_scriptinit"
"YSI-Server/y_stringise"
"YSI-Server/y_stringize"
"YSI-Server/y_td"
"YSI-Storage/y_amx"
"YSI-Storage/y_bitmap"
"YSI-Storage/y_ini"
"YSI-Storage/y_php"
"YSI-Storage/y_svar"
"YSI-Storage/y_uvar"
"YSI-Storage/y_xml"
"YSI-Visual/y_areas"
"YSI-Visual/y_classes"
"YSI-Visual/y_commands"
"YSI-Visual/y_dialog"
"YSI-Visual/y_loader"
"YSI-Visual/y_properties"
"YSI-Visual/y_races"
"YSI-Visual/y_zonenames"
#"YSI-Visual/y_zonepulse"
)
for i in ${arr[@]}
do
IFS='/' read -ra l <<< "$i"
echo "${l[0]}/${l[1]}"
cd "${l[0]}@${l[1]}"
#git remote remove origin
#git checkout -b dev
#git remote add origin "[email protected]:$i.git"
#git push -u origin dev
# git checkout dev
#git checkout 5.x
#git rm code-parse
#rm -rf .git/modules/code-parse
#git rm md-sort
#rm -rf .git/modules/md-sort
#git config -f .git/config --remove-section submodule.code-parse 2> /dev/null
#git config -f .git/config --remove-section submodule.md-sort 2> /dev/null
#git commit -a -m "Removed submodules"
#git push -u origin 5.x
#git rebase 5.x dev
#git checkout dev
#git push origin dev
#git branch -D 4.x
# Copy the readme stuff.
cp "../acronym.md" .
cp "../readme.md" .
cp "../YSI_COMPATIBILTY_MODE.md" .
cp "../installation.md" .
cp "../readme.md" .
cp "../.gitignore" .
cp "../.gitattributes" .
# Move the other readme back.
#mv "${l[0]}/README.md" "${l[0]}/${l[1]}.md"
# Modify the readme.
echo "# ${l[1]}" >> readme.md
echo "" >> readme.md
echo "[![sampctl](https://shields.southcla.ws/badge/sampctl-${l[1]}-2f2f2f.svg?style=for-the-badge)](https://github.com/${l[0]}/${l[1]})" >> readme.md
echo "" >> readme.md
echo "## Installation" >> readme.md
echo "" >> readme.md
echo "To install just this one library:" >> readme.md
echo "" >> readme.md
echo "\`\`\`bash" >> readme.md
echo "sampctl package install ${l[0]}/${l[1]}" >> readme.md
echo "\`\`\`" >> readme.md
echo "" >> readme.md
echo "Include in your code and begin using the library:" >> readme.md
echo "" >> readme.md
echo "\`\`\`pawn" >> readme.md
echo "#include <${l[0]}/${l[1]}>" >> readme.md
echo "\`\`\`" >> readme.md
echo "" >> readme.md
echo "## Usage" >> readme.md
echo "" >> readme.md
echo "[Click Here] (${l[0]}/${l[1]}.md)" >> readme.md
echo "" >> readme.md
echo "## Testing" >> readme.md
echo "" >> readme.md
echo "To test, simply run the package:" >> readme.md
echo "" >> readme.md
echo "\`\`\`bash" >> readme.md
echo "sampctl package run" >> readme.md
echo "\`\`\`" >> readme.md
echo "" >> readme.md
# Generate the sampctl pawn.json.
echo "{" > pawn.json
echo " \"user\": \"${l[0]}\"," >> pawn.json
echo " \"repo\": \"${l[1]}\"," >> pawn.json
echo " \"entry\": \"test.pwn\"," >> pawn.json
echo " \"output\": \"test.amx\"," >> pawn.json
echo " \"dependencies\": [" >> pawn.json
echo " ]" >> pawn.json
echo "}" >> pawn.json
echo "" >> pawn.json
# Generate the test script.
echo "// Enable the YSI internal tests." > test.pwn
echo "#define YSI_TESTS" >> test.pwn
echo "" >> test.pwn
echo "// Only print the report, don't print the failures." >> test.pwn
echo "#define LIGHT_TEST_REPORT" >> test.pwn
echo "" >> test.pwn
echo "// Fix many common issues." >> test.pwn
echo "#define YSI_NO_HEAP_MALLOC" >> test.pwn
echo "" >> test.pwn
echo "// Disable the master system - we aren't testing that here." >> test.pwn
echo "#define YSI_NO_MASTER" >> test.pwn
echo "" >> test.pwn
echo "// Close the server after finishing the tests." >> test.pwn
echo "#define TEST_AUTO_EXIT" >> test.pwn
echo "" >> test.pwn
echo "#pragma dynamic 65536" >> test.pwn
echo "" >> test.pwn
echo "#include \"${l[0]}\\${l[1]}.inc\"" >> test.pwn
echo "" >> test.pwn
echo "main()" >> test.pwn
echo "{" >> test.pwn
echo "}" >> test.pwn
echo "" >> test.pwn
git add "acronym.md"
git add "readme.md"
git add "YSI_COMPATIBILTY_MODE.md"
git add "installation.md"
git add ".gitignore"
git add ".gitattributes"
git add "${l[0]}/${l[1]}.md"
git add test.pwn
git add pawn.json
git checkout 5.x
git commit -a -m "Added sampctl, github, git, and documentation files."
git push origin 5.x
git rebase 5.x dev
git checkout dev
git push origin dev
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment