Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active August 29, 2015 14:09
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save typeoneerror/3ae9fa830be48544ae68 to your computer and use it in GitHub Desktop.
run all the things
#!/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