heroku-rails icon indicating copy to clipboard operation
heroku-rails copied to clipboard

Allow heroku-rails to be used outside of rails

Open myronmarston opened this issue 14 years ago • 0 comments

Your gem makes configuring and deploying apps to heroku such a pleasure that I wanted to use it outside of a rails app. I have a super-simple rack app that I needed to deploy to heroku. I got your gem to work even though my work arounds are total hacks:

Gemfile:

source :rubygems

group :development do
  gem 'heroku-rails'
  gem 'rake'
  gem 'activesupport'
end

Rakefile:

require 'bundler'
Bundler.setup(:default, :development)

# heroku-rails assumes the presence of Rails.root, so we'll define it here
Rails = Object.new
def Rails.root
  @root ||= Pathname.new(File.expand_path(File.dirname(__FILE__)))
end

begin
  require 'heroku-rails'
  require 'heroku/rails/tasks'
  require 'active_support/core_ext'
rescue LoadError
  STDERR.puts "Run `bundle install` to install heroku-rails"
end

This allows me to run rake heroku:setup to set things up based on my config/heroku.yml file, and rake all heroku:deploy to deploy (even though it fails at the db:migrate step...but that doesn't matter).

It would be nice to have an officially supported way to use this outside of rails. If I may make a suggestion, what do you think about this?

  • Release a gem that works outside of rails and provides all the non-rails functionality of this gem.
  • Have this gem depend on that gem, and simply add the Rails-specific stuff.

heroku-rails is a pretty decent name, but you could call them deploku and deploku-rails :-).

myronmarston avatar Dec 10 '10 22:12 myronmarston