byebug 3.4.1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7001ae9053bb3dff2ca95eee6b105c0b1e75b06b
4
- data.tar.gz: f1d8c6f4b00f51f1460f6833bdc28dcf84f28a4d
3
+ metadata.gz: 51062987a9c4c26728720d8416eb99354576fa00
4
+ data.tar.gz: 2c85de15d46650690562bc84533ad254890efb18
5
5
  SHA512:
6
- metadata.gz: 8360f244410378f4b11caae0eabcd6dcc18cacd66562fd7a460d99c5861c03ff5a92a08f027bb9dc5fc25ae3527518e8ac45ed3e5643389fd0cfd9eac2354f75
7
- data.tar.gz: f9bba361d8ace23476c667df962e610fe1a054de7224c8ae8cf392fa8ee930656d5d6ac7f3f6ddfceb863cdb3f9926c808f785476c3833123a021bbb7d24889d
6
+ metadata.gz: c6840103b5586afd62b89c16a28e512e73b4365734e4fc7e3c06f6e93f2563d7d9e255ef9bbe978b4557e9152c576e7800177a464f56ac93d5396a543ea18ba8
7
+ data.tar.gz: bf2fee35bad9a06b866f6350435ad81b7807f6d7b8e42394de54b22e9f82bdbe2244d2a6b124b300b311b1072426e0587081e523ec4b9e11f16b75780b70110f
@@ -1,3 +1,8 @@
1
+ # 3.4.2
2
+ * Fix #67, you can debug commands starting with `ruby` now, as in `byebug --
3
+ ruby -Itest test/controllers/posts_controller_test.rb -n test_should_get_index`
4
+
5
+
1
6
  # 3.4.1
2
7
  * Fix #54, you can use threads when "evaling" stuff now.
3
8
  * Fix bug in list command where user could not list backwards if current
data/GUIDE.md CHANGED
@@ -204,7 +204,7 @@ Pathname fail process_options trap
204
204
  Rational fork public untrace_var
205
205
  String format putc using
206
206
  __callee__ gem puts warn
207
- __dir__ gem_original_require raise whence_file
207
+ __dir__ gem_original_require raise
208
208
  __method__ gets rand
209
209
  ` global_variables readline
210
210
  abort include readlines
data/README.md CHANGED
@@ -136,13 +136,10 @@ connected.
136
136
  * [sublime_debugger][] provides a plugin for ruby debugging on Sublime Text.
137
137
 
138
138
 
139
- ## TODO List (by priority)
139
+ ## Contribute
140
140
 
141
- * Write tests for remote debugging support.
142
- * Add printers support.
143
- * Support rubies other than MRI.
141
+ See [Getting Started with Development](CONTRIBUTING.md).
144
142
 
145
- [Getting Started with Development](CONTRIBUTING.md)
146
143
 
147
144
  ## Credits
148
145
 
@@ -1,4 +1,24 @@
1
1
  module Byebug
2
+ module MiscUtils
3
+ #
4
+ # Cross-platform way of finding an executable in the $PATH.
5
+ # Borrowed from: http://stackoverflow.com/questions/2108727
6
+ #
7
+ def which(cmd)
8
+ return File.expand_path(cmd) if File.exist?(cmd)
9
+
10
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
11
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
12
+ exts.each do |ext|
13
+ exe = File.join(path, "#{cmd}#{ext}")
14
+ return exe if File.executable?(exe) && !File.directory?(exe)
15
+ end
16
+ end
17
+
18
+ nil
19
+ end
20
+ end
21
+
2
22
  #
3
23
  # Miscelaneous Utilities
4
24
  #
@@ -28,40 +28,25 @@ module Byebug
28
28
  Byebug.puts "#{status}\n#{status.backtrace}" if status
29
29
  end
30
30
 
31
+ include MiscUtils
31
32
  #
32
- # Do a shell-like path lookup for prog_script and return the results. If we
33
- # can't find anything return prog_script.
34
- #
35
- def whence_file(prog_script)
36
- if prog_script.index(File::SEPARATOR)
37
- # Don't search since this name has path separator components
38
- return prog_script
39
- end
40
-
41
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |dirname|
42
- prog_script_try = File.join(dirname, prog_script)
43
- return prog_script_try if File.exist?(prog_script_try)
44
- end
45
-
46
- # Failure
47
- prog_script
48
- end
49
-
50
- #
51
- # Save path to program to be debugged
33
+ # Extracts path to program to be debugged from ARGV
52
34
  #
53
35
  # Used for restarts.
54
36
  #
55
- def save_debugged_program
37
+ def debugged_program_from_argv
56
38
  if ARGV.empty?
57
39
  Byebug.puts 'You must specify a program to debug...'
58
40
  abort
59
41
  end
60
42
 
61
- prog_script = ARGV.first
62
- prog_script = whence_file(prog_script) unless File.exist?(prog_script)
43
+ prog_script_try = which(ARGV.first)
44
+ if prog_script_try == which('ruby')
45
+ ARGV.shift
46
+ return which(ARGV.first)
47
+ end
63
48
 
64
- Byebug.debugged_program = File.expand_path(prog_script)
49
+ prog_script_try
65
50
  end
66
51
 
67
52
  #
@@ -80,7 +65,7 @@ module Byebug
80
65
  return
81
66
  end
82
67
 
83
- save_debugged_program
68
+ Byebug.debugged_program = debugged_program_from_argv
84
69
 
85
70
  # Set up trace hook for byebug
86
71
  Byebug.start
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '3.4.1'
2
+ VERSION = '3.4.2'
3
3
  end
@@ -1,11 +1,11 @@
1
1
  require 'byebug/runner'
2
2
 
3
3
  module Byebug
4
-
5
4
  class RunnerTest < TestCase
6
5
  def setup
7
6
  super
8
7
  @old_argv = ARGV
8
+ @runner = Byebug::Runner.new
9
9
  end
10
10
 
11
11
  def after
@@ -14,14 +14,14 @@ module Byebug
14
14
 
15
15
  def test_run_with_version_flag
16
16
  ARGV.replace(%w(--version))
17
- Byebug::Runner.new.run
17
+ @runner.run
18
18
 
19
19
  check_output_includes(/#{Byebug::VERSION}/)
20
20
  end
21
21
 
22
22
  def test_run_with_help_flag
23
23
  ARGV.replace(%w(--help))
24
- Byebug::Runner.new.run
24
+ @runner.run
25
25
 
26
26
  check_output_includes(/-d.*-I.*-q.*-s.*-x.*-m.*-r.*-R.*-t.*-v.*-h/m)
27
27
  end
@@ -29,7 +29,7 @@ module Byebug
29
29
  def test_run_with_remote_option_only_with_a_port_number
30
30
  ARGV.replace(%w(--remote 9999))
31
31
  Byebug.expects(:start_client)
32
- Byebug::Runner.new.run
32
+ @runner.run
33
33
 
34
34
  check_output_includes(/Connecting to byebug server localhost:9999/)
35
35
  end
@@ -37,7 +37,7 @@ module Byebug
37
37
  def test_run_with_remote_option_with_host_and_port_specification
38
38
  ARGV.replace(%w(--remote myhost:9999))
39
39
  Byebug.expects(:start_client)
40
- Byebug::Runner.new.run
40
+ @runner.run
41
41
 
42
42
  check_output_includes(/Connecting to byebug server myhost:9999/)
43
43
  end
@@ -45,7 +45,7 @@ module Byebug
45
45
  def test_run_without_a_script_to_debug
46
46
  ARGV.replace([])
47
47
 
48
- assert_raises(SystemExit) { Byebug::Runner.new.run }
48
+ assert_raises(SystemExit) { @runner.run }
49
49
 
50
50
  check_output_includes(/You must specify a program to debug.../)
51
51
  end
@@ -60,14 +60,23 @@ module Byebug
60
60
  ARGV.replace(%w(my_script))
61
61
  expect_it_debugs_script
62
62
 
63
- Byebug::Runner.new.run
63
+ @runner.run
64
+ end
65
+
66
+ def test_run_with_a_script_and_params_does_not_consume_script_params
67
+ ARGV.replace(%w(-- my_script -opt value))
68
+ expect_it_debugs_script
69
+
70
+ @runner.run
71
+ assert_equal %w(my_script -opt value), ARGV
64
72
  end
65
73
 
66
- def test_saved_debugged_program
67
- ARGV.replace(%w(my_script -opt value))
74
+ def test_run_with_ruby_script_ruby_is_ignored_and_script_passed_instead
75
+ ARGV.replace(%w(-- ruby ruby_script))
76
+ expect_it_debugs_script
68
77
 
69
- Byebug::Runner.new.save_debugged_program
70
- assert_match 'my_script', Byebug.debugged_program
78
+ @runner.run
79
+ assert_equal %w(ruby_script), ARGV
71
80
  end
72
81
 
73
82
  def test_run_with_no_rc_option
@@ -76,14 +85,14 @@ module Byebug
76
85
  Byebug::Runner.any_instance.expects(:debug_program)
77
86
  Byebug.expects(:run_init_script).never
78
87
 
79
- Byebug::Runner.new.run
88
+ @runner.run
80
89
  end
81
90
 
82
91
  def test_run_with_post_mortem_mode_flag
83
92
  ARGV.replace(%w(-m my_script))
84
93
  expect_it_debugs_script
94
+ @runner.run
85
95
 
86
- Byebug::Runner.new.run
87
96
  assert_equal true, Byebug.post_mortem?
88
97
  Byebug::Setting[:post_mortem] = false
89
98
  end
@@ -91,8 +100,8 @@ module Byebug
91
100
  def test_run_with_linetracing_flag
92
101
  ARGV.replace(%w(-t my_script))
93
102
  expect_it_debugs_script
103
+ @runner.run
94
104
 
95
- Byebug::Runner.new.run
96
105
  assert_equal true, Byebug.tracing?
97
106
  Byebug::Setting[:linetrace] = false
98
107
  end
@@ -100,16 +109,16 @@ module Byebug
100
109
  def test_run_with_no_quit_flag
101
110
  skip 'for now'
102
111
  ARGV.replace(%w(--no-quit my_script))
112
+ @runner.run
103
113
 
104
- Byebug::Runner.new.run
105
114
  check_output_includes('(byebug:ctrl)')
106
115
  end
107
116
 
108
117
  def test_run_with_require_flag
109
118
  ARGV.replace(%w(-r abbrev my_script))
110
119
  expect_it_debugs_script
120
+ @runner.run
111
121
 
112
- Byebug::Runner.new.run
113
122
  hsh = { 'can' => 'can', 'cat' => 'cat' }
114
123
  assert_equal hsh, %w(can cat).abbrev
115
124
  end
@@ -117,16 +126,16 @@ module Byebug
117
126
  def test_run_with_include_flag
118
127
  ARGV.replace(%w(-I custom_dir my_script))
119
128
  expect_it_debugs_script
129
+ @runner.run
120
130
 
121
- Byebug::Runner.new.run
122
131
  assert_includes $LOAD_PATH, 'custom_dir'
123
132
  end
124
133
 
125
134
  def test_run_with_debug_flag
126
135
  ARGV.replace(%w(-d my_script))
127
136
  expect_it_debugs_script
137
+ @runner.run
128
138
 
129
- Byebug::Runner.new.run
130
139
  assert_equal $DEBUG, true
131
140
  $DEBUG = false
132
141
  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: 3.4.1
4
+ version: 3.4.2
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: 2014-09-25 00:00:00.000000000 Z
13
+ date: 2014-09-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize