Java additions
This commit is contained in:
parent
de3819015e
commit
e1ef52f53f
3 changed files with 39 additions and 67 deletions
31
rc
31
rc
|
@ -62,21 +62,12 @@ function {
|
|||
local lsbin='ls'
|
||||
local ls_options='--color=auto'
|
||||
|
||||
case $SYS in
|
||||
darwin)
|
||||
if binary_exists gls; then
|
||||
lsbin='gls'
|
||||
else
|
||||
has_gnu_ls=0
|
||||
ls_options='-G'
|
||||
fi
|
||||
;;
|
||||
linux)
|
||||
;;
|
||||
*)
|
||||
has_gnu_ls=0
|
||||
;;
|
||||
esac
|
||||
if binary_exists gls; then
|
||||
lsbin='gls'
|
||||
else
|
||||
has_gnu_ls=0
|
||||
ls_options='-G'
|
||||
fi
|
||||
|
||||
print_info_sub -l 3 "Setting up ls: `which $lsbin`"
|
||||
alias ls="$lsbin $ls_options"
|
||||
|
@ -84,11 +75,11 @@ function {
|
|||
alias ll="$lsbin -l $ls_options"
|
||||
alias l.="$lsbin -d $ls_options .*"
|
||||
|
||||
if [ $has_gnu_ls ]; then
|
||||
if [ -e $HOME/.dircolors/$SYS.cfg ]; then
|
||||
dircolors=$HOME/.dircolors/$SYS.cfg
|
||||
if [[ $has_gnu_ls -eq 1 ]]; then
|
||||
if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then
|
||||
dircolors="$HOME/.dircolors/$SYS.cfg"
|
||||
else
|
||||
dircolors=$HOME/.dircolors/default.cfg
|
||||
dircolors="$HOME/.dircolors/default.cfg"
|
||||
fi
|
||||
print_info_sub -l 3 "Setting up dircolors: `basename $dircolors`"
|
||||
eval `dircolors $dircolors`
|
||||
|
@ -100,7 +91,7 @@ function {
|
|||
binary_exists nethack && export NETHACKOPTIONS="color"
|
||||
|
||||
# Default ledger file
|
||||
[ -e "$HOME/Documents/Financial/personal.ledger" ] && \
|
||||
[[ -e "$HOME/Documents/Financial/personal.ledger" ]] && \
|
||||
LEDGER_FILE=$HOME/Documents/Financial/personal.ledger
|
||||
|
||||
if [ -e $HOME/.rc.local ]; then
|
||||
|
|
4
vimrc
4
vimrc
|
@ -97,7 +97,7 @@ set wildmode=longest,list
|
|||
|
||||
" Wild ignores
|
||||
" build artifacts
|
||||
set wildignore+=*.o,*.pyc,*~,.lo
|
||||
set wildignore+=*.o,*.pyc,*~,.lo,*.class
|
||||
set wildignore+=*.db,*.pdf,*.jpg,*.jpeg,*.png,*.gif
|
||||
set wildignore+=.git,env,migrations
|
||||
|
||||
|
@ -296,7 +296,7 @@ if has('autocmd')
|
|||
" \ :call ReloadSnippets(expand('%:t:r'))
|
||||
|
||||
" Clean whitespace before saving: Python, C, HTML, and Objective-C
|
||||
autocmd BufWritePre *.py,*.h,*.c,*.html,*.m,*.mm,*.cc,*.hh
|
||||
autocmd BufWritePre *.py,*.h,*.c,*.html,*.m,*.mm,*.cc,*.hh,*.java
|
||||
\ call <SID>strip_trailing_whitespace()
|
||||
endif
|
||||
|
||||
|
|
|
@ -3,73 +3,54 @@
|
|||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
|
||||
local funcname=$0
|
||||
function usage_mkdjango
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 template_name project_name [optional destination directory]"
|
||||
|
||||
|
||||
_usage_mkdjango() {
|
||||
print_info "Usage: $funcname template_name project_name [optional destination directory]"
|
||||
Create a Django project named [project_name] based on the specified template
|
||||
[template_name]. If no [destination directory] is given, the project is
|
||||
created in the current one.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function mkdjango
|
||||
{
|
||||
if [[ ${#@} -lt 2 ]]; then
|
||||
print_error "Need moar arguments" 1>&2
|
||||
_usage_mkdjango
|
||||
usage_mkdjango $0
|
||||
return -1
|
||||
fi
|
||||
|
||||
local template_name=$1
|
||||
local template_dir="$HOME/.codetemplates/django/$template_name"
|
||||
local project_name=$2
|
||||
local project_dst=$3
|
||||
local tname=$1
|
||||
local tdir="$HOME/.codetemplates/django/$tname"
|
||||
local pname=$2
|
||||
local dest=$3
|
||||
|
||||
if [[ ! -d "$template_dir" ]]; then
|
||||
print_error "Invalid template name: $template_name" 1>&2
|
||||
if [[ ! -d "$tdir" ]]; then
|
||||
print_error "Invalid template name: $tname" 1>&2
|
||||
return -2
|
||||
fi
|
||||
|
||||
if [[ -n "$project_dst" ]]; then
|
||||
if [[ ! -d "$project_dst" ]]; then
|
||||
print_info_sub "Destination directory given but does not exist; " \
|
||||
"will create $project_dst"
|
||||
fi
|
||||
else
|
||||
project_dst="`pwd`/$project_name"
|
||||
print_info "Making Django project '$pname' with template '$tname'"
|
||||
if [[ -n "$dest" && ! -d "$dest" ]]; then
|
||||
print_info_sub "Destination directory given but does not exist; creating $dest"
|
||||
mkdir -p "$dest"
|
||||
fi
|
||||
|
||||
print_info "Making Django project '$project_name'"
|
||||
print_info_sub "Template name: $template_name"
|
||||
print_info_sub "Template directory: $template_dir"
|
||||
print_info_sub "Project directory: $project_dst"
|
||||
|
||||
# Determine what files might not be rendered by django-admin.py
|
||||
local missing_files=()
|
||||
for f in `ls -A1 "$template_dir"`; do
|
||||
# Pick up all dotfiles
|
||||
local names=()
|
||||
for f in `ls -A "$tdir"`; do
|
||||
# Pick up dotfiles
|
||||
if [[ -e "$f" && "$f" =~ "^\." ]]; then
|
||||
missing_files+=("$f")
|
||||
names+=("$f")
|
||||
fi
|
||||
done
|
||||
print_info_sub "Missing files: ${(j., .)missing_files}"
|
||||
|
||||
mkdir -p "$project_dst"
|
||||
|
||||
print_info "Calling django-admin.py"
|
||||
django-admin.py startproject --template="$template_dir" \
|
||||
--name=${(j.,.)missing_files} \
|
||||
"$project_name" \
|
||||
"$project_dst"
|
||||
print_info_sub "Calling django-admin.py"
|
||||
django-admin.py startproject --template="$tdir" --name=${(j.,.)names} "$pname" "$dest"
|
||||
exitcode=$?
|
||||
if [[ $exitcode -ne 0 ]]; then
|
||||
print_error "django-admin.py failed"
|
||||
return $exitcode
|
||||
fi
|
||||
|
||||
# print_info "Setting up Git repo"
|
||||
# cd "$project_dir"
|
||||
# git init
|
||||
# git add * .*
|
||||
# git commit -m 'Initial commit'
|
||||
|
||||
return $exitcode
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue