How do I get ruby-debug to run under XP so that I can step through my Watir test scripts.
I am unable to "require" ruby-debug on Windows XP. All of the solutions I have seen refer to a Unix-based system running Rails. Here is my system profile:
H:\>ruby -v
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
Here are the gems I have installed to support my testing in Watir
H:\>gem list
*** LOCAL GEMS ***
archive-tar-minitar (0.5.2)
awesome_print (1.0.2)
bigdecimal (1.1.0)
childprocess (0.2.4)
columnize (0.3.6)
ffi (1.0.11)
io-console (0.3)
json (1.5.4)
linecache19 (0.5.13)
minitest (2.5.1)
mkrf (0.2.3)
multi_json (1.0.4)
net-ssh (2.2.1)
rake (0.9.2.2)
rdebug (0.1)
rdiscount (1.6.8)
rdoc (3.9.4)
ruby-debug-base19x (0.11.30.pre4)
ruby_core_source (0.1.5)
rubygems-update (1.8.13)
rubyzip (0.9.5)
selenium-webdriver (2.15.0)
watir-webdriver (0.4.1)
wirble (0.1.3)
This is the error that presents itself when I try to "require" ruby-debug.
Error:
irb(main):001:0> require 'ruby-debug'
LoadError: cannot load such file -- ruby-debug
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from C:/Ruby/bin/irb:12:in `<main>'
irb(main):002:0>
ruby-debug has been broken with recent ruby versions for a very long time. Try the debugger gem instead. I've no idea if it works on Windows though.
try this
gem install ruby-debug --pre
Related
I have Ruby 2.2.2, I have already watir-webdriver gem installed, when I run following script
require 'rubygems'
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
It gives in
`require': cannot load such file -- watir-webdriver(LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
I have rubymine 7.1.2
Here is my gem list
$ gem list
* LOCAL GEMS *
bigdecimal (1.2.6)
bundler (1.10.3)
bundler-unload (1.0.2)
childprocess (0.5.6)
executable-hooks (1.3.2)
ffi (1.9.8)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.1)
multi_json (1.11.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rubyzip (1.1.7)
rvm (1.11.3.9)
selenium-webdriver (2.46.2)
watir-webdriver (0.7.0)
websocket (1.2.2)
yard (0.8.7.6)
Please suggest what to do?
/System/Library/Frameworks/Ruby.framework/Versions/2.0/... is the system library in OS X Yosemite.
Ruby 2.2 (or any other version) is installed by you or some other user -- perhaps via RVM, given you have some rvm gem installed? If so you need to use RVM to change the default. If you did not install RVM correctly or ignored some warning or command it gave to you, you might want to re-install.
If you did not install Ruby 2.2 via RVM*, here are instructions for changing OS X default Ruby installed using Brew.
(*I could not recommend RVM more strongly. Other people like rbenv to do the same job.)
I'm writing Ruby scripts on Linux Mint 14 under RVM. In both Ruby 2.0 and 1.9.3, when I try to run what I'm working on, I get the error:
/home/tom/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- Nokogiri (LoadError)
from /home/tom/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from make_index.rb:1:in `<main>'
Nokogiri is installed; gem list gives:
*** LOCAL GEMS ***
bigdecimal (1.1.0)
bundler (1.3.5)
bundler-unload (1.0.1)
io-console (0.3)
json (1.5.5)
mini_portile (0.5.1)
minitest (2.5.1)
nokogiri (1.6.0)
rake (10.1.0, 0.9.2.2)
rdoc (3.9.5)
rubygems-bundler (1.2.1)
rvm (1.11.3.8)
The file in question starts with require 'Nokogiri'. Running the file with sudo doesn't make a difference, nor does using the terminal vs. running it in Geany.
Not Nokogiri rather, you should write as below
require 'nokogiri'
See SYNOPSIS:
Using jruby-1.6.7 via rvm and gem version 1.8.24 I created a new project containing a Gemfile:
source 'http://rubygems.org'
gem 'google-api-client'
and a main.rb:
require 'google/api_client'
After
gem install bundler
bundle install
gem list
I get
addressable (2.2.8)
autoparse (0.3.1)
bouncy-castle-java (1.5.0146.1)
bundler (1.1.4)
extlib (0.9.15)
faraday (0.8.1, 0.7.6)
ffi (1.0.11 java)
google-api-client (0.4.3)
jruby-launcher (1.0.14 java)
jruby-openssl (0.7.7)
json (1.7.3 java)
jwt (0.1.4)
launchy (2.1.0 java)
multi_json (1.3.6)
multipart-post (1.1.5)
rack (1.4.1)
rake (0.9.2.2)
rubygems-bundler (1.0.2)
rubygems-update (1.8.24, 1.7.2)
rvm (1.11.3.3)
signet (0.3.4)
spoon (0.0.1)
But when I run ruby main.rb, it results in an error:
LoadError: no such file to load -- google/api_client
require at org/jruby/RubyKernel.java:1033
(root) at main.rb:1
On MRI everything seems to be working fine. The problem does not seem bound to any specific gem.
Can someone help me with this?
Unless you have JRUBY_OPTS=--1.9 in your environment, or you pass the --1.9 flag on the command line, JRuby will default to 1.8 mode, which means that you explicitly have to require 'rubygems' in main.rb before you load your gems.
I'm learning to use Sinatra + Datamapper to build a lightweight webapp.
I ran gem install sqlite3 datamapper dm-sqlite-adapter and it seemed to have successfully installed...
I then tried to execute my .rb file which starts with:
require 'sinatra'
require 'datamapper'
and I got an error that it could not find the datamapper file.
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- datamapper (LoadError)
I also tried with require 'data_mapper' since there is conflicting information on the internetz as to the correct spelling of that gem, but same result.
I then listed all my installed gems (see below) and realilsed that there is no such gem as datamapper or data_mapper. I read so,ewhere that it is a meta-gem, I guess that means it doesn't actually install that one gem but rather all the gems starting with dm- ?
As a last resort I tried gem install data_mapper
and I got the ill fated:
C:\Users\Manu\Sinatra>gem install data_mapper
Building native extensions. This could take a while...
ERROR: Error installing data_mapper:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,operable program or batch file.
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.4 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.4/ext/json/ext/parser/gem_make.out
I searched all over and just couldn't find anything to help me troubleshoot this, so hopefully there's someone roaming this forum with a magic wand and a pointy hat!
Many thanks
PS: I'm running ruby 1.9.2p0 installed with the installer
* LOCAL GEMS *
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (3.0.3)
activemodel (3.0.3)
activerecord (3.0.3)
activeresource (3.0.3)
activesupport (3.0.3)
addressable (2.2.6)
arel (2.0.6)
backports (2.3.0)
builder (2.1.2)
bundler (1.0.7)
cgi_multipart_eof_fix (2.5.0)
data_objects (0.10.7)
diff-lcs (1.1.3)
dm-aggregates (1.2.0)
dm-constraints (1.2.0)
dm-core (1.2.0)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-sqlite-adapter (1.2.0)
dm-transactions (1.2.0)
do_sqlite3 (0.10.7 x86-mingw32)
erubis (2.6.6)
fastercsv (1.5.4)
gem_plugin (0.2.3)
growl (1.0.3)
i18n (0.5.0)
json_pure (1.6.4)
mail (2.2.12)
mime-types (1.16)
minitest (1.6.0)
mongrel (1.1.5 x86-mingw32)
multi_json (1.0.4)
polyglot (0.3.1)
rack (1.4.0, 1.2.1)
rack-mount (0.6.13)
rack-protection (1.2.0)
rack-test (0.5.6)
rails (3.0.3)
railties (3.0.3)
rake (0.8.7)
rdoc (2.5.8)
rspec (2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
rspec-mocks (2.8.0)
rubygems-update (1.8.15)
sinatra (1.3.2)
sqlite3 (1.3.5 x86-mingw32)
sqlite3-ruby (1.3.3, 1.3.2 x86-mingw32)
sys-uname (0.9.0 x86-mingw32)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.9)
trollop (1.16.2)
tzinfo (0.3.23)
yard (0.7.4)
It seems the RubyInstaller Development Kit is missing:
http://rubyinstaller.org/add-ons/devkit/
The devkit installs a C-compiler (and some other stuff like make) to compile C-written parts.
Install it and try again to install the gem - perhaps with option --platform=ruby.
Details can be found at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
I successfully installed gem clockwork
C:\web>gem install clockwork
Successfully installed clockwork-0.2.3
1 gem installed
Installing ri documentation for clockwork-0.2.3...
Installing RDoc documentation for clockwork-0.2.3...
but when running simple script
require 'rubygems'
require 'clockwork'
include Clockwork
every(1.minute, 'custom.event.handler' ) do
puts "This event has its own handler - #{Time.new.strftime("%Y%m%d%H%M%S")}"
end
I get this error
C:\web>ruby clockwork.rb
./clockwork.rb:3: uninitialized constant Clockwork (NameError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from clockwork.rb:2
Any suggestion how to make clockwork work on
Windows XP
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
gem 1.3.7
C:\web>gem list --local
*** LOCAL GEMS ***
aaronh-chronic (0.3.9)
activesupport (3.0.9)
backports (1.18.2)
clockwork (0.2.3)
daemons (1.1.0)
delayed_job (2.0.3)
eventmachine (0.12.10 x86-mswin32-60)
fastercsv (1.5.4)
haml (3.0.21)
i18n (0.6.0)
json (1.5.1)
mechanize (1.0.0)
monkey-lib (0.5.4)
nokogiri (1.5.0 x86-mingw32, 1.4.3.1 x86-mingw32)
rack (1.2.1)
rdiscount (1.6.8)
ruby-growl (3.0)
sinatra (1.2.6, 1.0)
sinatra-advanced-routes (0.5.1)
sinatra-reloader (0.5.0)
sinatra-sugar (0.5.1, 0.5.0)
thin (1.2.7 x86-mswin32)
tilt (1.3)
Let me give you a hint. The name of your own program is clockwork.rb, and in it you do:
require 'clockwork'
See the problem?
you need to include the following in your clock.rb
require './config/boot'
require './coonfig/environment'