Initial import.

This commit is contained in:
Glenn Y. Rolland 2013-06-04 15:46:44 +02:00
commit 56c57bbe88
4 changed files with 130 additions and 0 deletions

8
README.md Normal file
View file

@ -0,0 +1,8 @@
KoProj is a tool for managing console project environments
Ex: Project X require 3 terminals, with name A, B, C
A : must be in directory ~/
B : must be in directory ~/foo
run command X
C : must be in directory ~/bar
run command Y

51
bin/koproj Executable file
View file

@ -0,0 +1,51 @@
#!/bin/sh
KOPROJ_DATA_DIR=$(cd `dirname "$0"`; cd ../lib ; pwd )
KOPROJ_CONFIG_DIR=$HOME/.config/koproj
. $KOPROJ_DATA_DIR/base.sh
## Expected usage :
#
# koproj exec <name>
# koproj init <name>
#
mkdir -p $KOPROJ_CONFIG_DIR
while [ $# -gt 0 ]; do
arg=${1:-}
opt=${2:-}
case $arg in
-l|--list) #list projects
echo "List of projects :"
ls $KOPROJ_CONFIG_DIR/*.koproj 2> /dev/null
;;
-e) # edit project
shift
project="$opt"
if [ -z "$project" ]; then
echo "ERROR: project name missing" >&2
exit 1
elif [ ! -e "$KOPROJ_CONFIG_DIR/$project.koproj" ]; then
echo "ERROR: unknown project $project" >&2
exit 1
fi
"$EDITOR" "$KOPROJ_CONFIG_DIR/$project.koproj"
;;
-c) # create
;;
-d) # destroy
;;
*) #enter into project
project="$arg"
if [ ! -e "$KOPROJ_CONFIG_DIR/$project.koproj" ]; then
echo "ERROR: unknown project $project" >&2
exit 1
fi
. "$KOPROJ_CONFIG_DIR/$project.koproj"
;;
esac
shift
done

47
koproj.sample Executable file
View file

@ -0,0 +1,47 @@
PROJECT_ROOT="/path/to/somewhere"
WPTHEME_PATH="$PROJECT_ROOT/wp-root"
koproj_newtab
koproj_renametab "VAGRANT"
koproj_run "cd $PROJECT_ROOT"
koproj_run "clear"
koproj_run 'sudo /etc/init.d/vboxdrv start'
koproj_run './bin/vagrant up'
koproj_newtab
koproj_renametab "VM"
koproj_run "cd $PROJECT_ROOT"
koproj_run "clear"
koproj_newtab
koproj_renametab "FORGE"
koproj_run "cd $WPTHEME_PATH"
koproj_run "clear"
koproj_run "be forge watch"
koproj_newtab
koproj_renametab "ASSETS"
koproj_run "cd $WPTHEME_PATH/source/assets"
koproj_run "clear"
koproj_newtab
koproj_renametab "JS"
koproj_run "cd $WPTHEME_PATH/source/assets/javascripts"
koproj_run "clear"
koproj_newtab
koproj_renametab "CSS"
koproj_run "cd $WPTHEME_PATH/source/assets/stylesheets"
koproj_run "clear"
koproj_newtab
koproj_renametab "FUNCTIONS"
koproj_run "cd $WPTHEME_PATH/source/functions"
koproj_run "clear"
koproj_newtab
koproj_renametab "TEMPLATES"
koproj_run "cd $WPTHEME_PATH/source/templates"
koproj_run "clear"

24
lib/base.sh Normal file
View file

@ -0,0 +1,24 @@
koproj_run() {
local cmd="$*"
qdbus org.kde.konsole /Sessions/${session} sendText "$cmd"
qdbus org.kde.konsole /Sessions/${session} sendText "
"
}
koproj_newtab() {
#dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call \
# --print-reply /konsole/MainWindow_1 org.kde.KMainWindow.activateAction string:"new-tab"
session=$(qdbus org.kde.konsole /Konsole newSession)
}
koproj_renametab() {
#sessionno=$1
tabname=$1
#session="/Sessions/${sessionno}"
#dbus-send --session --dest=${KONSOLE_DBUS_SERVICE} --type=method_call --print-reply ${session} org.kde.konsole.Session.setTitle int32:1 string:"$tabname"
qdbus org.kde.konsole /Sessions/${session} setTitle 1 "$tabname"
}