break 0.21.0 → 0.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7f110da48355f896a203303aa3e2222f353d0acbac0306727a3116f07df1b43
4
- data.tar.gz: '0917a04acaf202f58066d3d7f80b832c818bf8857b173e08dd09f7602c9ebfef'
3
+ metadata.gz: 9443110f09e59653a1336608fa1de1d3bc1e1a108a31bb3e6216443d44cc96cb
4
+ data.tar.gz: a7e3b2f728b0537bb878ee0d0db4d4235906c32806f9d84187e2a6254d91591e
5
5
  SHA512:
6
- metadata.gz: 5ccfe1ab0272bfc57abc8f8e052a44b3ff56f42ac7b5c0f6addbfde1df0f42026898ae791a8eddc5aa295520286cdac2c874000b582e96269541cc9c938dd947
7
- data.tar.gz: a42d6f8f47f17536ea8627160e6415101ff166e9022d83ff5fb5c88b437b50a842131f65012ce733c2f4365636e15061fb320a6e5e487c908b73c6672425cd9f
6
+ metadata.gz: ad6320a59b310ced431065562f8cd693f40beeca35e729bd15cb8eaae425ae2e8d499f6afa4428ae5cf5f0d14b19f1723dfbc0f783ffe378be3a28574373ce8b
7
+ data.tar.gz: 7950267f77100f32d0d168e0d773bbd1bc2c461cd76fe3a61d0a3b2cd862fabadeb77ce09d4dbb864b89b2fea55fef99e40633df67ee87140de75466768dacd4
data/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.21.0 (2020-08-19)
6
+ ### Fixed
7
+ - Fix broken `pry` commands like `ls`. ([@jamesfischer8][])
8
+
9
+ ## 0.20.0 (2020-07-30)
10
+ ### Added
11
+ - Support for `pry-remote`. ([@gsamokovarov][])
12
+ ### Fixed
13
+ - Fix `up` and `down` commands in `pry`. ([@gsamokovarov][])
14
+
15
+ ## 0.12.0 (2020-07-17)
16
+ ### Added
17
+ - Support for `pry` version `0.13` and above. ([@gsamokovarov][])
18
+ ### Fixed
19
+ - Fix a crash in multi-threaded environments. ([@gsamokovarov][])
20
+
21
+ ## 0.11.0 (2020-02-08)
22
+ ### Changed
23
+ - Requiring `pry` before `break` is no longer a prerequisite for automatic Pry integration. ([@gsamokovarov][])
24
+
25
+ [@gsamokovarov]: https://github.com/gsamokovarov
26
+ [@jamesfischer8]: https://github.com/jamesfischer8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Genadi Samokovarov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # Break
2
+
3
+ Break is a lightweight debugger for Ruby. It's written in plain Ruby and
4
+ doesn't have its own frontend. Once you put `gem "break"` in your `Gemfile`, it
5
+ integrates seamlessly with IRB or [Pry]. You have navigational commands like
6
+ `next` and `step` straight in your REPL session. You don't need to remember to
7
+ start your debugger or change your development flow. Break embraces your flow,
8
+ instead of forcing you to abide to yet another tool.
9
+
10
+ ## Features
11
+
12
+ - Control flow executing control.
13
+ - No runtime cost. The tracing instructions kick in only when navigating.
14
+ - Automatic integration with IRB and [Pry].
15
+ - Rails 6 constant auto loading support (not available in other Ruby debuggers).
16
+
17
+ ## Installation
18
+
19
+ Put `gem "break"` in your `Gemfile`. Then run `bundle install` and
20
+ `binding.irb` (or `binding.pry`) to your heart's desire.
21
+
22
+ ## Commands
23
+
24
+ The following commands are available in both IRB and [Pry].
25
+
26
+ Command | Description
27
+ ---------- | -----------
28
+ `next` | Continue to next line.
29
+ `step` | Step into method invocation.
30
+ `up` | Go up the stack.
31
+ `down` | Go down the stack.
32
+ `whereami` | Show the code surrounding the current debugged line.
33
+ `exit` | Disconnect the debugger and continue to run the program.
34
+
35
+ ## Usage
36
+
37
+ Add `break` in your application `Gemfile` and make sure to `require "break"`
38
+ early in your program setup. In a Rails application, `break` will be required
39
+ automatically and you don't need to worry about that.
40
+
41
+ ```ruby
42
+ gem "break"
43
+ ```
44
+
45
+ Break automatically injects its commands into `binding.irb` and `binding.pry`
46
+ (if available).
47
+
48
+ If you need to debug your program, type a `next` to go to the next line of
49
+ program execution or `step` to step into a method, block, or class/module
50
+ opening call. All of this, in the comfort of IRB or [Pry]. Simple!
51
+
52
+ ## Why we need a debugger in Ruby?
53
+
54
+ We had our fair share of abandoned Ruby debuggers written in C. During Ruby 1.8
55
+ and Ruby 1.9 days, the interpreter itself changed often and didn't provide a
56
+ stable API to aid the writing of development tools. This means that
57
+ [ruby-debug], a debugger written for Ruby 1.8 had to be rewritten for 1.9 (as a
58
+ different gem: [ruby-debug-base19]) and then again for Ruby 2.0. At this point
59
+ the development was halted as maintaining 3 different implementations is hard.
60
+
61
+ If we get better APIs in Ruby-land we won't run into the problems [ruby-debug]
62
+ did. Even better, the debuggers can be thin layers on top of the heavy-lifting
63
+ debugging instrumentation APIs that live in the interpreter themselves. This
64
+ way the interpreter internals can change as much as they want but if they
65
+ provide the same APIs, all of the debugging tools will still work. On top of
66
+ that, our debuggers will work on JRuby, TruffleRuby or whatever alternative
67
+ Ruby implementation is under active development at the time.
68
+
69
+ Break exists to implement a functional debugger in pure Ruby using the
70
+ [TracePoint API]. It also wants to serve as a catalyst for other Ruby-land
71
+ available APIs that are useful for implementing debugging tools.
72
+
73
+ Learn more from this [Ruby Russia talk]. ⚡️
74
+
75
+ [TracePoint API]: https://ruby-doc.org/core-2.6.2/TracePoint.html
76
+ [Pry]: https://github.com/pry/pry
77
+
78
+ [ruby-debug]: https://github.com/ruby-debug/ruby-debug
79
+ [ruby-debug-base19]: https://github.com/ruby-debug/ruby-debug-base19
80
+
81
+ [Ruby Russia talk]: https://www.youtube.com/watch?v=3QADeUVwJtA
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "rake/testtask"
2
+
3
+ Bundler::GemHelper.install_tasks name: ENV.fetch("GEM_NAME", "break")
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/*_test.rb"]
9
+ end
10
+
11
+ task default: :test
data/lib/break.rb CHANGED
@@ -12,3 +12,4 @@ require_relative "break/irb"
12
12
  require_relative "break/pry"
13
13
 
14
14
  Break::Filter.register_internal __dir__
15
+ Break::Filter.register_internal "<internal:"
@@ -10,13 +10,7 @@ module Break::IRB
10
10
 
11
11
  def attach(session)
12
12
  @workspace = IRB::WorkSpace.new(session.context.binding)
13
-
14
- begin
15
- @irb = IRB::Irb.new(@workspace)
16
- @irb.context.main.extend Commands.new(session)
17
- rescue TypeError
18
- return
19
- end
13
+ @irb = safely_build_irb_instance(session, @workspace)
20
14
 
21
15
  where
22
16
 
@@ -50,5 +44,24 @@ module Break::IRB
50
44
 
51
45
  irb_context
52
46
  end
47
+
48
+ # Trying to instantiate an `IRB:Irb` object with a workspace having a
49
+ # binding coming from `BasicObject`.
50
+ def safely_build_irb_instance(session, workspace)
51
+ irb = IRB::Irb.allocate
52
+ irb.instance_variable_set :@context, IRB::Context.new(irb, workspace, nil)
53
+ irb.instance_variable_set :@signal_status, :IN_IRB
54
+ irb.instance_variable_set :@scanner, RubyLex.new
55
+
56
+ begin
57
+ irb.context.main.extend IRB::ExtendCommandBundle
58
+ rescue NameError, TypeError
59
+ # Potential `NameError`: undefined method `irb_print_working_workspace' for class `#<Class:#420>'.
60
+ # Ignore it.
61
+ end
62
+
63
+ irb.context.main.extend Commands.new(session)
64
+ irb
65
+ end
53
66
  end
54
67
  end
data/lib/break/pry.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  begin
4
4
  require "pry"
5
- require "break"
6
5
 
7
6
  require_relative "pry/frontend"
8
7
  require_relative "pry/commands"
data/lib/break/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Break
4
- VERSION = "0.21.0"
4
+ VERSION = "0.30.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: break
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genadi Samokovarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-19 00:00:00.000000000 Z
11
+ date: 2021-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,6 +60,10 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - CHANGELOG.md
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
63
67
  - lib/break.rb
64
68
  - lib/break/binding_ext.rb
65
69
  - lib/break/command.rb
@@ -102,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
106
  - !ruby/object:Gem::Version
103
107
  version: '0'
104
108
  requirements: []
105
- rubygems_version: 3.0.3
109
+ rubygems_version: 3.2.3
106
110
  signing_key:
107
111
  specification_version: 4
108
112
  summary: Lightweight Ruby debugger