Skip to content

Instantly share code, notes, and snippets.

@mezis
Created January 3, 2014 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mezis/8236366 to your computer and use it in GitHub Desktop.
Save mezis/8236366 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# Heroku wrapper
#
require 'pathname'
app_basename = Pathname.new('.').realpath.basename.to_s
head_name = %x(git symbolic-ref HEAD).strip
branch_name = head_name.gsub(%r(^refs/heads/), '')
case branch_name
when 'master'
app_name = app_basename
else
app_name = "#{app_basename}-#{branch_name}"
end
command = ['heroku', *ARGV, "--app", app_name]
$stderr.puts command.join(' ')
system *command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment