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