Skip to content

Instantly share code, notes, and snippets.

@cobyism
Created December 28, 2013 17:16
Show Gist options
  • Save cobyism/8161691 to your computer and use it in GitHub Desktop.
Save cobyism/8161691 to your computer and use it in GitHub Desktop.
Heroku utility commands
#!/bin/bash
# Run the same Heroku command on `production` and `staging` remotes,
# and then diff the output.
if [ `git remote | grep production | wc -l ` == "1" ] && \
[ `git remote | grep staging | wc -l ` == "1" ]; then
echo "As you wish..."
command=""
for var in "$@"
do
command=$command"$var "
done
echo " -> Comparing remotes for command: heroku "$command""
diff <(heroku $command--remote production) <(heroku $command--remote staging)
else
echo "Well, this is awkward. I seem to be missing either a 'production' or 'stating' remote..."
fi
#!/bin/bash
# Run Heroku commands on production remote
if [ `git remote | grep production | wc -l ` == "1" ]; then
echo "As you wish..."
command=""
for var in "$@"
do
command=$command"$var "
done
echo " -> heroku "$command"--remote production"
heroku $command--remote production
else
echo "Well, this is awkward. I don’t know anything about a 'production' remote..."
fi
#!/bin/bash
# Run Heroku commands on staging remote
if [ `git remote | grep staging | wc -l ` == "1" ]; then
echo "As you wish..."
command=""
for var in "$@"
do
command=$command"$var "
done
echo " -> heroku "$command"--remote staging"
heroku $command--remote staging
else
echo "Well, this is awkward. I don’t know anything about a 'staging' remote..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment