I am new to Sinatra and I am trying to make a database using SQLite3 and Datamapper. I installed both gems and also the adaptor and then tried to execute this code in a file:
#config
require 'sinatra'
require 'sinatra/contrib' if development?
require 'data_mapper'
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")
DataMapper.finalize.auto_upgrade!
The command line gave me this error when I executed the file:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found. -
C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)
and then a lot of other things which went wrong because of these errors.
I tried reinstalling many of the gems but nothing seems to have worked.
EDIT: The full error code was this:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found. - C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:31:in `rescue in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:26:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter/adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:230:in `setup'
from test.rb:7:in `<main>'
I had this problem, using ruby 1.9.3 on windows - fixed it by downloading the sqlite3.dll from http://www.sqlite.org/download.html and putting it in C:\Ruby193\bin
Try adding:
require 'dm-sqlite-adapter'
If that doesn't fix things, you could also try changing
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")
to
DataMapper.setup(:default, 'sqlite:recall.db')
and see if that fixes it. I really don't know the cause, but doing the above (single quotes, no "3", and no path) fixed an error I was receiving when trying a particular setup.
Related
I created a new rails application using Rails Composer and it was able to see all the project files.
However, if I start rails server, I'm getting following error -
/Users/aniruddhabarapatre1/RubyRails/rails-bootstrap/config/application.rb:7:in `<top (required)>': uninitialized constant Bundler (NameError)
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247#rails-bootstrap/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247#rails-bootstrap/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
from /Users/aniruddhabarapatre1/.rvm/gems/ruby-2.0.0-p247#rails-bootstrap/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from bin/rails:4:in `<main>'
I am unsure of what I'm missing here. I tried searching for solution by looking for the error, but with no success.
It used to work just fine. Not sure what has changed,
i get this error:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- netrc (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Users/ilan kasan/.heroku/client/lib/heroku/auth.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Users/ilan kasan/.heroku/client/lib/heroku/client.rb:4:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/heroku-2.8.0/lib/heroku.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/heroku-2.8.0/bin/heroku:6:in `<top (required)>'
from c:/Ruby192/bin/heroku:19:in `load'
from c:/Ruby192/bin/heroku:19:in `<main>'
The problem seems to occur after the latest Windows7 update. I found a proposed solution in the issue list of Heroku: https://github.com/heroku/heroku/issues/298
I fixed it again by deleting /users/me/.heroku/client and reinstalling
from https://toolbelt.heroku.com/
So delete ~/.heroku/client folder and reinstal Heroku Toolbelt. I hope it helps.
Problem solved by updating the heroku gem
gem update heroku
---------------- 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
You have to install dm-postgres-adapter(gem install dm-postgres-adapter) then install data_mapper(gem install data_mapper).
I am using RubyMine on windows so I can run a given ruby on rails application. When I click run I get the following error:
C:\Ruby192\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) "F:/Aurora Zoo Project/zooniverse-Juggernaut-a46b0ba558f0cbeb8e9b581513691566d7f19c2f/script/rails" server -b 127.0.0.1 -p 3000 -e development
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `require': 126: The specified module could not be found. - C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so (LoadError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:7:in `rescue in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/mysql.rb:2:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
from F:/Aurora Zoo Project/zooniverse-Juggernaut-a46b0ba558f0cbeb8e9b581513691566d7f19c2f/config/application.rb:7:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands.rb:28:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
from F:/Aurora Zoo Project/zooniverse-Juggernaut-a46b0ba558f0cbeb8e9b581513691566d7f19c2f/script/rails:9:in `require'
from F:/Aurora Zoo Project/zooniverse-Juggernaut-a46b0ba558f0cbeb8e9b581513691566d7f19c2f/script/rails:9:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
I am not really familiar with ruby, but it says something about "mysql" which I have installed and added to the PATH variable.
Any help? Thx
The mysql gem that you installed expect an specific version of MySQL libmysql.dll be available in your system (when you gem install mysql it display the proper legend in the console).
mysql_api.so is failing to load and thus, generating the error you're seeing.
I've blogged about an alternate approach to install and compile the MySQL component independently of the version of MySQL you have installed.
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
Hope that helps.
This is probably version problem. I do had a same issue when i used old mysql version with new mysql gem.
Kindly find the correctly gem required for you mysql server.
I am trying to run the wsdl2ruby.rb script that comes with the soap4r gem, and get the following errors:
[ral#lap etc]$ ruby /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb
/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/charset.rb:13: warning: variable $KCODE is no longer effective
/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/property.rb:68: warning: encoding option is ignored - u
/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/property.rb:69: warning: encoding option is ignored - u
/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/soap/property.rb:70: warning: encoding option is ignored - u
/usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb:74:in `<top (required)>': XML processor module not found. (RuntimeError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/parser.rb:13:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:11:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/importer.rb:9:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/wsdl/soap/wsdl2ruby.rb:11:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/bin/wsdl2ruby.rb:5:in `<main>'
I have the following gems installed:
httpclient (2.2.0.1) minitest (1.6.0)
rake (0.8.7) rdoc (2.5.8) soap4r
(1.5.8)
I have tried to install the xml parser gem which fails with loads of errors: http://pastie.org/1822127
Does anyone know what the problem is? This is my first time touching Ruby.
Is soap4r the best tool for the job for making a SOAP webservice client?
Thanks a lot!
The answer posted at
http://railsforum.com/viewtopic.php?id=41231
worked for me. That is, I edited the file rubyhome/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb and changed line 66 from:
c.downcase == name
to
c.to_s.downcase == name
and the problem appears to be solved.
You might also try the new official repo on Github that has this fix, and others applied to the master branch. You'll need to set your Gemfile to use the git repo as such:
gem 'soap4r', :git => 'git://github.com/felipec/soap4r.git'