Closed metasean closed 9 years ago
@UndeadBaneGitHub can you provide some info and maybe even create PRs for some docs of the new subgenerators?
@ilanbiala Sure!
@junit38 this version works properly (the actual version of meanjs contains also some /admin folders etc) -> that means we have to go 1 level deeper for the rm and the rename of files ;-)
Thanks for your original script, it saves me a lot of time every day!
var=$1
if [ -n "$var" ]; then
CRUDNAME=$1
CRUDNAMEUPPERCASE=`echo ${CRUDNAME:0:1} | tr '[a-z]' '[A-Z]'`${CRUDNAME:1}
FOLDERNAME=$CRUDNAME's'
# Create new folder
cp -R modules/articles modules/$FOLDERNAME
# Do the find/replace in all the files
find modules/$FOLDERNAME -type f -print0 | xargs -0 sed -i -e 's/Article/'$CRUDNAMEUPPERCASE'/g'
find modules/$FOLDERNAME -type f -print0 | xargs -0 sed -i -e 's/article/'$CRUDNAME'/g'
# Delete useless files due to sed
rm modules/$FOLDERNAME/**/*-e
rm modules/$FOLDERNAME/**/**/*-e
rm modules/$FOLDERNAME/**/**/**/*-e
# Rename all the files
for file in modules/$FOLDERNAME/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
for file in modules/$FOLDERNAME/**/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
for file in modules/$FOLDERNAME/**/**/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
else
echo "Usage: sh rename-module.sh [crud-name]"
fi
@benobab You'r welcome !
Thanks for the improvement.
Easy way to do this in ubuntu: Please follow these instructions....
# copy the **article** module and rename as **customers**
# open terminal inside your project(meanjs)
# modify these two variables as like below
# copy all the below code and paste it to the terminal
CRUDNAME="customer"
CRUDNAMEUPPERCASE="Customer"
FOLDERNAME=$CRUDNAME's'
# Do the find/replace in all the files
find modules/$FOLDERNAME -type f -print0 | xargs -0 sed -i -e 's/Article/'$CRUDNAMEUPPERCASE'/g'
find modules/$FOLDERNAME -type f -print0 | xargs -0 sed -i -e 's/article/'$CRUDNAME'/g'
# Rename all the files
for file in modules/$FOLDERNAME/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
for file in modules/$FOLDERNAME/**/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
for file in modules/$FOLDERNAME/**/**/**/*article* ; do mv $file ${file//article/$CRUDNAME} ; done
I've got a new 0.4.0 MEAN.js app.
When I try to generate a new crud-module named "meets" by running:
I am greeted by:
Moved from https://github.com/meanjs/mean/issues/437