Skip to content

Commit

Permalink
Merge branch 'develop', version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
machitgarha committed Aug 31, 2021
2 parents c5a7b24 + 01fb8c6 commit dc79b07
Show file tree
Hide file tree
Showing 23 changed files with 2,872 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The zip file generated by build-zip.sh
moodle-mod-gharar.zip

/vendor/
48 changes: 48 additions & 0 deletions bin/build-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

# Config
# Create a temporary directory to prevent conflictions
tmpDirname=".tmp"
pluginName="gharar"
outputFilename="moodle-mod-gharar.zip"

# Exit on error
set -e

mainRepoDir="$(dirname "$(realpath "$0")")/.."
tmpDir="$mainRepoDir/../$tmpDirname"

# The resulting file path
zipFilePath="$mainRepoDir/$outputFilename"

# Remove dev dependencies from vendor/ directory. Otherwise, the resulting file
# will be huge in size. For example, 80KB versus 17MB for the directory alone.
# At last, we will revert this change back.
echo "Removing Composer dev dependencies..."
composer --no-dev install > /dev/null 2>&1

mkdir -p "$tmpDir"
cd "$tmpDir"

# Make sure the resulting file includes only one directory matching plugin's name
rsync -av "$mainRepoDir/" "./$pluginName" \
--exclude ".git" --exclude ".gitignore" --exclude "bin/" \
--exclude "$outputFilename" > /dev/null

# Remove previous zip file to prevent extra removed files to remain there
if [[ -e "$zipFilePath" ]]; then
rm "$zipFilePath"
fi

# Create the zip file in the current directory
zip -r -y "$zipFilePath" "./$pluginName" > /dev/null

# Cleanup
cd "$mainRepoDir"
rm -r "$tmpDir"

echo "Zip file created successfully."

cd "$mainRepoDir"
echo "Re-adding Composer dev dependencies..."
composer install > /dev/null 2>&1
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "machitgarha/moodle-mod-gharar",
"description": "Gharar plugin for Moodle",
"type": "library",
"license": "GPLv3",
"authors": [
{
"name": "Mohammad Amin Chitgarha",
"email": "[email protected]",
"homepage": "https://github.com/machitgarha",
"role": "Creator"
}
],
"require": {
"php": "^7.2"
},
"require-dev": {
"vimeo/psalm": "^4.9",
"machitgarha/bimoo": "^3.11.1"
},
"autoload": {
"psr-4": {
"MAChitgarha\\MoodleModGharar\\": "src"
}
}
}
Loading

0 comments on commit dc79b07

Please sign in to comment.