pry

Make Byebug finish executing without exiting Pry

安稳与你 提交于 2019-12-04 23:39:12
When I set a breakpoint with Byebug in Rails, I sometimes want it to finish executing, but the guide on github says to use exit which also exits Pry. Typing continue repeatedly can be annoying if the breakpoint is in a loop. Is there anyway to stop byebug without exiting the Rails console? Jagjot Singh When running byebug under the Rails console or in Rails' server I usually quit only byebug by hitting Ctrl + D . The catch with this approach is, if you do this in Rails' server then Byebug will not stop and debug the next time it hits a byebug statement in your code anywhere. But it works

Puma Rails 5 binding.pry only available for 60 seconds before timeout

旧时模样 提交于 2019-12-04 23:26:08
Puma times out my request when I'm using binding.pry . In my controller def new require 'pry' binding.pry end I then make a request that hits the controller and enter the pry session. After 60 seconds Puma? times out my request, restarts a worker and subsequently blows up by debugging session. [1] pry(#<Agent::ClientsController>)> [3522] ! Terminating timed out worker: 3566 [3522] - Worker 0 (pid: 4171) booted, phase: 0 I generated this app with suspenders if that matters. How do I extend my debugging session in rails 5? How about this? # config/puma.rb ... environment ENV['RACK_ENV'] ||

Pry-Remote with Pow on Rails 4

大兔子大兔子 提交于 2019-12-04 08:19:05
I'm busy with (finally) upgrading to Rails 4 and I've run into a problem with Pry-remote. Problem: When added binding.remote_pry to my code it breaks the code but when I can't get into the debugger by typing pry-remote . This used to work when running Rails 3 and Ruby 1.9.3. Side note: When running Rails s instead of Pow and binding.pry instead binding.remote_pry , it falls into the debugger. What I'm running: Pow 0.5.0 ruby 2.1.5p273 Rails 4.2.0 OSX 10.9.5 Gemfile gem 'pry' gem 'pry-remote' gem 'pry-stack_explorer' gem 'pry-rails' gem 'byebug' gem 'pry-byebug' Gemfile.lock pry (0.10.1)

Use Pry in gems without modifying the Gemfile or using `require`

佐手、 提交于 2019-12-04 01:42:23
I am trying to debug a gem that's used by a Rails app. I cloned the Gem locally to go prying around (and also allows me to do nice things such as git bisect , etc.) # Gemfile gem "active_admin", path: "~/dev-forks/active_admin" However, I am often stuck with adding Pry to a Gemfile somewhere to be able to use it, or calling require "pry" live in the code even though I don't want it in there. For example, I will sometimes forget about it, fix the bug, and then commit to the project with Pry in the Gemfile. Should I not do that, a LoadError will arise, cannot load such file -- pry (LoadError) .

How to adjust pry colors

夙愿已清 提交于 2019-12-03 12:29:44
问题 Edit: The faded gray is only an issue with version 0.9.7.3 and before. It has since been changed to a darker gray. Pry has nice colorizing, but the value returned when an object is created or changed is a faded gray that I can barely see. u = User.new =>#<User... <<<<<< This is what is barely readable. I tried messing with values in .pryrc, but couldn't get this, or any other color for that matter, to change. 回答1: Pry uses CodeRay for coloring, so you can put the following in your .pryrc file

Start ruby debugger if rspec test fails

三世轮回 提交于 2019-12-03 11:14:46
问题 Often, when a test fails, I spend quite sometime trying to figure out the what caused it to fail. It'd be useful if RSpec could kick off a Ruby debugger when the test fails, so that I can inspect the local variables immediately to drill down on the cause. The work-around I'm using right now looks something like this: # withing some test debugger unless some_variable.nil? expect(some_variable).to be_nil However, this approach is cumbersome, because I first wait for a test to fail, then add the

How to adjust pry colors

给你一囗甜甜゛ 提交于 2019-12-03 03:00:40
Edit: The faded gray is only an issue with version 0.9.7.3 and before. It has since been changed to a darker gray. Pry has nice colorizing, but the value returned when an object is created or changed is a faded gray that I can barely see. u = User.new =>#<User... <<<<<< This is what is barely readable. I tried messing with values in .pryrc, but couldn't get this, or any other color for that matter, to change. Pry uses CodeRay for coloring, so you can put the following in your .pryrc file: CodeRay.scan("example", :ruby).term # just to load necessary files TERM_TOKEN_COLORS = { :symbol => '1;31'

How to debug a rails app in docker with pry?

人走茶凉 提交于 2019-12-03 01:39:46
问题 I have a rails app running in a docker container in development environment. When I try to debug it with placing binding.pry somewhere in the code and attaching to the container I can see the pry prompt in the output but it doesn't pause on it and I can't interact with it like it was without docker container. So how do I debug a containerized app? 回答1: If you're using docker-compose, you can add these flags to docker-compose.yml : app: tty: true stdin_open: true And then attach to your

How to debug a rails app in docker with pry?

…衆ロ難τιáo~ 提交于 2019-12-02 15:31:58
I have a rails app running in a docker container in development environment. When I try to debug it with placing binding.pry somewhere in the code and attaching to the container I can see the pry prompt in the output but it doesn't pause on it and I can't interact with it like it was without docker container. So how do I debug a containerized app? Gabe Kopley If you're using docker-compose, you can add these flags to docker-compose.yml : app: tty: true stdin_open: true And then attach to your process with docker attach project_app_1 . pry-rails works here now. Ensure less is installed on your

Get pry to display characters like [äöüßÄÖÜß] (utf-8 encoding)? (Possibly Windows-specific issue?)

◇◆丶佛笑我妖孽 提交于 2019-11-30 22:50:10
[ All the scripts I'm working with with these German characters are in UTF-8 themselves, have #encoding: utf-8 at the top (and Encoding.external_default = 'utf-8' , not that that's really relevant I think because German chars in strings that are defined within the script don't get displayed right.) ] All these things display fine at the windows command prompt and using irb etc. I can't even enter these characters at the pry prompt, though. Attempting to paste in puts "äöüÄÖÜß" gets puts " . Attempting to actually type them freezes pry somehow, and I have to ^D out. Using pry, I ran a script