Skip to content

Instantly share code, notes, and snippets.

@paulruescher
Forked from typeoneerror/run-backend.sh
Last active July 19, 2023 17:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulruescher/148609b5d6d34615be17 to your computer and use it in GitHub Desktop.
Save paulruescher/148609b5d6d34615be17 to your computer and use it in GitHub Desktop.
#!/bin/bash
# backend/run
echo -n -e "\033]0;Rails\007"
foreman start
echo -n -e "\033]0;\007"
#!/bin/bash
# frontend/run
echo -n -e "\033]0;Ember\007";
ember server --proxy http://localhost:3000/
echo -n -e "\033]0;\007";
#!/bin/bash
path="$( cd "$(dirname $( dirname "$0" ))" && pwd )";
# function to open a new terminal tab and run commands (for Apple Terminal or iTerm)
open_tab() {
[ $# -lt 1 ] && return
if [ "$TERM_PROGRAM" == "Apple_Terminal" ]
then
osascript -e "
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
tell application \"Terminal\" to do script \"$1\" in selected tab of the front window
" > /dev/null 2>&1
fi
if [ "$TERM_PROGRAM" == "iTerm.app" ]
then
osascript -e "
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
tell application \"iTerm\"
activate
set _session to current session of current terminal
tell _session
write text \"$1\"
end tell
end tell
"
fi
}
# run ember front end in new tab
open_tab "cd $path; cd ./frontend; ./run-frontend.sh";
# run api and web server in new tab
open_tab "cd $path; cd ./backend; ./run-backend.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment