<commit_before>#!/bin/bash

#####################################################################################
# nwf application init script
# author: elvin
# date: 2017-2-27
# desc: this script will initialize nwf application automatically
#####################################################################################


if [ $# -ne 1 ] ; then
	echo "USAGE: sh nwf_init.sh 'project-name'"
	exit 1;
fi
pn=$1

cd $(cd $(dirname $0) && pwd -P)
if [ ! -d "$pn" ]; then
        mkdir "$pn"
fi
cd $pn
if [ -f ".nwf/init_flag" ]; then
	cat .nwf/init_flag
	exit 1
fi

echo start initialize NPL Web application...
echo project name: $pn

if [ ! -d ".git" ]; then
	git init 
fi
if [ ! -d "npl_packages" ]; then
	mkdir "npl_packages"
fi
if [ ! -f "npl_packages/main/README.md" ]; then
	git submodule add https://github.com/NPLPackages/main npl_packages/main
fi
if [ ! -f "npl_packages/nwf/README.md" ]; then
	git submodule add https://github.com/elvinzeng/nwf.git npl_packages/nwf
fi
cd npl_packages/main && git pull
cd ../nwf && git pull
cd ../../

cp npl_packages/nwf/resources/config/gitignore .gitignore
cp npl_packages/nwf/resources/config/module_source_repos.conf module_source_repos.conf
find npl_packages/nwf/resources/scripts/ ! -name "_*.sh" -type f -exec cp {} . \;

if [ ! -d "www" ]; then
	mkdir "www"
fi

if [ ! -d "lib/so" ]; then
	mkdir "lib/so" -p
fi

if [ ! -d "lib/dll" ]; then
	mkdir "lib/dll" -p
fi

cp npl_packages/nwf/resources/lua/* www/
cp npl_packages/nwf/resources/config/webserver.config.xml www/
if [ ! -d "www/modules" ]; then
	mkdir www/modules
fi
cp -r npl_packages/nwf/resources/demo/* www/

mkdir .nwf
echo "do not run init script again! project already initialized at: $(date '+%F %T')" > .nwf/init_flag<commit_msg>update project init script, hide some files on Windows.<commit_after>#!/bin/bash

#####################################################################################
# nwf application init script
# author: elvin
# date: 2017-2-27
# desc: this script will initialize nwf application automatically
#####################################################################################


if [ $# -ne 1 ] ; then
	echo "USAGE: sh nwf_init.sh 'project-name'"
	exit 1;
fi
pn=$1

cd $(cd $(dirname $0) && pwd -P)
if [ ! -d "$pn" ]; then
        mkdir "$pn"
fi
cd $pn
if [ -f ".nwf/init_flag" ]; then
	cat .nwf/init_flag
	exit 1
fi

echo start initialize NPL Web application...
echo project name: $pn

if [ ! -d ".git" ]; then
	git init 
fi
if [ ! -d "npl_packages" ]; then
	mkdir "npl_packages"
fi
if [ ! -f "npl_packages/main/README.md" ]; then
	git submodule add https://github.com/NPLPackages/main npl_packages/main
fi
if [ ! -f "npl_packages/nwf/README.md" ]; then
	git submodule add https://github.com/elvinzeng/nwf.git npl_packages/nwf
fi
cd npl_packages/main && git pull
cd ../nwf && git pull
cd ../../

cp npl_packages/nwf/resources/config/gitignore .gitignore
cp npl_packages/nwf/resources/config/module_source_repos.conf module_source_repos.conf
find npl_packages/nwf/resources/scripts/ ! -name "_*.sh" -type f -exec cp {} . \;

if [ ! -d "www" ]; then
	mkdir "www"
fi

if [ ! -d "lib/so" ]; then
	mkdir "lib/so" -p
fi

if [ ! -d "lib/dll" ]; then
	mkdir "lib/dll" -p
fi

cp npl_packages/nwf/resources/lua/* www/
cp npl_packages/nwf/resources/config/webserver.config.xml www/
if [ ! -d "www/modules" ]; then
	mkdir www/modules
fi
cp -r npl_packages/nwf/resources/demo/* www/

mkdir .nwf
echo "do not run init script again! project already initialized at: $(date '+%F %T')" > .nwf/init_flag

bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh npl_packages
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh ".nwf"
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh ".gitmodules"
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh ".gitignore"
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh "restart_debug.sh"
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh "shutdown.sh"
bash npl_packages/nwf/resources/scripts/_hide_file_on_win.sh "start.sh"

{'fraction_non_alphanumeric': 0.21590349581486953, 'fraction_numerical': 0.005908419497784343, 'mean_word_length': 4.07875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 14, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6407601', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1443, 'n_words': 384}