ruby_jard 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +34 -12
- data/docs/color_schemes/256.png +0 -0
- data/docs/color_schemes/deep-space.png +0 -0
- data/lib/ruby_jard.rb +5 -1
- data/lib/ruby_jard/color_schemes.rb +5 -1
- data/lib/ruby_jard/commands/color_scheme_command.rb +42 -0
- data/lib/ruby_jard/commands/list_command.rb +1 -0
- data/lib/ruby_jard/config.rb +50 -0
- data/lib/ruby_jard/control_flow.rb +10 -9
- data/lib/ruby_jard/decorators/path_decorator.rb +1 -1
- data/lib/ruby_jard/repl_processor.rb +5 -0
- data/lib/ruby_jard/repl_proxy.rb +1 -1
- data/lib/ruby_jard/screen_manager.rb +9 -3
- data/lib/ruby_jard/screens/backtrace_screen.rb +1 -1
- data/lib/ruby_jard/screens/threads_screen.rb +1 -1
- data/lib/ruby_jard/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fb53f5406279a5047c3f73ec387bcb889e98e31ed7352393a459d8bc2611e08
|
4
|
+
data.tar.gz: f136e3adb604ce7b469d3528fdf5af617776e25feeeb303f45a94189a94803b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f44eebc7ef5d413fb8b6ac44b5575a4ac31b71ad419a7800be68884d1c32564738c2d84276d471704c22bdad4cc36173f30bcfe8111f1081a002d7d343fcd400
|
7
|
+
data.tar.gz: 353d35eabfc1a3eb33e32a2c193bb3261b68e794c9a2293f335245f57b23fdf45405b70c6fb9071d10867c56a1051ac4f987c20199931fd5224af0d1d92a545e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.2.2 - Alpha 3]
|
4
|
+
|
5
|
+
### UX/UI
|
6
|
+
- Add `wehereami` as an alias for `list` command
|
7
|
+
- Add `theme` command to switch theme at runtime
|
8
|
+
- Load configuration file when Jard starts
|
9
|
+
|
10
|
+
### Bug fixes
|
11
|
+
- Backward compatible issue: Array#filter is available in ruby 2.5.x and above.
|
12
|
+
- Fix Jard is bypassed when writting something to stdout while debugging (https://github.com/nguyenquangminh0711/ruby_jard/pull/5)
|
13
|
+
|
3
14
|
## [0.2.1 - Alpha 3] - Render mechanism and theme system
|
4
15
|
### UX/UI
|
5
16
|
- New color scheme: 256, as the default color scheme. It works well with all 256-color terminal emulators.
|
data/README.md
CHANGED
@@ -1,21 +1,13 @@
|
|
1
1
|

|
2
2
|
|
3
|
-
Jard stands for Just Another Ruby Debugger, aims to provide a better experience while debugging Ruby. Ruby Jard
|
4
|
-
|
5
|
-
- Informative Terminal UI, reduce your mental effort for repeated stuff so that you can focus on killing bugs.
|
6
|
-
- Highlighted source code screen.
|
7
|
-
- Backtrace visualization and navigation.
|
8
|
-
- Auto variable display in the current context.
|
9
|
-
- Multi-thread exploration and debugging.
|
10
|
-
|
11
|
-
Ruby Jard's core is [Byebug](https://github.com/deivid-rodriguez/byebug), an awesome de factor debugger for Ruby. Therefore, Ruby Jard supports most of Byebug's functionalities.
|
12
|
-
|
13
|
-
If you still don't know what it is, let's watch this video.
|
3
|
+
Jard stands for Just Another Ruby Debugger, aims to provide a better experience while debugging Ruby. Ruby Jard provides modular visual interfaces to show relevant information about your debugging program. Those interfaces are optimized for usability, and highly friendly to developers, especially new comers. They help you reduce the commands you need to type, the mental efforts wasted trying to navigate and grab the information you need. As a result, you can now focus more on the debug flow.
|
14
4
|
|
15
5
|
[](https://asciinema.org/a/350233)
|
16
6
|
|
17
7
|
*[(Click for demo video)](https://asciinema.org/a/350233)*
|
18
8
|
|
9
|
+
Ruby Jard's core is [Byebug](https://github.com/deivid-rodriguez/byebug), an awesome de factor debugger for Ruby. Therefore, Ruby Jard supports most of Byebug's functionalities.
|
10
|
+
|
19
11
|
## Getting Started
|
20
12
|
|
21
13
|
**Warning**: Ruby Jard is still under heavy development. Bugs and weird behaviors are expected. If you see one, please don't hesitate to open an issue. I'll try my best to fix.
|
@@ -110,7 +102,7 @@ An interactive Repl for you to interact with your program, inspect values, updat
|
|
110
102
|
|
111
103
|
**Key binding:** F5
|
112
104
|
|
113
|
-
**Alias**: `l`
|
105
|
+
**Alias**: `l`, `whereami`
|
114
106
|
|
115
107
|
Refresh the whole terminal UI. This command doesn't move you to other steps, nor change any data in your session. It is useful (or the only way) to get back the beautiful UI if you type too much in the REPL console.
|
116
108
|
|
@@ -186,6 +178,36 @@ Explore the lower frame. See `up` command for more information.
|
|
186
178
|
|
187
179
|
Explore a particular frame with id `<frame_id>`. It's faster than `up` and `down`. See `up` command for more information.
|
188
180
|
|
181
|
+
## Color schemes
|
182
|
+
|
183
|
+
| Name | Screenshots |
|
184
|
+
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
185
|
+
| `256` <br />Default theme, 256 basic colors, supported by all terminals | <img src="./docs/color_schemes/256.png" style="max-width: 400px;" /> |
|
186
|
+
| `deep-space` | <img src="./docs/color_schemes/deep-space.png" style="max-width: 400px;" /> |
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
## Configuration
|
191
|
+
|
192
|
+
Ruby Jard supports customization via pre-loaded configuration files. You can configure Jard both globally, and per-project.
|
193
|
+
|
194
|
+
- The global configuration file is located at `~/.jardrc`.
|
195
|
+
- The project configuration file is located at `.jardrc` in working directory when you start Ruby Jard. Per-project ones will override, and merge with global ones.
|
196
|
+
|
197
|
+
There are some supported configurations:
|
198
|
+
|
199
|
+
| Name | Description | Default |
|
200
|
+
| -------------- | ------------------------------------------------------------ | ------- |
|
201
|
+
| `color_scheme` | Choose your favorite color scheme. The list of color schemes can be looke up in [Color schemes session](#color-schemes), or from `color-scheme -l` command in REPL. | `256` |
|
202
|
+
|
203
|
+
This is a complete example of a configuration file:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
config.color_scheme = "deep-space"
|
207
|
+
```
|
208
|
+
|
209
|
+
## Roadmap
|
210
|
+
|
189
211
|
### [Done] Version 0.1.0: Proof of concept
|
190
212
|
|
191
213
|
This version is a bootstrap to see whether my idea works or not, in term of technical possibility and user usability. Luckily, everything works now, and I receive possible feedback from friends and peers.
|
Binary file
|
Binary file
|
data/lib/ruby_jard.rb
CHANGED
@@ -7,6 +7,7 @@ require 'forwardable'
|
|
7
7
|
require 'benchmark'
|
8
8
|
|
9
9
|
require 'ruby_jard/control_flow'
|
10
|
+
require 'ruby_jard/config'
|
10
11
|
require 'ruby_jard/keys'
|
11
12
|
require 'ruby_jard/key_binding'
|
12
13
|
require 'ruby_jard/key_bindings'
|
@@ -41,7 +42,6 @@ require 'ruby_jard/version'
|
|
41
42
|
module RubyJard
|
42
43
|
class Error < StandardError; end
|
43
44
|
|
44
|
-
DEFAULT_COLOR_SCHEME = '256'
|
45
45
|
DEFAULT_LAYOUT_TEMPLATES = [
|
46
46
|
RubyJard::Layouts::WideLayout,
|
47
47
|
RubyJard::Layouts::NarrowLayout
|
@@ -88,6 +88,10 @@ module RubyJard
|
|
88
88
|
end
|
89
89
|
@global_key_bindings
|
90
90
|
end
|
91
|
+
|
92
|
+
def self.config
|
93
|
+
@config ||= RubyJard::Config.smart_load
|
94
|
+
end
|
91
95
|
end
|
92
96
|
|
93
97
|
##
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyJard
|
4
|
+
module Commands
|
5
|
+
# Command used to explore stacktrace.
|
6
|
+
class ColorSchemeCommand < Pry::ClassCommand
|
7
|
+
group 'RubyJard'
|
8
|
+
description 'Control the color scheme used in Jard'
|
9
|
+
|
10
|
+
match 'color-scheme'
|
11
|
+
|
12
|
+
banner <<-BANNER
|
13
|
+
Usage: color-scheme -l
|
14
|
+
color-scheme [scheme-name]
|
15
|
+
BANNER
|
16
|
+
|
17
|
+
def options(opt)
|
18
|
+
opt.on :l, :list, "List all available color schemes"
|
19
|
+
end
|
20
|
+
|
21
|
+
def process
|
22
|
+
if opts[:l]
|
23
|
+
if args.length != 0
|
24
|
+
raise Pry::CommandError, "Color scheme list command shouldn't have any argument."
|
25
|
+
end
|
26
|
+
pry_instance.pager.page RubyJard::ColorSchemes.names.join("\n")
|
27
|
+
else
|
28
|
+
color_scheme = args.first.to_s.strip
|
29
|
+
if color_scheme.empty?
|
30
|
+
raise Pry::CommandError, "You must provide a color scheme name."
|
31
|
+
end
|
32
|
+
if RubyJard::ColorSchemes[color_scheme].nil?
|
33
|
+
raise Pry::CommandError, "Color scheme `#{color_scheme}` not found. Please use `color-scheme -l` to list all color schemes."
|
34
|
+
end
|
35
|
+
RubyJard::ControlFlow.dispatch(:color_scheme, color_scheme: color_scheme)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Pry::Commands.add_command(RubyJard::Commands::ColorSchemeCommand)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyJard
|
4
|
+
##
|
5
|
+
# Another reinvent-the-wheel configuration
|
6
|
+
class Config
|
7
|
+
class << self
|
8
|
+
def smart_load
|
9
|
+
config = RubyJard::Config.new
|
10
|
+
|
11
|
+
path = File.expand_path(File.join(Dir.pwd, CONFIG_FILE_NAME))
|
12
|
+
load_config(config, path) if File.exist?(path)
|
13
|
+
|
14
|
+
path = File.expand_path(File.join('~/', CONFIG_FILE_NAME))
|
15
|
+
load_config(config, path) if File.exist?(path)
|
16
|
+
|
17
|
+
config
|
18
|
+
rescue StandardError => e
|
19
|
+
# Fallback to default setting
|
20
|
+
STDOUT.puts "Fail to load jard configurations at #{path}. Error: #{e}"
|
21
|
+
RubyJard::Config.new
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_config(config, path)
|
27
|
+
config_content = File.read(path)
|
28
|
+
config.instance_eval(config_content)
|
29
|
+
|
30
|
+
config
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
attr_reader :color_scheme
|
35
|
+
attr_writer :color_scheme
|
36
|
+
|
37
|
+
CONFIG_FILE_NAME = '.jardrc'
|
38
|
+
DEFAULTS = [
|
39
|
+
DEFAULT_COLOR_SCHEME = '256'
|
40
|
+
].freeze
|
41
|
+
|
42
|
+
def initialize
|
43
|
+
@color_scheme = DEFAULT_COLOR_SCHEME
|
44
|
+
end
|
45
|
+
|
46
|
+
def config
|
47
|
+
self
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -7,15 +7,16 @@ module RubyJard
|
|
7
7
|
class ControlFlow
|
8
8
|
THROW_KEYWORD = :jard_control_flow
|
9
9
|
ALLOW_LIST = {
|
10
|
-
continue: [:times],
|
11
|
-
frame: [:frame],
|
12
|
-
up: [:times],
|
13
|
-
down: [:times],
|
14
|
-
next: [:times],
|
15
|
-
step: [:times],
|
16
|
-
step_out: [:times],
|
17
|
-
key_binding: [:action],
|
18
|
-
list: []
|
10
|
+
continue: [:times], # lib/ruby_jard/commands/continue_command.rb
|
11
|
+
frame: [:frame], # lib/ruby_jard/commands/frame_command.rb
|
12
|
+
up: [:times], # lib/ruby_jard/commands/up_command.rb
|
13
|
+
down: [:times], # lib/ruby_jard/commands/down_command.rb
|
14
|
+
next: [:times], # lib/ruby_jard/commands/next_command.rb
|
15
|
+
step: [:times], # lib/ruby_jard/commands/step_command.rb
|
16
|
+
step_out: [:times], # lib/ruby_jard/commands/step_out_command.rb
|
17
|
+
key_binding: [:action], # lib/ruby_jard/commands/step_command.rb
|
18
|
+
list: [], # lib/ruby_jard/commands/list_command.rb
|
19
|
+
color_scheme: [:color_scheme] # lib/ruby_jard/commands/colorscheme_command.rb
|
19
20
|
}.freeze
|
20
21
|
|
21
22
|
attr_reader :command, :arguments
|
data/lib/ruby_jard/repl_proxy.rb
CHANGED
@@ -8,6 +8,7 @@ require 'ruby_jard/commands/step_command'
|
|
8
8
|
require 'ruby_jard/commands/step_out_command'
|
9
9
|
require 'ruby_jard/commands/frame_command'
|
10
10
|
require 'ruby_jard/commands/list_command'
|
11
|
+
require 'ruby_jard/commands/color_scheme_command'
|
11
12
|
|
12
13
|
module RubyJard
|
13
14
|
##
|
@@ -38,7 +39,6 @@ module RubyJard
|
|
38
39
|
PRY_EXCLUDED_COMMANDS = [
|
39
40
|
'pry-backtrace', # Redundant method for normal user
|
40
41
|
'watch', # Conflict with byebug and jard watch
|
41
|
-
'whereami', # Jard already provides similar. Keeping this command makes conflicted experience
|
42
42
|
'edit', # Sorry, but a file should not be editted while debugging, as it made breakpoints shifted
|
43
43
|
'play', # What if the played files or methods include jard again?
|
44
44
|
'stat', # Included in jard UI
|
@@ -66,11 +66,15 @@ module RubyJard
|
|
66
66
|
def start
|
67
67
|
return if started?
|
68
68
|
|
69
|
+
# Load configurations
|
70
|
+
RubyJard.config
|
69
71
|
RubyJard::Console.start_alternative_terminal(@output)
|
70
72
|
RubyJard::Console.clear_screen(@output)
|
71
73
|
|
72
74
|
def $stdout.write(string)
|
73
|
-
|
75
|
+
# NOTE: `RubyJard::ScreenManager.instance` is a must. Jard doesn't work well with delegator
|
76
|
+
# TODO: Debug and fix the issues permanently
|
77
|
+
if !RubyJard::ScreenManager.instance.updating? && RubyJard::ScreenManager.instance.started?
|
74
78
|
RubyJard::ScreenManager.instance.output_storage.write(string)
|
75
79
|
end
|
76
80
|
super
|
@@ -238,8 +242,10 @@ module RubyJard
|
|
238
242
|
end
|
239
243
|
|
240
244
|
def pick_color_scheme
|
241
|
-
|
242
|
-
|
245
|
+
color_scheme_class =
|
246
|
+
RubyJard::ColorSchemes[RubyJard.config.color_scheme] ||
|
247
|
+
RubyJard::ColorSchemes[RubyJard::Config::DEFAULT_COLOR_SCHEME]
|
248
|
+
color_scheme_class.new
|
243
249
|
end
|
244
250
|
end
|
245
251
|
end
|
@@ -8,7 +8,7 @@ module RubyJard
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def build
|
11
|
-
contexts = RubyJard.current_session.contexts.
|
11
|
+
contexts = RubyJard.current_session.contexts.select { |c| c.thread.alive? }
|
12
12
|
contexts = sort_contexts(contexts)
|
13
13
|
@rows = contexts.map do |context|
|
14
14
|
RubyJard::Row.new(
|
data/lib/ruby_jard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_jard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minh Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -75,6 +75,8 @@ files:
|
|
75
75
|
- _config.yml
|
76
76
|
- bin/console
|
77
77
|
- docs/_config.yml
|
78
|
+
- docs/color_schemes/256.png
|
79
|
+
- docs/color_schemes/deep-space.png
|
78
80
|
- docs/demo.png
|
79
81
|
- docs/guide-ui.png
|
80
82
|
- docs/index.md
|
@@ -102,6 +104,7 @@ files:
|
|
102
104
|
- lib/ruby_jard/color_schemes/256_color_scheme.rb
|
103
105
|
- lib/ruby_jard/color_schemes/deep_space_color_scheme.rb
|
104
106
|
- lib/ruby_jard/column.rb
|
107
|
+
- lib/ruby_jard/commands/color_scheme_command.rb
|
105
108
|
- lib/ruby_jard/commands/continue_command.rb
|
106
109
|
- lib/ruby_jard/commands/down_command.rb
|
107
110
|
- lib/ruby_jard/commands/frame_command.rb
|
@@ -110,6 +113,7 @@ files:
|
|
110
113
|
- lib/ruby_jard/commands/step_command.rb
|
111
114
|
- lib/ruby_jard/commands/step_out_command.rb
|
112
115
|
- lib/ruby_jard/commands/up_command.rb
|
116
|
+
- lib/ruby_jard/config.rb
|
113
117
|
- lib/ruby_jard/console.rb
|
114
118
|
- lib/ruby_jard/control_flow.rb
|
115
119
|
- lib/ruby_jard/decorators/color_decorator.rb
|
@@ -172,7 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
176
|
- !ruby/object:Gem::Version
|
173
177
|
version: '0'
|
174
178
|
requirements: []
|
175
|
-
|
179
|
+
rubyforge_project:
|
180
|
+
rubygems_version: 2.7.6
|
176
181
|
signing_key:
|
177
182
|
specification_version: 4
|
178
183
|
summary: Just Another Ruby Debugger
|