Last active
December 21, 2015 04:58
-
-
Save afeijo/6252896 to your computer and use it in GitHub Desktop.
Bash script to create the skeleton files for a new Drupal 7 module
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 | |
# usage: download the script, place it in the modules folder, and execute with your new module name as the parameter. | |
# bash new_module.sh CustomModule | |
mkdir $1 | |
cd $1 | |
## .info file | |
echo "name = $1" > $1.info | |
echo "description = description" >> $1.info | |
echo "core = 7.x" >> $1.info | |
## .module file | |
echo "<?php" > $1.module | |
echo "" >> $1.module | |
echo "function $1_menu() {" >> $1.module | |
echo " \$items = array();" >> $1.module | |
echo " return \$items;" >> $1.module | |
echo "}" >> $1.module | |
## .install file | |
echo "<?php" > $1.install | |
echo "" >> $1.install | |
echo "function $1_install() {" >> $1.install | |
echo " " >> $1.install | |
echo "}" >> $1.install | |
echo "" >> $1.install | |
echo "function $1_uninstall() {" >> $1.install | |
echo " " >> $1.install | |
echo "}" >> $1.install | |
echo "$1 module created" | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment