scripts: Create functions file in lib/ocarina/
Makes it easier to install and keeps functions separate from the ocarina commands. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
de5cdc1cbc
commit
bba2989866
|
@ -3,4 +3,5 @@
|
|||
*.tar.gz
|
||||
.sconsign.dblite
|
||||
bin/
|
||||
lib/
|
||||
include/version.h
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
. `dirname $0`/ocarina
|
||||
. `dirname $0`/../lib/ocarina/functions
|
||||
write_to_pipe "play"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
import os, re
|
||||
|
||||
Import( "env", "DEBUG" )
|
||||
bin = os.path.abspath("../bin/%s")
|
||||
bin = "../bin/%s"
|
||||
lib = "../lib/ocarina/%s"
|
||||
|
||||
def create_script(target, source, env):
|
||||
dst = str(target[0].rfile())
|
||||
|
@ -25,7 +26,10 @@ for file in os.listdir("."):
|
|||
elif file[0] == ".":
|
||||
continue
|
||||
|
||||
dst = (bin % file).replace("%APP", "ocarina")
|
||||
dir = bin
|
||||
if file == "functions":
|
||||
dir = lib
|
||||
dst = (dir % file).replace("%APP", "ocarina")
|
||||
files.append(env.Command(dst, file, create_script))
|
||||
|
||||
Return('files')
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEBUG=%DEBUG
|
||||
|
||||
function get_app_dir
|
||||
{
|
||||
dir="$HOME/.%APP"
|
||||
if [ "$DEBUG" == "True" ]; then
|
||||
dir="$dir-debug"
|
||||
fi
|
||||
echo $dir
|
||||
}
|
||||
|
||||
function write_to_pipe
|
||||
{
|
||||
pipe=`get_app_dir`/pipe
|
||||
if [ ! -p $pipe ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
file=`mktemp`
|
||||
echo "$*" > $file
|
||||
echo $file > $pipe
|
||||
rm -f $file
|
||||
}
|
|
@ -1,33 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEBUG=%DEBUG
|
||||
|
||||
function get_app_dir
|
||||
{
|
||||
dir="$HOME/.%APP"
|
||||
if [ "$DEBUG" == "True" ]; then
|
||||
dir="$dir-debug"
|
||||
fi
|
||||
echo $dir
|
||||
}
|
||||
|
||||
function write_to_pipe
|
||||
{
|
||||
pipe=`get_app_dir`/pipe
|
||||
if [ ! -p $pipe ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
file=`mktemp`
|
||||
echo "$*" > $file
|
||||
echo $file > $pipe
|
||||
rm -f $file
|
||||
}
|
||||
|
||||
#cmd=`which %%OCARINA%%-$1 2>/dev/null`
|
||||
#args="${@: +2}"
|
||||
#if [ "$cmd" ]; then
|
||||
# $cmd "$args"
|
||||
#else
|
||||
# %%BIN%% "$*"
|
||||
#fi
|
||||
cmd=`which %%OCARINA%%-$1 2>/dev/null`
|
||||
args="${@: +2}"
|
||||
if [ "$cmd" ]; then
|
||||
$cmd "$args"
|
||||
else
|
||||
%%BIN%% "$*"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue