byebug 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/byebug/extconf.rb +1 -1
- data/lib/byebug/command.rb +17 -1
- data/lib/byebug/processor.rb +22 -19
- data/lib/byebug/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c0fcdcfc3ae1fc8b58305e8a97b7e43c42718a
|
4
|
+
data.tar.gz: af47dacc0c4077a5ad12cf93df94d79a741f5230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a61071fab34b13caceaea5e0b6883748c169c50d5c25a81bc16442a8f60cb34e055ff06e0f9b3200a619fd686615de4931c2c46bec0ab91f9ded756464cc59e9
|
7
|
+
data.tar.gz: 7e59c4643528ac5f7ff2817f0b69ea7b769fa38887f277cd05b9328103b894c5033fcf56026fd5077352ba3f665b782de6649a01d91c4e2c322ab3f679f0a2d5
|
data/CHANGELOG.md
CHANGED
data/ext/byebug/extconf.rb
CHANGED
data/lib/byebug/command.rb
CHANGED
@@ -148,6 +148,22 @@ module Byebug
|
|
148
148
|
settings_map[name] ||= {}
|
149
149
|
settings_map[name][:setter] = block
|
150
150
|
end
|
151
|
+
|
152
|
+
def command_exists?(command)
|
153
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).any? {
|
154
|
+
|d| File.exists? File.join(d, command) }
|
155
|
+
end
|
156
|
+
|
157
|
+
def terminal_width
|
158
|
+
if ENV['COLUMNS'] =~ /^\d+$/
|
159
|
+
ENV['COLUMNS'].to_i
|
160
|
+
elsif STDIN.tty? && command_exists?('stty')
|
161
|
+
`stty size`.scan(/\d+/)[1].to_i
|
162
|
+
else
|
163
|
+
nil
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
151
167
|
end
|
152
168
|
|
153
169
|
# Register default settings
|
@@ -159,7 +175,7 @@ module Byebug
|
|
159
175
|
register_setting_var(:listsize, 10)
|
160
176
|
register_setting_var(:stack_trace_on_error, false)
|
161
177
|
register_setting_var(:tracing_plus, false)
|
162
|
-
cols =
|
178
|
+
cols = terminal_width || 80
|
163
179
|
register_setting_var(:width, cols > 10 ? cols : 80)
|
164
180
|
Byebug::ARGV = ARGV.clone unless defined? Byebug::ARGV
|
165
181
|
register_setting_var(:argv, Byebug::ARGV)
|
data/lib/byebug/processor.rb
CHANGED
@@ -205,30 +205,33 @@ module Byebug
|
|
205
205
|
end
|
206
206
|
|
207
207
|
##
|
208
|
-
#
|
208
|
+
# Splits a command line of the form "cmd1 ; cmd2 ; ... ; cmdN" into an
|
209
|
+
# array of commands: [cmd1, cmd2, ..., cmdN]
|
209
210
|
#
|
210
|
-
def
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
m << v
|
211
|
+
def split_commands(cmd_line)
|
212
|
+
cmd_line.split(/;/).inject([]) do |m, v|
|
213
|
+
if m.empty?
|
214
|
+
m << v
|
215
|
+
else
|
216
|
+
if m.last[-1] == ?\\
|
217
|
+
m.last[-1,1] = ''
|
218
|
+
m.last << ';' << v
|
218
219
|
else
|
219
|
-
|
220
|
-
m.last[-1,1] = ''
|
221
|
-
m.last << ';' << v
|
222
|
-
else
|
223
|
-
m << v
|
224
|
-
end
|
220
|
+
m << v
|
225
221
|
end
|
226
|
-
m
|
227
222
|
end
|
223
|
+
m
|
228
224
|
end
|
225
|
+
end
|
229
226
|
|
230
|
-
|
227
|
+
##
|
228
|
+
# Handle byebug commands.
|
229
|
+
#
|
230
|
+
def process_commands(context, file, line)
|
231
|
+
state, commands = always_run(context, file, line, 1)
|
232
|
+
$state = Command.settings[:testing] ? state : nil
|
231
233
|
|
234
|
+
preloop(commands, context)
|
232
235
|
if Command.settings[:autolist] == 0
|
233
236
|
CommandProcessor.print_location_and_text(file, line)
|
234
237
|
end
|
@@ -245,14 +248,14 @@ module Byebug
|
|
245
248
|
else
|
246
249
|
@last_cmd = input
|
247
250
|
end
|
248
|
-
|
251
|
+
split_commands(input).each do |cmd|
|
249
252
|
one_cmd(commands, context, cmd)
|
250
253
|
postcmd(commands, context, cmd)
|
251
254
|
end
|
252
255
|
end
|
253
256
|
end
|
254
257
|
postloop(commands, context)
|
255
|
-
end
|
258
|
+
end
|
256
259
|
|
257
260
|
##
|
258
261
|
# Executes a single byebug command
|
data/lib/byebug/version.rb
CHANGED