ruby_jard 0.1.0 → 0.3.0
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/.github/FUNDING.yml +3 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/documentation.yml +65 -0
- data/.github/workflows/rspec.yml +96 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +90 -2
- data/CHANGELOG.md +112 -0
- data/Gemfile +14 -4
- data/README.md +95 -3
- data/benchmark/path_filter_bench.rb +58 -0
- data/bin/console +1 -2
- data/lib/ruby_jard.rb +68 -32
- data/lib/ruby_jard/box_drawer.rb +175 -0
- data/lib/ruby_jard/color_scheme.rb +28 -0
- data/lib/ruby_jard/color_schemes.rb +54 -0
- data/lib/ruby_jard/color_schemes/256_color_scheme.rb +50 -0
- data/lib/ruby_jard/color_schemes/256_light_color_scheme.rb +50 -0
- data/lib/ruby_jard/color_schemes/deep_space_color_scheme.rb +49 -0
- data/lib/ruby_jard/color_schemes/gruvbox_color_scheme.rb +48 -0
- data/lib/ruby_jard/color_schemes/one_half_dark_color_scheme.rb +47 -0
- data/lib/ruby_jard/color_schemes/one_half_light_color_scheme.rb +49 -0
- data/lib/ruby_jard/column.rb +26 -0
- data/lib/ruby_jard/commands/color_helpers.rb +32 -0
- data/lib/ruby_jard/commands/continue_command.rb +4 -9
- data/lib/ruby_jard/commands/down_command.rb +9 -8
- data/lib/ruby_jard/commands/exit_command.rb +27 -0
- data/lib/ruby_jard/commands/frame_command.rb +13 -11
- data/lib/ruby_jard/commands/jard/color_scheme_command.rb +74 -0
- data/lib/ruby_jard/commands/jard/filter_command.rb +136 -0
- data/lib/ruby_jard/commands/jard/hide_command.rb +40 -0
- data/lib/ruby_jard/commands/jard/output_command.rb +36 -0
- data/lib/ruby_jard/commands/jard/show_command.rb +41 -0
- data/lib/ruby_jard/commands/jard_command.rb +52 -0
- data/lib/ruby_jard/commands/list_command.rb +31 -0
- data/lib/ruby_jard/commands/next_command.rb +11 -8
- data/lib/ruby_jard/commands/step_command.rb +11 -8
- data/lib/ruby_jard/commands/step_out_command.rb +34 -0
- data/lib/ruby_jard/commands/up_command.rb +10 -8
- data/lib/ruby_jard/commands/validation_helpers.rb +50 -0
- data/lib/ruby_jard/config.rb +61 -0
- data/lib/ruby_jard/console.rb +158 -0
- data/lib/ruby_jard/control_flow.rb +73 -0
- data/lib/ruby_jard/decorators/array_decorator.rb +79 -0
- data/lib/ruby_jard/decorators/attributes_decorator.rb +172 -0
- data/lib/ruby_jard/decorators/color_decorator.rb +80 -0
- data/lib/ruby_jard/decorators/hash_decorator.rb +74 -0
- data/lib/ruby_jard/decorators/inspection_decorator.rb +109 -0
- data/lib/ruby_jard/decorators/loc_decorator.rb +108 -119
- data/lib/ruby_jard/decorators/object_decorator.rb +122 -0
- data/lib/ruby_jard/decorators/path_decorator.rb +56 -60
- data/lib/ruby_jard/decorators/rails_decorator.rb +194 -0
- data/lib/ruby_jard/decorators/source_decorator.rb +3 -1
- data/lib/ruby_jard/decorators/string_decorator.rb +41 -0
- data/lib/ruby_jard/decorators/struct_decorator.rb +79 -0
- data/lib/ruby_jard/frame.rb +68 -0
- data/lib/ruby_jard/key_binding.rb +14 -0
- data/lib/ruby_jard/key_bindings.rb +96 -0
- data/lib/ruby_jard/keys.rb +48 -0
- data/lib/ruby_jard/layout.rb +17 -88
- data/lib/ruby_jard/layout_calculator.rb +168 -0
- data/lib/ruby_jard/layout_picker.rb +34 -0
- data/lib/ruby_jard/layouts.rb +52 -0
- data/lib/ruby_jard/layouts/narrow_horizontal_layout.rb +32 -0
- data/lib/ruby_jard/layouts/narrow_vertical_layout.rb +32 -0
- data/lib/ruby_jard/layouts/tiny_layout.rb +29 -0
- data/lib/ruby_jard/layouts/wide_layout.rb +50 -0
- data/lib/ruby_jard/pager.rb +112 -0
- data/lib/ruby_jard/path_classifier.rb +133 -0
- data/lib/ruby_jard/path_filter.rb +125 -0
- data/lib/ruby_jard/reflection.rb +97 -0
- data/lib/ruby_jard/repl_processor.rb +151 -89
- data/lib/ruby_jard/repl_proxy.rb +337 -0
- data/lib/ruby_jard/row.rb +31 -0
- data/lib/ruby_jard/row_renderer.rb +119 -0
- data/lib/ruby_jard/screen.rb +14 -41
- data/lib/ruby_jard/screen_adjuster.rb +104 -0
- data/lib/ruby_jard/screen_drawer.rb +25 -0
- data/lib/ruby_jard/screen_manager.rb +167 -82
- data/lib/ruby_jard/screen_renderer.rb +152 -0
- data/lib/ruby_jard/screens.rb +31 -12
- data/lib/ruby_jard/screens/backtrace_screen.rb +118 -116
- data/lib/ruby_jard/screens/menu_screen.rb +73 -45
- data/lib/ruby_jard/screens/source_screen.rb +86 -106
- data/lib/ruby_jard/screens/threads_screen.rb +103 -78
- data/lib/ruby_jard/screens/variables_screen.rb +224 -142
- data/lib/ruby_jard/session.rb +151 -16
- data/lib/ruby_jard/span.rb +23 -0
- data/lib/ruby_jard/templates/layout_template.rb +35 -0
- data/lib/ruby_jard/templates/screen_template.rb +34 -0
- data/lib/ruby_jard/thread_info.rb +69 -0
- data/lib/ruby_jard/version.rb +1 -1
- data/ruby_jard.gemspec +7 -8
- metadata +84 -50
- data/.travis.yml +0 -6
- data/lib/ruby_jard/commands/finish_command.rb +0 -31
- data/lib/ruby_jard/decorators/text_decorator.rb +0 -61
- data/lib/ruby_jard/layout_template.rb +0 -101
- data/lib/ruby_jard/screens/breakpoints_screen.rb +0 -23
- data/lib/ruby_jard/screens/empty_screen.rb +0 -13
- data/lib/ruby_jard/screens/expressions_sreen.rb +0 -22
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RubyJard
|
4
|
-
module Decorators
|
5
|
-
##
|
6
|
-
# Decorate text colos and styles. It acts as a wrapper for Pastel gem
|
7
|
-
# TODO: the current color handling sucks. This should be migrated to a
|
8
|
-
# color scheme system instead.
|
9
|
-
class TextDecorator
|
10
|
-
attr_reader :length, :content
|
11
|
-
|
12
|
-
def initialize(color, highlighted = false)
|
13
|
-
@length = 0
|
14
|
-
@content = ''
|
15
|
-
@color = color
|
16
|
-
@highlighted = highlighted
|
17
|
-
end
|
18
|
-
|
19
|
-
def text(sentence, *styles)
|
20
|
-
return self + sentence if sentence.is_a?(TextDecorator)
|
21
|
-
|
22
|
-
sentence = sentence.to_s
|
23
|
-
@length += sentence.length
|
24
|
-
|
25
|
-
@content +=
|
26
|
-
if styles.empty?
|
27
|
-
sentence
|
28
|
-
else
|
29
|
-
@color.decorate(sentence, *compose_styles(styles))
|
30
|
-
end
|
31
|
-
|
32
|
-
self
|
33
|
-
end
|
34
|
-
|
35
|
-
def with_highlight(highlighted)
|
36
|
-
@highlighted = highlighted
|
37
|
-
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
def +(other)
|
42
|
-
if other.is_a?(RubyJard::Decorators::TextDecorator)
|
43
|
-
@length = other.length
|
44
|
-
@content += other.content
|
45
|
-
else
|
46
|
-
text(other.to_s)
|
47
|
-
end
|
48
|
-
|
49
|
-
self
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def compose_styles(styles)
|
55
|
-
styles.delete(:clear)
|
56
|
-
styles.delete(:dim)
|
57
|
-
styles.prepend(@highlighted ? :clear : :dim)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RubyJard
|
4
|
-
##
|
5
|
-
# Template of a layout. Templates are hierarchy. Each template includes the
|
6
|
-
# sizing configuration, including absolute values, min, max, or ratio
|
7
|
-
# relative to its parant.
|
8
|
-
class LayoutTemplate
|
9
|
-
attr_reader :screen, :height_ratio, :width_ratio,
|
10
|
-
:min_width, :min_height,
|
11
|
-
:height, :width,
|
12
|
-
:children,
|
13
|
-
:fill_width, :fill_height
|
14
|
-
|
15
|
-
def initialize(
|
16
|
-
screen: nil, height_ratio: nil, width_ratio: nil,
|
17
|
-
min_width: nil, min_height: nil,
|
18
|
-
height: nil, width: nil,
|
19
|
-
children: [],
|
20
|
-
fill_width: nil, fill_height: nil
|
21
|
-
)
|
22
|
-
@screen = screen
|
23
|
-
@height_ratio = height_ratio
|
24
|
-
@width_ratio = width_ratio
|
25
|
-
@min_width = min_width
|
26
|
-
@min_height = min_height
|
27
|
-
@height = height
|
28
|
-
@width = width
|
29
|
-
@children = children
|
30
|
-
@fill_width = fill_width
|
31
|
-
@fill_height = fill_height
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
WideLayoutTemplate = LayoutTemplate.new(
|
36
|
-
min_width: 120,
|
37
|
-
min_height: 10,
|
38
|
-
fill_width: true,
|
39
|
-
fill_height: false,
|
40
|
-
children: [
|
41
|
-
LayoutTemplate.new(
|
42
|
-
height_ratio: 50,
|
43
|
-
min_height: 7,
|
44
|
-
fill_width: true,
|
45
|
-
children: [
|
46
|
-
LayoutTemplate.new(
|
47
|
-
screen: :source,
|
48
|
-
width_ratio: 60
|
49
|
-
),
|
50
|
-
LayoutTemplate.new(
|
51
|
-
width_ratio: 40,
|
52
|
-
fill_height: true,
|
53
|
-
children: [
|
54
|
-
LayoutTemplate.new(
|
55
|
-
screen: :variables,
|
56
|
-
width_ratio: 100,
|
57
|
-
height_ratio: 100,
|
58
|
-
min_height: 3
|
59
|
-
)
|
60
|
-
# LayoutTemplate.new(
|
61
|
-
# screen: :breakpoints,
|
62
|
-
# width_ratio: 100,
|
63
|
-
# height_ratio: 25,
|
64
|
-
# min_height: 3
|
65
|
-
# ),
|
66
|
-
# LayoutTemplate.new(
|
67
|
-
# screen: :expressions,
|
68
|
-
# width_ratio: 100,
|
69
|
-
# height_ratio: 25,
|
70
|
-
# min_height: 3
|
71
|
-
# )
|
72
|
-
]
|
73
|
-
)
|
74
|
-
]
|
75
|
-
),
|
76
|
-
LayoutTemplate.new(
|
77
|
-
height_ratio: 20,
|
78
|
-
min_height: 3,
|
79
|
-
fill_width: true,
|
80
|
-
children: [
|
81
|
-
LayoutTemplate.new(
|
82
|
-
screen: :backtrace,
|
83
|
-
width_ratio: 60
|
84
|
-
),
|
85
|
-
LayoutTemplate.new(
|
86
|
-
screen: :threads,
|
87
|
-
width_ratio: 40
|
88
|
-
)
|
89
|
-
]
|
90
|
-
),
|
91
|
-
LayoutTemplate.new(
|
92
|
-
height: 2,
|
93
|
-
screen: :menu
|
94
|
-
)
|
95
|
-
]
|
96
|
-
)
|
97
|
-
|
98
|
-
DEFAULT_LAYOUT_TEMPLATES = [
|
99
|
-
WideLayoutTemplate
|
100
|
-
].freeze
|
101
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RubyJard
|
4
|
-
module Screens
|
5
|
-
class BreakpointsScreen < RubyJard::Screen
|
6
|
-
def draw
|
7
|
-
@output.print TTY::Box.frame(
|
8
|
-
**default_frame_styles.merge(
|
9
|
-
top: @row, left: @col, width: @layout.width, height: @layout.height
|
10
|
-
)
|
11
|
-
)
|
12
|
-
|
13
|
-
@output.print TTY::Cursor.move_to(@col + 2, @row)
|
14
|
-
@output.print decorate_text
|
15
|
-
.with_highlight(true)
|
16
|
-
.text(' Breakpoints ', :bright_yellow)
|
17
|
-
.content
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
RubyJard::Screens.add_screen(:breakpoints, RubyJard::Screens::BreakpointsScreen)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RubyJard
|
4
|
-
module Screens
|
5
|
-
class ExpressionsScreen < RubyJard::Screen
|
6
|
-
def draw
|
7
|
-
@output.print TTY::Box.frame(
|
8
|
-
**default_frame_styles.merge(
|
9
|
-
top: @row, left: @col, width: @layout.width, height: @layout.height
|
10
|
-
)
|
11
|
-
)
|
12
|
-
@output.print TTY::Cursor.move_to(@col + 2, @row)
|
13
|
-
@output.print decorate_text
|
14
|
-
.with_highlight(true)
|
15
|
-
.text(' Expressions ', :bright_yellow)
|
16
|
-
.content
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
RubyJard::Screens.add_screen(:expressions, RubyJard::Screens::ExpressionsScreen)
|