#!/bin/sh # script/console: Launch a console for the application. Optionally allow an # environment to be passed in to let the script handle the # specific requirements for connecting to a console for that # environment. set -e cd "$[dirname $0]/.." if test -n $1 { # use first argument as an environment name. Use this to decide how to connect # to the appropriate console. if test $1 = "production" { heroku run rails console --app heroku-app-name } elif test $1 = "staging" { heroku run rails console --app heroku-app-name-staging } else { echo "Sorry, I don't know how to connect to the '$1' environment." exit 1 } } else { # no argument provided, so just run the local console in the development # environment. Ensure the application is up to date first. script/update bin/rails console } (CommandList children: [ (C {(set)} {(-e)}) (C {(cd)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(dirname)} {(DQ ($ VSub_Number "$0"))})]) left_token: spids: [25 31] ) (/..) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "]")}) terminator: ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (production))} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(heroku)} {(run)} {(rails)} {(console)} {(--app)} {(heroku-app-name)})] spids: [-1 77] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "=")} {(DQ (staging))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(heroku)} {(run)} {(rails)} {(console)} {(--app)} {(heroku-app-name-staging)}) ] spids: [93 110] ) ] else_action: [ (C {(echo)} { (DQ ("Sorry, I don't know how to connect to the '") ($ VSub_Number "$1") ("' environment.") ) } ) (C {(exit)} {(1)}) ] spids: [126 143] ) ] spids: [-1 49] ) ] else_action: [(C {(script/update)}) (C {(bin/rails)} {(console)})] spids: [145 163] ) ] )