Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pry? #3

Closed
fredwu opened this issue Dec 9, 2012 · 23 comments
Closed

Support for pry? #3

fredwu opened this issue Dec 9, 2012 · 23 comments

Comments

@fredwu
Copy link
Contributor

fredwu commented Dec 9, 2012

Would be awesome to have Pry support in the web REPL. Something for reference: https://github.com/mrbrdo/rack-webconsole

@haileys
Copy link
Collaborator

haileys commented Dec 9, 2012

I'll investigate the feasibility of this.

@banister
Copy link

banister commented Dec 9, 2012

If you use pry, you get some stuff for free, such as edit -c which will opens the file associated with the backtrace level in an editor (with the cursor placed at the correct line). Not to mention the ls, cd, show-source, show-doc commands which are very useful for when drilling down the source of the error.

@haileys
Copy link
Collaborator

haileys commented Dec 10, 2012

pry

😉

@fredwu
Copy link
Contributor Author

fredwu commented Dec 10, 2012

Nice work! ;) 👍

@paradox460
Copy link

+1

1 similar comment
@mtarnovan
Copy link

+1

@34code
Copy link

34code commented Jan 21, 2013

+21

@rking
Copy link
Contributor

rking commented Feb 1, 2013

So, you can apparently do:

BetterErrors::REPL::PROVIDERS.unshift provider: 'better_errors/repl/pry', const: :Pry

And it's supposed to work. There's code in better_errors/repl/pry, all right, but I get an error that only shows up in the logs when I have that.

@haileys
Copy link
Collaborator

haileys commented Feb 2, 2013

@rking This is why I haven't enabled it by default yet. If you can open an issue with the error it gives you I'll get that fixed up for you!

@rking
Copy link
Contributor

rking commented Feb 2, 2013

Sure thing! According to my calculations, b_e + pry == bff.

Here's the backtrace: https://gist.github.com/raw/b18326ef5b4a2bfede69/962d06bc73b16f38a16f2cfc08ade6d4167619c6/a.rb

To reproduce:

git clone [email protected]:rking/monkeynote && cd monkeynote && bundle && rails s

Hitting the top URL will give you a prompt, but with a REPL that silently fails and gives backtraces on the terminal like the gist, above.

If I can be so greedy, would you accept a Pull Req for a shorter invocation?

BetterErrors.use_pry!

Thanks!

@rstacruz
Copy link
Collaborator

rstacruz commented Feb 2, 2013

I'd personally like "BetterErrors.configure { |c| c.interpreter = :pry }"
better.. More future proof. Just my $0.02 :-)

On Sunday, February 3, 2013, ☈king wrote:

Sure thing! According to my calculations, b_e + pry == bff.

Here's the backtrace:
https://gist.github.com/raw/b18326ef5b4a2bfede69/962d06bc73b16f38a16f2cfc08ade6d4167619c6/a.rb

To reproduce:

git clone [email protected]:rking/monkeynote && cd monkeynote && bundle && rails s

Hitting the top URL will give you a prompt, but with a REPL that silently
fails and gives backtraces on the terminal like the gist, above.

If I can be so greedy, would you accept a Pull Req for a shorter
invocation?

BetterErrors.use_pry!

Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-13033604.

@banister
Copy link

banister commented Feb 4, 2013

@rstacruz curious, how is it more future proof?

@rstacruz
Copy link
Collaborator

rstacruz commented Feb 4, 2013

Well, this is all up to Charlie, but as BetterErrors gets more configurable, the BetterErrors module may get polluted once you need more options:

# Sample only
BetterErrors.use_pry!
BetterErrors.set_theme :light
BetterErrors.supress_logs = true

@xdissent
Copy link

xdissent commented Feb 8, 2013

I had an issue with the current pry gem (0.9.11.4) that's addressed here: pry/pry#845
In short, use a pre-release pry gem or github for now.

@rking
Copy link
Contributor

rking commented Feb 26, 2013

I vote "Closed" on this one.

@miharekar
Copy link

I don't know if this is the right place to ask but I don't know where else too 😃

Anyhow, I'm using better_errors with pry and when I inspect vars in REPL I get weird stuff printed out:

>> params
=> {
  "controller"�[0;37m => �[0m�[0;33m"frontend"�[0m,
      "action"�[0;37m => �[0m�[0;33m"index"�[0m
}
>> @main_intro
=> #<Admin::Intro:0x007fd79f55edc0> {
          :id�[0;37m => �[0m�[1;34m1�[0m,
       :title�[0;37m => �[0m�[0;33m"This is awesome"�[0m,
        :body�[0;37m => �[0m�[0;33m"FUck yeah so awesome that it <b>hurts</b>!"�[0m,
  :created_at�[0;37m => �[0m�[0;32mThu, 23 May 2013 12:21:14 UTC +00:00�[0m,
  :updated_at�[0;37m => �[0m�[0;32mThu, 30 May 2013 12:05:32 UTC +00:00�[0m,
     :excerpt�[0;37m => �[0m�[0;33m"So awesome?"�[0m,
    :position�[0;37m => �[0m�[0;33m"Main"�[0m
}

What are all this [0;37m and similar and how do I get rid of them?

@duncanbeevers
Copy link

These are ANSI color codes. I'm not sure why colors aren't working in the
browser but you can disable Pry's colors entirely with Pry.config.color =
false

https://github.com/pry/pry/wiki/Customization-and-configuration#wiki-Config_color

On Thu, Jun 6, 2013 at 2:37 AM, Miha Rekar [email protected] wrote:

I don't know if this is the right place to ask but I don't know where else
too [image: 😃]

Anyhow, I'm using better_errors with pry and when I inspect vars in REPL I
get weird stuff printed out:

params
=> {
"controller"[0;37m => [0m[0;33m"frontend"[0m,
"action"[0;37m => [0m[0;33m"index"[0m
}
@main_intro
=> #Admin::Intro:0x007fd79f55edc0 {
:id[0;37m => [0m[1;34m1[0m,
:title[0;37m => [0m[0;33m"This is awesome"[0m,
:body[0;37m => [0m[0;33m"FUck yeah so awesome that it hurts!"[0m,
:created_at[0;37m => [0m[0;32mThu, 23 May 2013 12:21:14 UTC +00:00[0m,
:updated_at[0;37m => [0m[0;32mThu, 30 May 2013 12:05:32 UTC +00:00[0m,
:excerpt[0;37m => [0m[0;33m"So awesome?"[0m,
:position[0;37m => [0m[0;33m"Main"[0m
}

What are all this [0;37m and similar and how do I get rid of them?


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-19029339
.

@miharekar
Copy link

It is set to be false on default and it stays there even if I turn it to false 😕

@banister
Copy link

banister commented Jun 6, 2013

@mrfoto do you have awesome_print or some other plugin installed? that provides its own colors that are not controlled by pry

@miharekar
Copy link

Hah, yeah, jazz_hands installed it. And as far as I can tell there is no way to disable it, right?

@haileys
Copy link
Collaborator

haileys commented Jun 6, 2013

@mrfoto I've actually run into this issue personally with jazz_hands and Pry. Haven't had the time to look into what's going on though.

@miharekar
Copy link

This might not be ideal, but it works for me just fine. Right after use_pry! set the defaults for Awesome Print:

BetterErrors.use_pry!
AwesomePrint.defaults = {plain: true}

@haileys
Copy link
Collaborator

haileys commented Sep 8, 2013

Closing this as 1.0.0 will have pretty solid Pry integration.

Please open new issues if you find any bugs.

@haileys haileys closed this as completed Sep 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests