开发者

Heroku not Loading do_postgres dependency

Getting started on Heroku, but it does not seem to be loading the necessary dependency (do_postgres (~> 0.10.2)) for dm-postgres-adapter.

The Gemfile is as such:

source :gemcutter

gem 'dm-postgres-adapter', '1.0.2'
gem 'dm-sqlite-adapter', '1.0.2'
gem 'sinatra', '1.1.0'
gem 'mustache', '0.9'
gem 'datamapper', '1.0.2'
gem 'json', '1.5.1'

With the relevant section of the Gemfile.lock looking as follows:

dm-postgres-adapter (1.0.2)
  dm-do-adapter (~> 1.0.2)
  do_postgres (~> 0.10.2)

When pushed to Heroku, it does not seem to install do_postgres:

-----> Heroku receiving push
-----> Sinatra app detected
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Fetching source index for http://rubygems.org/
       Installing addressable (2.2.4)
       Installing data_objects (0.10.3)
       Installing extlib (0.9.15)
       Installing dm-core (1.0.2)
       Installing dm-aggregates (1.0.2)
       Installing dm-migrations (1.0.2)
       Installing dm-constraints (1.0.2)
       Installing fastercsv (1.5.4)
       Installing json_pure (1.5.1)
       Installing dm-serializer (1.0.2)
       Installing dm-timestamps (1.0.2)
       Installing dm-transactions (1.0.2)
       Installing stringex (1.1.0)
       Installing uuidtools (2.1.2)
       Installing dm-types (1.0.2)
       Installing dm-validations (1.0.2)
       Installing datamapper (1.0.2)
       Installing dm-do-adapter (1.0.2)
       Installing dm-postgres-adapter (1.0.2)
       Installing dm-sqlite-adapter (1.0.2)
       Installing mustache (0.9.0)
       Installing rack (1.2.1)
       Installing tilt (1.2.2)
       Installing sinatra (1.1.0)
       Using bundler (1.0.7)
       Your bundle is complete! It was installed into ./.bundle/gems/
       Compiled slug size is 1.7MB
-----> Launching... done

And, indeed, Heroku does not find the gem and does not launch:

2011-03-07T10:48:31-08:00 heroku[slugc]: Slug compilation finished
2011-03-07T10:48:35-08:00 app[web.1]: /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem do_postgres (~> 0.10.2) (Gem::LoadError)
2011-03-07T10:48:35-08:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
2011-03-07T10:48:35-08:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
2011-03-07T10:48:35-08:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
2011-03-07T10:48:35-08:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/开发者_开发知识库site_ruby/1.8/rubygems.rb:248:in `each'
2011-03-07T10:48:35-08:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
2011-03-07T10:48:35-08:00 app[web.1]:   from /app/04eca654-0ab6-43de-aae1-1dbed7bef1a1/home/.bundle/gems/ruby/1.8/gems/dm-core-1.0.2/lib/dm-core/adapters.rb:163:in `load_adapter'
2011-03-07T10:48:35-08:00 app[web.1]:   from /app/04eca654-0ab6-43de-aae1-1dbed7bef1a1/home/.bundle/gems/ruby/1.8/gems/dm-core-1.0.2/lib/dm-core/adapters.rb:133:in `adapter_class'
2011-03-07T10:48:35-08:00 app[web.1]:   from /app/04eca654-0ab6-43de-aae1-1dbed7bef1a1/home/.bundle/gems/ruby/1.8/gems/dm-core-1.0.2/lib/dm-core/adapters.rb:13:in `new'
2011-03-07T10:48:35-08:00 app[web.1]:   from /app/04eca654-0ab6-43de-aae1-1dbed7bef1a1/home/.bundle/gems/ruby/1.8/gems/dm-core-1.0.2/lib/dm-core.rb:266:in `setup'
2011-03-07T10:48:35-08:00 app[web.1]:   from ./lib/database.rb:21:in `initialize'

database.rb line 21 is this:

  DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://' + Dir.pwd + '/database.db')

Which is code straight from the Heroku site: http://devcenter.heroku.com/articles/database#common_issues_migrating_to_postgresql , under "Using the DATABASE_URL Environment variable". The app runs on Sqlite locally, but Heroku uses postgresql. I was hoping DataMapper would make the transition a cinch!

I have tried explicitly including

gem 'do_postgres', '~>0.10.2'

in the Gemfile, to no avail. This should not be necessary, anyway. Submitted a ticket to Heroku support as well, but haven't heard back from them...


Heroku got back to me, very promptly:

Hello,

I noticed you're using windows for your development environment. There is currently a limitation on with bundler and cross platform use, i.e. if you develop locally on windows but deploy to a unix server like heroku. The current workaround is to remove your Gemfile.lock.

Best,

[removed]

Indeed, after removing Gemfile.lock Heroku installed the do_postgres gem properly. I had originally committed Gemfile.lock because the Heroku interface recommended it, ("Gemfile.lock will soon be required"), so perhaps a little warning somewhere that this breaks compatibility with Windows would be nice. Of course, the cross-platform thing was not my decision. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜