byebug 1.6.0 → 1.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21d46be2dda181855988404a2aff8d7bc0c01873
4
- data.tar.gz: 51485fdf716aec89695f1b6bff72dfab4d326ebd
3
+ metadata.gz: 52c0fcdcfc3ae1fc8b58305e8a97b7e43c42718a
4
+ data.tar.gz: af47dacc0c4077a5ad12cf93df94d79a741f5230
5
5
  SHA512:
6
- metadata.gz: e59c28c8f7ded85eaca1a7ef0af86c3226ac2db743c30f8b14326efa4584c9b4f5708c5b6019dff559e69a9b51d139504cf2b4bdaecbb0f93f69446bd33a32cd
7
- data.tar.gz: ae2afdb68a86af438860f730477ee2af4a5ecb7b65c07171f27cc40028ecfcc664d526f9bcf964148b4bb38b864daee5ff369cf480612a949f6c4817c37a599f
6
+ metadata.gz: a61071fab34b13caceaea5e0b6883748c169c50d5c25a81bc16442a8f60cb34e055ff06e0f9b3200a619fd686615de4931c2c46bec0ab91f9ded756464cc59e9
7
+ data.tar.gz: 7e59c4643528ac5f7ff2817f0b69ea7b769fa38887f277cd05b9328103b894c5033fcf56026fd5077352ba3f665b782de6649a01d91c4e2c322ab3f679f0a2d5
@@ -1,3 +1,8 @@
1
+ ## 1.6.1
2
+
3
+ * Windows compatibiliy: compilation and terminal width issues
4
+
5
+
1
6
  ## 1.6.0
2
7
 
3
8
  * `byebug` placed at the end of a block or method call now works as expected
@@ -8,7 +8,7 @@ if RUBY_VERSION < "2.0"
8
8
  end
9
9
 
10
10
  if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
11
- $CFLAGS = ' -std=c99 -Wall -Werror'
11
+ $CFLAGS = '-Wall -Werror'
12
12
  $CFLAGS += ' -g3' if ENV['debug']
13
13
  end
14
14
 
@@ -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 = `stty size`.scan(/\d+/)[1].to_i
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)
@@ -205,30 +205,33 @@ module Byebug
205
205
  end
206
206
 
207
207
  ##
208
- # Handle byebug commands.
208
+ # Splits a command line of the form "cmd1 ; cmd2 ; ... ; cmdN" into an
209
+ # array of commands: [cmd1, cmd2, ..., cmdN]
209
210
  #
210
- def process_commands(context, file, line)
211
- state, commands = always_run(context, file, line, 1)
212
- $state = Command.settings[:testing] ? state : nil
213
-
214
- splitter = lambda do |str|
215
- str.split(/;/).inject([]) do |m, v|
216
- if m.empty?
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
- if m.last[-1] == ?\\
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
- preloop(commands, context)
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
- splitter[input].each do |cmd|
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 # process_commands
258
+ end
256
259
 
257
260
  ##
258
261
  # Executes a single byebug command
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez