byebug 9.0.2 → 9.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/byebug/runner.rb +57 -35
- data/lib/byebug/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d343499b9880b10f470260db66d852711470e61
|
4
|
+
data.tar.gz: c9003db4d4426203f8feadce35967527141e79e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fdafc0ae02185a12ca220d091816ac7e99e9e54721d7f4a1132583025b68ebc4c5f69dcf71fa4510f3248a9c2e2944d1ad7d7b0d35126ff6cb0dbf01b5842f5
|
7
|
+
data.tar.gz: 54917e0fa06f438bd27f9bcb89a952ba04199460ec61120c86051c7338eaef0d64a8ff39436a75488769c046da7852b6e4c7be21d99bd9620bf9a46867806f6c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 9.0.3 - 2016-05-16
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
* Unfriendly output in byebug's executable when no script specified (#256).
|
10
|
+
* Unfriendly output in byebug's executable when script doesn't exist.
|
11
|
+
* Unfriendly output in byebug's executable when script has invalid code.
|
12
|
+
|
5
13
|
## 9.0.2 - 2016-05-15
|
6
14
|
|
7
15
|
### Fixed
|
@@ -12,6 +20,8 @@
|
|
12
20
|
|
13
21
|
## 9.0.1 - 2016-05-14
|
14
22
|
|
23
|
+
### Fixed
|
24
|
+
|
15
25
|
* `quit` never exiting when remote debugging (#201).
|
16
26
|
|
17
27
|
## 9.0.0 - 2016-05-11
|
data/lib/byebug/runner.rb
CHANGED
@@ -13,21 +13,6 @@ module Byebug
|
|
13
13
|
class Runner
|
14
14
|
include Helpers::ParseHelper
|
15
15
|
|
16
|
-
#
|
17
|
-
# Error class signaling absence of a script to debug.
|
18
|
-
#
|
19
|
-
class NoScript < StandardError; end
|
20
|
-
|
21
|
-
#
|
22
|
-
# Error class signaling a non existent script to debug.
|
23
|
-
#
|
24
|
-
class NonExistentScript < StandardError; end
|
25
|
-
|
26
|
-
#
|
27
|
-
# Error class signaling a script with invalid Ruby syntax.
|
28
|
-
#
|
29
|
-
class InvalidScript < StandardError; end
|
30
|
-
|
31
16
|
#
|
32
17
|
# Special working modes that don't actually start the debugger.
|
33
18
|
#
|
@@ -63,7 +48,7 @@ module Byebug
|
|
63
48
|
def help=(text)
|
64
49
|
@help ||= text
|
65
50
|
|
66
|
-
interface.puts("
|
51
|
+
interface.puts("#{text}\n")
|
67
52
|
end
|
68
53
|
|
69
54
|
def version=(number)
|
@@ -74,6 +59,8 @@ module Byebug
|
|
74
59
|
|
75
60
|
def remote=(host_and_port)
|
76
61
|
@remote ||= Byebug.parse_host_and_port(host_and_port)
|
62
|
+
|
63
|
+
Byebug.start_client(*@remote)
|
77
64
|
end
|
78
65
|
|
79
66
|
def init_script
|
@@ -97,18 +84,11 @@ module Byebug
|
|
97
84
|
# Starts byebug to debug a program.
|
98
85
|
#
|
99
86
|
def run
|
100
|
-
|
101
|
-
return if
|
102
|
-
|
103
|
-
if remote
|
104
|
-
Byebug.start_client(*remote)
|
105
|
-
return
|
106
|
-
end
|
87
|
+
option_parser.order!($ARGV)
|
88
|
+
return if non_script_option? || error_in_script?
|
107
89
|
|
108
90
|
Byebug.run_init_script if init_script
|
109
91
|
|
110
|
-
setup_cmd_line_args
|
111
|
-
|
112
92
|
loop do
|
113
93
|
debug_program
|
114
94
|
|
@@ -127,36 +107,70 @@ module Byebug
|
|
127
107
|
#
|
128
108
|
# Processes options passed from the command line.
|
129
109
|
#
|
130
|
-
def
|
131
|
-
OptionParser.new(banner, 25) do |opts|
|
110
|
+
def option_parser
|
111
|
+
@option_parser ||= OptionParser.new(banner, 25) do |opts|
|
132
112
|
opts.banner = banner
|
133
113
|
|
134
114
|
OptionSetter.new(self, opts).setup
|
135
115
|
end
|
136
116
|
end
|
137
117
|
|
118
|
+
#
|
119
|
+
# An option that doesn't need a script specified was given
|
120
|
+
#
|
121
|
+
def non_script_option?
|
122
|
+
version || help || remote
|
123
|
+
end
|
124
|
+
|
125
|
+
#
|
126
|
+
# There is an error with the specified script
|
127
|
+
#
|
128
|
+
def error_in_script?
|
129
|
+
no_script? || non_existing_script? || invalid_script?
|
130
|
+
end
|
131
|
+
|
132
|
+
#
|
133
|
+
# No script to debug specified
|
134
|
+
#
|
135
|
+
def no_script?
|
136
|
+
return false unless $ARGV.empty?
|
137
|
+
|
138
|
+
print_error('You must specify a program to debug')
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
138
142
|
#
|
139
143
|
# Extracts debugged program from command line args.
|
140
144
|
#
|
141
|
-
def
|
145
|
+
def non_existing_script?
|
142
146
|
Byebug.mode = :standalone
|
143
147
|
|
144
|
-
raise(NoScript, 'You must specify a program to debug...') if $ARGV.empty?
|
145
|
-
|
146
148
|
program = which($ARGV.shift)
|
147
149
|
program = which($ARGV.shift) if program == which('ruby')
|
148
|
-
raise(NonExistentScript, "The script doesn't exist") unless program
|
149
150
|
|
150
|
-
|
151
|
+
if program
|
152
|
+
$PROGRAM_NAME = program
|
153
|
+
false
|
154
|
+
else
|
155
|
+
print_error("The script doesn't exist")
|
156
|
+
true
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# Checks the debugged script has correct syntax
|
162
|
+
#
|
163
|
+
def invalid_script?
|
164
|
+
return false if syntax_valid?(File.read($PROGRAM_NAME))
|
165
|
+
|
166
|
+
print_error('The script has incorrect syntax')
|
167
|
+
true
|
151
168
|
end
|
152
169
|
|
153
170
|
#
|
154
171
|
# Debugs a script only if syntax checks okay.
|
155
172
|
#
|
156
173
|
def debug_program
|
157
|
-
ok = syntax_valid?(File.read($PROGRAM_NAME))
|
158
|
-
raise(InvalidScript, 'The script has incorrect syntax') unless ok
|
159
|
-
|
160
174
|
error = Byebug.debug_load($PROGRAM_NAME, stop)
|
161
175
|
puts "#{error}\n#{error.backtrace}" if error
|
162
176
|
end
|
@@ -178,5 +192,13 @@ module Byebug
|
|
178
192
|
|
179
193
|
nil
|
180
194
|
end
|
195
|
+
|
196
|
+
#
|
197
|
+
# Prints an error message and a help string
|
198
|
+
#
|
199
|
+
def print_error(msg)
|
200
|
+
interface.errmsg(msg)
|
201
|
+
interface.puts(option_parser.help)
|
202
|
+
end
|
181
203
|
end
|
182
204
|
end
|
data/lib/byebug/version.rb
CHANGED
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: 9.0.
|
4
|
+
version: 9.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rodriguez
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-05-
|
13
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|