Skip to content

Instantly share code, notes, and snippets.

@fny
Created April 30, 2013 19:25
Show Gist options
  • Save fny/5491227 to your computer and use it in GitHub Desktop.
Save fny/5491227 to your computer and use it in GitHub Desktop.
Quick n' dirty Heroku pushes.
#! /usr/bin/env bash
set -e
repo_dir=`pwd`
current_branch=`git rev-parse --abbrev-ref HEAD`
timestamp=`date +"%Y%m%d%H%M"`
push_dir="heroku-$timestamp"
echo "Copying the repository into $push_dir for pushing..."
cd ../
cp -R "$repo_dir" "$push_dir"
echo "Entering $push_dir ..."
cd $push_dir
echo "Trimming Gemfile..."
sed -i '' -e '/group :development, :test do/,$d' Gemfile
echo "Unignoring seed data..."
sed -i '' -e 's|/db/seeds/data/||' .gitignore
echo "Preparing for takeoff..."
bundle
git add .
git commit -am "Push at $timestamp"
echo "We have ignition..."
git push -f heroku $current_branch:master
echo "Cleaning up..."
cd ../
rm -Rf "heroku-$timestamp"
cd $repo_dir
finish_message="Yay I'm so excited! I just can't hide it!"
command -v say >/dev/null 2>&1 && say $finish_message
echo $finish_message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment