6

I have a directory structure like the following:

my-app/
  .git/
  db/    <-- Database stuff
  lib/   <-- Business logic
  spec/
  web/   <-- Rails

Rails is in the web/ subdirectory of the repository. Heroku doesn't like this by default.

I have a partially working heroku buildpack. It basically calls Dir.chdir to change into the APP_SUBDIR environment variable (if it exists) before running any tasks.

I'd like to deploy to Heroku, but I can't get the asset pipeline task to work. When it comes time to precompile assets, the customized buildpack changes to the web/ directory and attempts to run the task.

However, I get this error, with the following important bit:

Could not detect rake tasks
ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
and using the production group of your Gemfile.
Your Ruby version is 1.9.2, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)

Which is weird since Heroku clearly says I'm running 2.0 in that very same pastie. In fact, when I run:

$ heroku run 'cd web; bundle exec rake -P'

it work just fine.

TL;DR (Summary)

Heroku thinks my ruby version is 1.9.2 when it's really the 2.0.0 shown in its own build process. Why might this be?

soundly_typed
  • 39,257
  • 5
  • 28
  • 36

1 Answers1

-1

You can push only the subdirectory the Rails app lives in to Heroku:

git subtree push --prefix web heroku master

Where web is the subdirectory.

Alex Lang
  • 1,298
  • 11
  • 14