1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2024-11-24 08:42:27 +02:00
explain.depesz.com/run.dev.sh

40 lines
1.4 KiB
Bash
Raw Normal View History

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}"
tmux new-session -d -s "${project_name}" -n "morbo"
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"
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
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
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
tmux attach-session -t "${project_name}"