루비 1.9.3의 루비 디버그?
방금 Ruby 1.9.3p0 및 Rails 3.1.1로 업데이트했습니다. 이제 서버를 시작하려고 할 때 ruby-debug
이미 설치되어 있어도 설치해야한다고 불평합니다 .
% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
내 Gemfile에는
# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"
최신 버전의 Ruby로 디버그를 실행할 수 있습니까?
업데이트 (2012 년 4 월 28 일)
ruby-debug 대신 새로운 디버거 gem을 사용 해보세요 .
( @ryanb에 대한 크레딧 )
업데이트 (2012 년 3 월 2 일)
linecache19 및 ruby-debug-base19의 설치는 다음과 같이 쉽게 수행 할 수 있습니다.
bash < <(curl -L https://raw.github.com/gist/1333785)
원래 답변
ruby-1.9.3-preview1 에서 ruby-debug19를 보셨습니까 ?
다음은 임시 해결책입니다. http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
사이트에서 발췌 :
먼저 http://rubyforge.org/frs/?group_id=8883 에서 linecache19-0.5.13.gem 및 ruby-debug-base19-0.11.26.gem을 다운로드 한 다음…
$ gem install linecache19-0.5.13.gem Building native extensions. This could take a while... Successfully installed linecache19-0.5.13 1 gem installed $ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/santiago/.rbenv/source/ruby-1.9.3-p0 Building native extensions. This could take a while... Successfully installed ruby-debug-base19-0.11.26 1 gem installed $ irb irb(main):001:0> require 'ruby-debug' => true
linecache19 및 ruby-debug-base19의 설치는 다음과 같이 쉽게 수행 할 수 있습니다.
bash < <(curl -L https://raw.github.com/gist/1333785)
다른 누군가가 Pry를 시도하기 위해 댓글을 올렸습니다. 이것이 Rails에 필요한 것입니다.
# Gemfile
gem 'pry-rails'
# In your Rails Project where you want a 'debugger'
puts 'i want to insert some code between this'
binding.pry
puts 'and this'
설치 직후에 .irbrc
로드되지 않아 콘솔 출력이 잘 나오지 않습니다. 나는 또한 이것을 내 '~ / .pryrc'에 추가했습니다.
# setting up pry to have irb helpers like reload!
if defined?(Rails) && Rails.env
extend Rails::ConsoleMethods
end
Pry는 내가 확인하고 싶었던 몇 가지 멋진 기능을 가지고 있지만 Ruby 1.9.3 용 Rails 프로젝트에 통합하는 간단한 방법이 있으면 Ruby-debug로 돌아갈 수 있습니다. 다른 답변에서 curl 명령을 실행할 수 있지만 이것은 Rails 프로젝트에서 팀원을 가리켜 야하므로 IMO가 제대로 확장되지 않습니다.
Maybe not the definitive answer to this question, but I was lead here by a chain of closed duplicates.
For me the problem was that I run a project in both ruby 1.8 and ruby 1.9, and my Gemfile needed this change:
gem 'debugger', :require => 'ruby-debug', :platforms => :mri_19
gem 'ruby-debug', :platforms => :mri_18
Now it works for both rubies.
For more info see here: http://gembundler.com/man/gemfile.5.html#PLATFORMS-platforms-
For Windows Users:
First Download :linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem From : http://rubyforge.org/frs/?group_id=8883&release_id=46303
Assumption: Ruby is in c:\Ruby1.93
put the gem files downloaded to c:\temp (linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem)
then execute from command line:
gem install c:\temp\linecache19-0.5.13.gem
gem install c:\temp\ruby-debug-base19-0.11.26.gem -- --with-ruby-include=C:\Ruby1.93\include\ruby-1.9.1\ruby-1.9.3-p0
BTW, if you use the newest patch for ruby1.9.3 (falcon, https://gist.github.com/1688857), use following commands
wget http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
wget http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install linecache19-0.5.13.gem
## with rvm:
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/src/ruby-1.9.3-p0-falcon
## with rbenv (this is a guess):
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rbenv/source/ruby-1.9.3-p0-falcon
See my answer here : Ruby-debug not working - Stack Overflow
It's about getting Ruby debugging to work with the following setup
- Mac OS X Lion 10.7.2
- Aptana Studio 3 (Build 3.0.8.201201201658)
Using rvm, in my project working directory I have a .rvmrc stating:
rvm use ruby-1.9.3-p0@mygemset
Basically, I had to use :
linecache19 (0.5.13)
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.16)
Note that I'm not using ruby-debug-base19 but ruby-debug-base19x
I hope this helps!
-- Freddy
Also you need to check if the gem 'ruby_source_code' is already installed.
Check: http://bugs.ruby-lang.org/issues/1857#note-8
If you don't have rvm and assuming you ruby installation is in /usr/local/ruby-1.9.3-po your can use this command:
curl -L https://raw.github.com/gist/1533750 | sudo /bin/bash
참고URL : https://stackoverflow.com/questions/8087610/ruby-debug-with-ruby-1-9-3
'programing tip' 카테고리의 다른 글
$ .ajax를 사용하여 JSON 데이터를 게시 할 때 AntiForgeryToken을 어떻게 제공 할 수 있습니까? (0) | 2020.11.01 |
---|---|
Visual Studio에서 {를 새 줄에 넣지 않도록하는 방법? (0) | 2020.11.01 |
System.Web.Mvc.HtmlHelper가 표시되지 않는 Razor보기 (0) | 2020.11.01 |
data.table의 지정된 모든 열에 동일한 함수를 적용하는 방법 (0) | 2020.11.01 |
LINQ에서 Include ()는 무엇을합니까? (0) | 2020.11.01 |