rely fully on artlog_toolbox github .

Signed-off-by: philippe lhardy <philippe@pavilionartlogiciel>
This commit is contained in:
philippe lhardy
2015-02-25 22:58:59 +01:00
parent 7633f42399
commit 48f363ad01
7 changed files with 7 additions and 509 deletions

View File

@@ -1,45 +0,0 @@
#!/bin/bash
A_TOOLBOX=artlog_toolbox
if [[ ! -d $A_TOOLBOX ]]
then
echo "[ERROR] this tool should be run from parent dir of $A_TOOLBOX this way : ${A_TOOLBOX}/deploy.sh" >&2
exit 1
fi
destroy=0
while [[ $# -gt 0 ]]
do
case $1 in
destroy)
destroy=1
;;
*)
echo "[ERROR] unrecognized '$1' argument for $0" >&2
exit 1
;;
esac
shift 1
done
if [[ $destroy != 1 ]]
then
echo "Deploying scripts..."
pushd ${A_TOOLBOX}
cp scripts/* ..
popd
else
echo "destroy deployed toolbox"
for script in $(ls ${A_TOOLBOX}/scripts)
do
if [[ -f $script ]]
then
shortscript=$(basename "$script")
echo "deleting '$shortscript'"
rm "$shortscript"
fi
done
fi

View File

@@ -1,65 +0,0 @@
PROJECT_VERSION=`./debianize.sh getversion`
DISTPREFIX=artloglaby
DISTJAR=$(DISTPREFIX)-$(PROJECT_VERSION).jar
JDEE_VERSION=2.4.1
all: build.xml dist/lib/$(DISTJAR)
getname:
@echo dist/lib/$(DISTJAR)
dist:
mkdir -p dist
dist/lib/$(DISTJAR): dist
ant dist
build.xml:
./antify.sh >$@
clean:
rm -f build.xml
rm -f dist/lib/$(DISTPREFIX)*.jar
rm -rf build
cd java; make clean
cleanall: clean
rm -rf debian
rm -rf deb
rm -rf download
@( [ -d ~/.emacs.d/jdee-$(JDEE_VERSION) ] && echo "DON'T remove installed ~/.emacs.d/jdee-$(JDEE_VERSION). To remove jdee do 'make removejdee'" ) || true
debian:
mkdir debian
deb/%:
mkdir -p deb
touch $@
./debianize.sh create $@
debian/compat:
echo "7" >$@
debian/%:
./debianize.sh create $@ >$@
deb: debian debian/rules debian/control debian/compat debian/changelog deb/javadoc deb/jlibs
dpkg-buildpackage -uc -us
/usr/bin/emacs:
sudo apt-get install emacs
download/jdee-bin-$(JDEE_VERSION).tar.bz2:
mkdir -p download; cd download; wget http://sourceforge.net/projects/jdee/files/jdee/$(JDEE_VERSION)/jdee-bin-$(JDEE_VERSION).tar.bz2
~/.emacs.d/jdee-$(JDEE_VERSION): /usr/bin/emacs download/jdee-bin-$(JDEE_VERSION).tar.bz2
mkdir -p ~/.emacs.d; tar -xjf download/jdee-bin-$(JDEE_VERSION).tar.bz2 -C ~/.emacs.d
echo "(add-to-list 'load-path \"~/.emacs.d/jdee-$(JDEE_VERSION)/lisp\")\n(load \"jde\")" >>~/.emacs.d/init.el
emacsdevenv: ~/.emacs.d/jdee-$(JDEE_VERSION)
removejdee:
rm -rf ~/.emacs.d/jdee-$(JDEE_VERSION)
sed -i -n -e "/^(add-to-list 'load-path \"~\/\.emacs\.d\/jdee-$(JDEE_VERSION)\/lisp\")$$/d" -e "/^(load \"jde\")$$/d" -e"/^.*$$/p" ~/.emacs.d/init.el
.PHONY: clean all cleanall getname deb emacsdevenv removejdee

View File

@@ -1,12 +0,0 @@
#!/bin/bash
buildscript=$1
if [[ -e $buildscript ]]
then
# protect ${ variables.
sed 's/\${/\\\${/g' build.xml
else
echo "[ERROR] this $0 tool expect an initial argument with buildscript" >&2
fi

View File

@@ -1,50 +0,0 @@
#!/bin/bash
source ./project_params
# TODO reuse internal tsamp ${DSTAMP}
cat <<EOF
<project name="$project_name" default="$project_default" basedir="$project_basedir">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="java"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="\${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from \${src} into \${build} -->
<javac srcdir="\${src}" destdir="\${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="\${dist}/lib"/>
<!-- Put everything in \${build} into the ${project_name}-${project_version}.jar file ( \${DSTAMP} not used yet )-->
<jar jarfile="\${dist}/lib/${project_name}-${project_version}.jar" basedir="\${build}">
<manifest>
<attribute name="Main-Class" value="$project_mainclass"/>
</manifest>
</jar>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the \${build} and \${dist} directory trees -->
<delete dir="\${build}"/>
<delete dir="\${dist}"/>
</target>
</project>
EOF

View File

@@ -1,67 +0,0 @@
#!/bin/bash
action=$1
file=$2
maintainer="Artlog <pl@artisanlogiciel.net>"
if [[ $action == getversion ]]
then
source ./project_params
echo $project_version
elif [[ $action == create ]]
then
source ./project_params
if [[ $file == debian/control ]]
then
cat <<EOF
Source: ${project_name}-java
Priority: extra
Maintainer: $maintainer
Build-Depends: debhelper (>= 7.0.50~), javahelper (>=0.25)
Build-Depends-Indep: default-jdk, default-jdk-doc, libtrove-java, libtrove-java-doc, ant
Standards-Version: ${project_version}
Section: java
Package: ${project_name}-java
Architecture: all
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Labyrinth generator
Labyrinth generator
Package: ${project_name}-java-doc
Architecture: all
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Labyrinth generator (documentation)
Labyrinth generator
EOF
elif [[ $file = debian/changelog ]]
then
cat <<EOF
${project_name}-java (${project_version}) unstable; urgency=low
* Initial debian package
-- ${maintainer} $(LANG=C date -R)
EOF
elif [[ $file = debian/rules ]]
then
cat <<EOF
#!/usr/bin/make -f
JAVA_HOME=/usr/lib/jvm/default-java
%:
dh \$@ --with javahelper
EOF
elif [[ $file = deb/javadoc ]]
then
echo "api /usr/share/doc/${project_name}-java/api" >debian/${project_name}-java-doc.javadoc
elif [[ $file = deb/jlibs ]]
then
echo "dist/lib/${project_name}-${project_version}.jar" >debian/${project_name}-java.jlibs
fi
fi

View File

@@ -1,270 +0,0 @@
#!/bin/bash
setup()
{
if [[ ! -d java ]]
then
echo "[FATAL] this tools $0 is intended to be run within laby project. Missing java directory." >&2
exit 1
fi
if [[ ! -d lab ]]
then
echo "[INFO] Creating directory lab to save default lab created"
mkdir lab
fi
}
do_code()
{
background=$1
find java/org/artisanlogiciel/games/ -name "*.java" |
{
s=()
while read codeline
do
javafile=$(basename "$codeline")
javaclass=${javafile/.java/}
echo "$javafile $javaclass"
s+=("$javaclass" "$codeline")
done
javaclass=$($DIALOG --menu "Edit it" 20 100 10 ${s[@]} 3>&1 1>&2 2>&3)
if [[ -n $javaclass ]]
then
pushd java
if [[ $background == codebg ]]
then
nohup make work/$javaclass &
else
make work/$javaclass
fi
popd
fi
}
}
edit_properties()
{
local property_file=$1
if [[ -f $property_file ]]
then
modified=0
s=()
properties=()
values=()
{
while read codeline
do
if [[ $codeline =~ (^[a-zA-Z_]*)=(.*) ]]
then
property=${BASH_REMATCH[1]}
value=${BASH_REMATCH[2]}
s+=("$property" "$value")
properties+=("$property")
values+=("$value")
fi
done
s+=(exit "Exit")
} < $property_file
while true
do
property=$($DIALOG --menu "Edit '$property_file'" 20 100 10 ${s[@]} 3>&1 1>&2 2>&3)
if [[ $? = 0 ]]
then
if [[ -n $property ]]
then
if [[ $property == exit ]]
then
return 1
elif [[ $property == save ]]
then
for (( i=0; i<${prop_len}; i++ ));
do
echo "${properties[$i]}=${values[$i]}"
done >$property_file
return 0
fi
prop_len="${#properties[@]}"
for (( i=0; i<${prop_len}; i++ ));
do
if [[ ${properties[$i]} == $property ]]
then
init_value=${values[$i]}
fi
done
value=$($DIALOG --inputbox "Enter $property value" 10 80 "$init_value" 3>&1 1>&2 2>&3)
if [[ $? = 0 ]]
then
prop_len="${#properties[@]}"
s=()
if [[ "$value" != "$init_value" ]]
then
modified=$(( modified + 1 ))
fi
for (( i=0; i<${prop_len}; i++ ));
do
if [[ ${properties[$i]} == $property ]]
then
values[$i]=$value
fi
s+=("${properties[$i]}" "${values[$i]}")
echo "${properties[$i]}=${values[$i]}"
done
s+=(exit "Exit")
if [[ $modified != 0 ]]
then
s+=(save "Save")
fi
fi
fi
else
return 2
fi
done
else
echo "[ERROR] property_file '$propertyfile' not found" >&2
fi
}
# first argument mandatory : directory containing generated .lab and .stl files ( usualy ./lab )
list_labs()
{
local lab_dir=$1
if [[ -d $lab_dir ]]
then
modified=0
s=()
properties=()
values=()
{
pushd $lab_dir
for stl_lab in $(ls *lab*.stl)
do
if [[ $stl_lab =~ ^([^0-9]*[0-9]*x[0-9]*).stl ]]
then
property=${BASH_REMATCH[1]}
value=$stl_lab
s+=("$property" "$value")
properties+=("$property")
values+=("$value")
fi
done
s+=(exit "Exit")
popd
}
while true
do
property=$($DIALOG --menu "Show stl file from $lab_dir" 20 100 10 ${s[@]} 3>&1 1>&2 2>&3)
if [[ $? = 0 ]]
then
if [[ -n $property ]]
then
if [[ $property == exit ]]
then
return 1
elif [[ $property == save ]]
then
echo "TODO"
return 0
fi
prop_len=${#properties[*]}
for (( i=0; i<${prop_len}; i++ ));
do
if [[ ${properties[$i]} == $property ]]
then
blender --python blender_import.py -- $lab_dir/${values[$i]}
fi
done
fi
else
return 2
fi
done
else
echo "[ERROR] lab dir '$propertyfile' not found" >&2
fi
}
possible_console_gui="whiptail dialog"
for DIALOG in $possible_console_gui
do
DIALOG=$(which $DIALOG)
if [[ -n $DIALOG ]]
then
break
fi
done
if [[ -z $DIALOG ]]
then
echo "[ERROR] no console gui support (no dialog tool found within $possible_console_gui) => no menus " >&2
exit 1
fi
setup
action=initial
while [[ $action != quit ]]
do
action=$($DIALOG --menu "Ultra Light IDE" 20 80 12 readme "Read me" clean "Clean All" ant "Ant build" run "Run it" list_labs "Show Labyrinth with blender" test "Test it" code "Code" codebg "Code in background" deb "Debian package" properties "Edit Properties" create "Create a new class" emacsdevenv "Setup Emacs java bindings JDEE" quit "Quit" 3>&1 1>&2 2>&3)
if [[ $action == run ]]
then
echo "run it"
java -jar $(make getname)
elif [[ $action == ant ]]
then
make clean
make
ant compile
elif [[ $action == clean ]]
then
make clean
pushd java
make clean
popd
elif [[ $action == test ]]
then
echo "test it"
pushd java
make display
popd
elif [[ $action == deb ]]
then
make deb
elif [[ $action =~ code ]]
then
do_code $action
elif [[ $action == readme ]]
then
$DIALOG --textbox README 40 80 --scrolltext
elif [[ $action == properties ]]
then
edit_properties project_params
elif [[ $action == create ]]
then
newclass=$($DIALOG --inputbox "Enter new class name" 10 80 "NewClass" 3>&1 1>&2 2>&3)
if [[ $? = 0 ]]
then
if [[ -n $newclass ]]
then
pushd java
make work/$newclass
popd
fi
fi
elif [[ $action == list_labs ]]
then
list_labs ./lab
elif [[ $action == emacsdevenv ]]
then
make $action
fi
done

View File

@@ -1,3 +1,10 @@
#!/bin/bash
if [[ ! -d artlog_toolbox ]]
then
git clone https://github.com/artlog/artlog_toolbox.git artlog_toolbox
pushd artlog_toolbox
git checkout labystl
popd
fi
artlog_toolbox/deploy.sh