Trying to debug ruby 1.9.3p194 rails 3.2.7 - ruby-on-rails-3

Arg, looks like this is a fairly common problem but I can't seem to figure out how to get my debugger working. I've installed a myriad of gems to try to get this bad boy running but no luck. Here is a list for completeness. I've included my gemfile as well. As is probably quite obvious I'm a RoR newb. I'm using RubyMine as my IDE and upon trying to debug I get an error that states "The gem ruby-debug-base19x required by the debugger is not currently installed. Would you like to install it?". Of course, upon saying 'yes' to download the mirror is broken and the download fails resulting in the following error:
5:56:46 PM Error running Development: SponsorBid: Cannot start
debugger. Gem 'ruby-debug-ide' isn't installed or its executable
script 'rdebug-ide' doesn't exist.

Even though this question duplicates two other questions here, I'll answer it for the sake of completeness.
In order to debug from RubyMine you must use only 2 debug gems:
ruby-debug-base19x
ruby-debug-ide
Exactly these gems must be used, not ruby-debug-base19, not ruby-debug19, not debugger . All the other debug gems must be uninstalled and removed from the Gemfile.
See this answer for the details how to install proper debug gem versions. If you have a problem downloading linecache19-0.5.13.gem gem, try this mirror instead.
Verify with gem list that you have the following or more recent versions installed:
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.17.beta9)
No other debug gems should be listed by this command.
As stated in another answer, debugger gem must not be used, it will conflict with the debug gems used by RubyMine and debugger will not work. You must uninstall this gem, remove it from the Gemfile and ensure that your code doesn't call any methods from this gem and is not trying to load it.
Happy debugging!
As suggested by #Anjan, your Gemfile for debugging can look like this:
gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'
gem 'ruby-debug-base19x', '>= 0.11.30.pre10'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'`
Just run bundle install to get the proper versions of the required debug gems.

This is what I used in my Gemfile to install the required gems through bundler:
gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'
gem 'ruby-debug-base19x', '>= 0.11.30.pre10'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'`
No manual gem installation required and will automatically work on your fellow developers' computers.

Related

gem not working after installing 'thin' - rails 3.2.8

I got stuck in a dead end after trying to install the gem 'thin' on the environment
RHEL 6.0
Ruby 1.9.3
Rails 3.2.8
As indicated, I added
gem 'thin'
to my Gemfile and ran
bundle install
The installation seemed to be successful, but after that, whenever I run 'gem', I get
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
While if I run again 'bundle install' I get
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at
http://bit.ly/bundler-issues. Thanks!
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
I even tried to follow troubleshooting at https://github.com/bundler/bundler/blob/master/ISSUES.md but nothing has changed.
Looks like there's something corrupted in the eventmachine gem installation, but I can't neither uninstall or reinstall it.
Has anybody got an idea?
I would like at least to be able to revert to the (working) configuration prior to thin installation....

Can't remove gem

Have a very strange problem. I have RVM and rails project. I used 'breadcrumbs_on_rails' gem and I had it in my Gemfile. After one update I got some errors in this gem, so I tried to roll back to previous version. I wrote version in Gemfile, ran bundle update - but nothing changed, there were still errors. I tried totally remove this gem from Gemfile, but... it's helpers were still working! I uninstalled gem completely, all versions, by running gem uninstall, cleared tmp folder of project, rebooted, but it is still working. What can be the reason?
Have you tried using
bundle exec gem uninstall GEM_NAME
For RVM users:
you have to use this method if you've set up a gemset for your particular project.
Running gem uninstall GEM_NAME from the project folder will uninstall GEM_NAME from your global/system level gemset instead of bundler's.
Problem was in conflict of two gems
gem twitter-bootstrap-rails have exactly same methods - add_breadcrumb and render_breadcrumbs. And breadcrumbs were rendered by this gem, not by breadcrumbs_on_rails.
So, it turns out, that gem was removed successfully

Omniauth + Devise Error: Could not find hashie-1.2.0

I add this to Gemfile:
gem 'omniauth-facebook'
Then I run bundle update. No problem so far. But when I run rails server I get this error:
Could not find hashie-1.2.0 in any of the sources
Run `bundle install` to install missing gems.
I thought that bundler was supposed to resolve and satisfy all dependencies, but I tried this anyway:
gem install hashie-1.2.0
Which gave this:
ERROR: Could not find a valid gem 'hashie-1.2.0' (>= 0) in any repository
ERROR: Possible alternatives: hashie-model
I'm new to Rails and I feel I'm at a dead end. Suggestions?
UPDATE: I also have run bundle install (to be exact bundle install --without production) several times. I get the same error when running rails server after that.
UPDATE: I aslo tried adding gem 'hashee' in the Gemfile before omniauth-facebook. No luck.
So I think you are just using bunder incorrectly.
bundle update doesn't resolve new dependencies, it simply looks at the gem manifest, which is stored in Gemfile.lock and updates those gems to the most recent gem allow by the constraints placed on them in the Gemfile.
Since you are trying to install a new gem, what you what to run is bundle install which will make a comparison between your Gemfile and your Gemfile.lock and install any gems that are not listed in your Gemfile.lock.
I think bundle install should do the trick for you.
As a side note, bundler tries to make this as easy as possible for you by aliasing bundle to bundle install. So, unless you are explicitly looking to update your gems, you can just type bundle and get the behavior that you are expecting.
I got it working. I think it was some problem with bundler. I did some different things, and I have to admit that I'm not 100% sure what fixed it. I think what did it was this:
gem uninstall bundler
gem install bundler
bundle install mail
However, it did not work until my second reinstall I think. Upon the install command, it installed everything, not just mail and its dependencies. The only other thing I did was to delete /usr/bin/bundler after the first reinstall. It did not reappear.

How does bundler know which version of a gem to install?

I have been using the less-rails-bootstrap gem from https://github.com/metaskills/less-rails-bootstrap in my rails 3.1 project.
I want to upgrade to the 2.0wip version of bootstrap and I found a fork with the same name under https://github.com/sgruhier/less-rails-bootstrap
Both version say to install you add gem 'less-rails-bootstrap' to your gemfile.
Well, how is bundler going to know which one to use? What if 20 people had gems with the exact same name?
I guess the bigger question is how to I specify which gem to use?
Bundler will use the one found on http://rubygems.org, which is the one at the first link you posted.
When trying to use an unreleased branch/fork, you should pass the :git option in your Gemfile to tell Bundler to use that git repository:
gem 'less-rails-bootstrap', :git => "git://github.com/sgruhier/less-rails-bootstrap.git"

ruby_threadptr_data_type error

I'm starting up a new rails app with the latest version of rails (3.1.3). Rails crashes when I try to start up the server. First I fixed this bug, and now I'm getting this one
ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type
There's a discussion about this going on here, but I can't make enough sense of it to get things to work.
UPDATE
I updated the version of ruby-debug
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
and have now moved on to this error
linecache19-0.5.12/lib/trace_nums19.so: undefined symbol: ruby_current_thread
Ok, it turns out that both ruby-debug and linecache needed to be manually updated to the latest versions. These lines in my gemfile did the trick
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'
To run specs, you need to run bundle exec rspec -d spec
At last I found the problem. The debugger in RubyMine starts without bundle exec, so it doesn't use linecache19 from git. You need to install it manually.
Resolution of the problem found here: http://youtrack.jetbrains.com/issue/RUBY-9418?projectKey=RUBY
gem uninstall linecache19
gem uninstall ruby-debug-base19x
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19x –-pre
Make sure to uninstall all linecache19 and ruby-debug-base19x!
The following lines worked for me:
gem 'linecache19'
gem 'ruby-debug-base19x'
gem 'ruby-debug19', :require => 'ruby-debug'
(Hat tip to declan. His comment didn't work for me, but it gave me the idea to add linecache19.)
after trying all advise on stackoverflow, the following combination worked for me
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'
I'm running Rails 3.1.3 on Ruby 1.9.3-p0 with RVM
when I set :require => 'ruby-debug' the server would not start.
It's repost from this
I also ran into this, and found the solution in Ruby 1.9.3 and ruby-debug. You need to install not-yet-officially-released versions of ruby-debug-base19 and linecache19. The currently released versions indeed cause the exception you had.
Use this gist.
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883
linecache19-0.5.13.gem
ruby_core_source-0.1.5.gem
ruby-debug19-0.11.6.gem
ruby-debug-base19-0.11.26.gem
#Then in your console
export RVM_SRC=/your/path/to/ruby-1.9.3
# Note, your source path should be something like /home/user/.rvm/src/ruby-1.9.3-p0
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC
I tried it and it's work!
This is solve of our problems.