mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-03-27 18:25:12 +08:00
added basic python helper (http server, smtp server, py[co] cleaner and a django helper for the test runner
This commit is contained in:
parent
0b936aaa83
commit
d40fe8284c
13
django/django.load
Normal file
13
django/django.load
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# time, cleanup pyc and running test, settings as first argument
|
||||||
|
# e.g. djtest settings_dev
|
||||||
|
function djtest
|
||||||
|
if test -n $argv
|
||||||
|
set SETTINGS = $argv[0]
|
||||||
|
else
|
||||||
|
set SETTINGS = false
|
||||||
|
end
|
||||||
|
|
||||||
|
set VERBOSE --verbosity=1
|
||||||
|
find . -name "*.pyc" -delete
|
||||||
|
time python manage.py test $VERBOSE --settings=$SETTINGS
|
||||||
|
end
|
@ -1,3 +1,42 @@
|
|||||||
if test -d /usr/local/share/python
|
if test -d /usr/local/share/python
|
||||||
set PATH /usr/local/share/python $PATH
|
set PATH /usr/local/share/python $PATH
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# clean current directory recursively from any .pyc and .pyo files
|
||||||
|
function pyclean
|
||||||
|
if test -n $argv
|
||||||
|
set path2CLEAN $argv
|
||||||
|
else
|
||||||
|
set path2CLEAN .
|
||||||
|
end
|
||||||
|
|
||||||
|
find $path2CLEAN -name "*.pyc" -delete -o -name "*.pyo" -delete
|
||||||
|
end
|
||||||
|
|
||||||
|
# start smtp debugging server, can pass an option port parameter. Default to 1025
|
||||||
|
function pysmtp
|
||||||
|
if test -n "$argv"
|
||||||
|
set SMTPPORT $argv
|
||||||
|
else
|
||||||
|
set SMTPPORT 1025
|
||||||
|
end
|
||||||
|
python -m smtpd -n -c DebuggingServer localhost:$SMTPPORT;
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# beautify json string
|
||||||
|
# use : pybeautifyjson '{"foo": "lorem", "bar": "ipsum"}'
|
||||||
|
function pybeautifyjson
|
||||||
|
echo $argv | python -mjson.tool
|
||||||
|
end
|
||||||
|
|
||||||
|
# start in-place a simple http server, take a optional parameter for the port number
|
||||||
|
function pyhttp
|
||||||
|
if test -n "$argv"
|
||||||
|
set HTTPPORT $argv
|
||||||
|
else
|
||||||
|
set HTTPPORT 1025
|
||||||
|
end
|
||||||
|
python -m SimpleHTTPServer $HTTPPORT;
|
||||||
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user