Created
December 14, 2020 15:48
-
-
Save ipranjal/6f7be87046f5dc9a41f751cd52cb3662 to your computer and use it in GitHub Desktop.
Bash Script for generating Elgg plugin skeleton [2.x - 3.x]
This file contains 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 | |
#name: pluginSkeleton | |
#author: Pranjal Pandey | |
#Installation: Put file in root folder | |
#usage ./pluginSkeleton <pluginName> | |
if [ $# -eq 0 ]; then | |
echo "Plugin Name is Missing" | |
else | |
echo mkdir -p "mod/$1/actions/$1/" | bash -x | |
echo mkdir -p "mod/$1/classes/" | bash -x | |
echo mkdir -p "mod/$1/languages/" | bash -x | |
echo mkdir -p "mod/$1/vendors/" | bash -x | |
echo mkdir -p "mod/$1/views/default/$1/" | bash -x | |
echo mkdir -p "mod/$1/views/default/forms/$1/" | bash -x | |
echo mkdir -p "mod/$1/views/default/object/" | bash -x | |
echo mkdir -p "mod/$1/views/default/plugins/$1/" | bash -x | |
echo mkdir -p "mod/$1/views/default/resources/$1/" | bash -x | |
echo mkdir -p "mod/$1/views/default/widgets/$1_widget/" | bash -x | |
echo touch "mod/$1/start.php" | bash -x | |
echo touch "mod/$1/elgg-plugin.php" | bash -x | |
echo touch "mod/$1/manifest.xml" | bash -x | |
echo -e "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plugin_manifest xmlns=\"http://www.elgg.org/plugin_manifest/1.8\">\n\t<name>Example Plugin</name>\n\t<id>$1</id>\n\t<description>This is a simple example of a manifest file. </description>\n\t<author>your name</author>\n\t<version>1.0</version>\n\t<requires>\n\t\t<type>elgg_release</type>\n\t\t<version>3.3</version>\n\t</requires>\n</plugin_manifest>" >> "mod/$1/manifest.xml" | |
echo -e "<?php \n | |
return function () { | |
elgg_register_event_handler('init', 'system', '$1_init'); | |
};\n | |
function $1_init() | |
{\n | |
} | |
" >> "mod/$1/start.php" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dropped you a message