2016-04-05 14:09:23 +02:00
|
|
|
#!/usr/bin/env bash
|
2017-05-01 15:57:48 +02:00
|
|
|
# make sure that current dir is project top dir
|
|
|
|
this_script="${BASH_SOURCE[0]}"
|
|
|
|
script_directory="$( dirname "${this_script}" )"
|
|
|
|
work_dir="$( readlink -f "${script_directory}" )"
|
|
|
|
cd "$work_dir"
|
|
|
|
# make sure that current dir is project top dir
|
|
|
|
|
2016-04-05 14:09:23 +02:00
|
|
|
project_name=explain
|
|
|
|
|
2017-05-01 15:57:48 +02:00
|
|
|
# I use ssh-ident tool (https://github.com/ccontavalli/ssh-ident), so I should
|
|
|
|
# set some env variables.
|
|
|
|
ssh_ident_agent_env="${HOME}/.ssh/agents/agent-priv-$( hostname -s )"
|
|
|
|
[[ -e "${ssh_ident_agent_env}" ]] && . "${ssh_ident_agent_env}" > /dev/null
|
|
|
|
|
|
|
|
# Check if the session already exist, and if yes - attach, with no changes
|
|
|
|
tmux has-session -t "${project_name}" 2> /dev/null && exec tmux attach-session -t "${project_name}"
|
|
|
|
|
2019-05-21 09:43:59 +02:00
|
|
|
tmux new-session -d -s "${project_name}" -n "morbo"
|
2019-05-21 08:11:11 +02:00
|
|
|
tmux bind-key c new-window -c "#{pane_current_path}" -a
|
|
|
|
|
2023-12-29 13:55:46 +02:00
|
|
|
tmux split-window -d -t "${project_name}:morbo"
|
|
|
|
|
2019-05-21 09:43:59 +02:00
|
|
|
tmux new-window -d -n shell -t "${project_name}"
|
|
|
|
|
|
|
|
for dir in lib templates public/css public/js
|
|
|
|
do
|
|
|
|
tmux new-window -d -n "${dir##*/}" -t "${project_name}" -c "${work_dir}/${dir}/"
|
|
|
|
done
|
2017-05-01 15:57:48 +02:00
|
|
|
|
2019-05-21 09:43:59 +02:00
|
|
|
tmux send-keys -t "${project_name}:morbo.0" "morbo -v -l http://*:25634 ${project_name}.pl" Enter
|
2023-12-29 13:55:46 +02:00
|
|
|
tmux send-keys -t "${project_name}:morbo.1" "tail -F log/development.log" Enter
|
2017-05-01 15:57:48 +02:00
|
|
|
|
2019-05-21 09:43:59 +02:00
|
|
|
for d in shell lib templates css js
|
|
|
|
do
|
|
|
|
tmux send-keys -t "${project_name}:${d}" "ls -l" Enter
|
|
|
|
done
|
2017-05-01 15:57:48 +02:00
|
|
|
|
2019-05-21 09:43:59 +02:00
|
|
|
tmux attach-session -t "${project_name}"
|