1

---------------- EDIT ----------------

I've tried what @Duk said, and still nothing work. After trying a little more, i figured out that the problem isn't on DataMapper. In fact it's the postgreSQL adapter that fails on AMD64.

I have binary distribution of PostgreSQL (the last one found on their site) and I got all the gems by doing a

gem install...

Someone can help me ?

---------------- ORIGINAL ----------------

Following the "Get Started" from DataMapper website, i ran across this example :

# A Postgres connection:
DataMapper.setup(:default, 'postgres://localhost/the_database_name')

I have my postgre database installed, DataMapper and every dependency (dev-kit included) Here's the code :

gem 'data_mapper'
require 'dm-core'
require 'dm-migrations/adapters/dm-postgres-adapter'
# If you want the logs displayed you have to do this before the call to setup
DataMapper::Logger.new($stdout, :debug)

# A Postgres connection:
DataMapper.setup(:default, 'postgres://localhost/test')

But when I run it, this error occurs :

D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 n?est pas une application Win32 valide.   - D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres/1.9/do_postgres.so (LoadError)
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:30:in `rescue in <top (required)>'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:25:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter/adapter.rb:1:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter.rb:1:in `<top (required)>'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new'
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:228:in `setup'
    from D:/dev/workspace/ruby/training/bin/pg/main.rb:8:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

The error occurs on "load_adapter" function :

    require "dm-#{name}-adapter"

Apparently the file isn't found. I've tryed to include the adapter manually as proposed here but without success.

Any idea ? thanks

Community
  • 1
  • 1
kitensei
  • 2,510
  • 2
  • 42
  • 68

1 Answers1

1

You have to install dm-postgres-adapter(gem install dm-postgres-adapter) then install data_mapper(gem install data_mapper).

Duk
  • 125
  • 1
  • 12
  • is the install order important ? because i've re-installed postgres adapter once datamapper was setup – kitensei Feb 28 '12 at 08:07