#!/bin/sh
read -p '> Este projeto utilizará a plataforma WordPress? (s ou N) ' use_wp
if [ -d "`echo $HOME`/.node_modules" ]
then
read -p '> Node.js:'$'\n'' 1: Utilizar módulos em ~/.node_modules criando um link simbólico'$'\n'' 2: Iniciar novo projeto'$'\n'' (1 ou 2) ' node_modules_local
else
node_modules_local=2
fi
mkdir -p \
assets/src/img \
assets/src/css \
assets/src/less \
assets/src/js \
assets/src/font \
assets/dist/img \
assets/dist/css \
assets/dist/js \
assets/dist/font \
assets/vendor \
assets/lang \
lib/autoload \
templates
if [ "$use_wp" = 's' ]
then
mkdir -p \
lib/autoload-wp/admin \
lib/autoload-wp/no-admin \
lib/autoload-wp/off
touch \
style.css \
index.php \
header.php \
footer.php
fi
echo $'\n''> Estrutura de pastas criada.'$'\n'
if [ -f 'package.json' ]
then
npm update
else
if [ ! -d 'node_modules' ]
then
if [ "$node_modules_local" = '2' ]
then
npm init
npm install --save-dev \
bower
else
ln -s `echo $HOME`/.node_modules/ ./node_modules
fi
fi
fi
if [ -f 'node_modules/.bin/bower' ]
then
BOWER='./node_modules/.bin/bower'
else
if which bower > /dev/null
then
BOWER='bower'
fi
fi
if [ ! -z "$BOWER" ]
then
if [ -f 'bower.json' ]
then
$BOWER update
else
$BOWER init
fi
fi