From 4f1e9f44a17ae023120ae88d22f939b85ac2ea1b Mon Sep 17 00:00:00 2001 From: vidusheeamoli Date: Mon, 18 May 2020 16:28:43 +0530 Subject: [PATCH 1/2] set up byebug debugger --- .gitignore | 2 ++ Library/Homebrew/Gemfile | 1 + Library/Homebrew/Gemfile.lock | 2 ++ Library/Homebrew/dev-cmd/tests.rb | 4 ++++ Library/Homebrew/test/spec_helper.rb | 3 ++- Library/Homebrew/vendor/bundle/bundler/setup.rb | 1 + docs/Manpage.md | 2 ++ manpages/brew.1 | 4 ++++ 8 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 61ca266f05..eb9f76b6c3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ /Library/Homebrew/vendor/portable-ruby /Library/Taps /Library/PinnedTaps +/Library/Homebrew/.byebug_history # Ignore Bundler files **/.bundle/bin @@ -77,6 +78,7 @@ **/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/u* **/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/x* **/vendor/bundle/ruby/*/gems/thread_safe-*/lib/thread_safe/util +**/vendor/bundle/ruby/*/gems/byebug-*/ # Ignore dependencies we don't wish to vendor **/vendor/bundle/ruby/*/gems/ast-*/ diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index 065dd6c83e..2c28f3de29 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" # installed gems +gem "byebug" gem "coveralls", "~> 0.8", require: false gem "parallel_tests" gem "ronn", require: false diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 94e9ba9808..bdc2db070a 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -8,6 +8,7 @@ GEM tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) ast (2.4.0) + byebug (11.1.3) concurrent-ruby (1.1.6) connection_pool (2.2.2) coveralls (0.8.23) @@ -119,6 +120,7 @@ PLATFORMS DEPENDENCIES activesupport + byebug concurrent-ruby coveralls (~> 0.8) mechanize diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 18bff0c88b..e2facbfa5b 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -22,6 +22,8 @@ module Homebrew switch "--online", description: "Include tests that use the GitHub API and tests that use any of the taps for "\ "official external commands." + switch "--byebug", + description: "Enable debugging using byebug." flag "--only=", description: "Run only `_spec.rb`. Appending `:` will start at a "\ "specific line." @@ -39,6 +41,8 @@ module Homebrew Homebrew.install_bundler_gems! gem_user_dir = Gem.user_dir + require "byebug" if args.byebug? + HOMEBREW_LIBRARY_PATH.cd do ENV.delete("HOMEBREW_COLOR") ENV.delete("HOMEBREW_NO_COLOR") diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 65490fddfa..f40e98cb25 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -39,6 +39,7 @@ require "rspec/retry" require "rubocop" require "rubocop/rspec/support" require "find" +require "byebug" $LOAD_PATH.push(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib")) @@ -177,7 +178,7 @@ RSpec.configure do |config| @__stdout = $stdout.clone @__stderr = $stderr.clone - unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS") + if (example.metadata.keys & [:focus, :byebug]).empty? && !ENV.key?("VERBOSE_TESTS") $stdout.reopen(File::NULL) $stderr.reopen(File::NULL) end diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index efc95978a1..ee533a1b8f 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -67,3 +67,4 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.82.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.39.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib" diff --git a/docs/Manpage.md b/docs/Manpage.md index 4b509a8bdc..36c45bea58 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1015,6 +1015,8 @@ Run Homebrew's unit and integration tests. Do not load the compatibility layer when running tests. * `--online`: Include tests that use the GitHub API and tests that use any of the taps for official external commands. +* `--byebug`: + Enable debugging using byebug. * `--only`: Run only *`test_script`*`_spec.rb`. Appending `:`*`line_number`* will start at a specific line. * `--seed`: diff --git a/manpages/brew.1 b/manpages/brew.1 index cc751d43b9..d69f8f770a 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1307,6 +1307,10 @@ Do not load the compatibility layer when running tests\. Include tests that use the GitHub API and tests that use any of the taps for official external commands\. . .TP +\fB\-\-byebug\fR +Enable debugging using byebug\. +. +.TP \fB\-\-only\fR Run only \fItest_script\fR\fB_spec\.rb\fR\. Appending \fB:\fR\fIline_number\fR will start at a specific line\. . From afb29035bd637ce98aea1018816897bdcfb46e5c Mon Sep 17 00:00:00 2001 From: vidusheeamoli Date: Mon, 18 May 2020 23:49:44 +0530 Subject: [PATCH 2/2] update gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index eb9f76b6c3..0c3bf37367 100644 --- a/.gitignore +++ b/.gitignore @@ -78,7 +78,6 @@ **/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/u* **/vendor/bundle/ruby/*/gems/mechanize-*/lib/mechanize/x* **/vendor/bundle/ruby/*/gems/thread_safe-*/lib/thread_safe/util -**/vendor/bundle/ruby/*/gems/byebug-*/ # Ignore dependencies we don't wish to vendor **/vendor/bundle/ruby/*/gems/ast-*/ @@ -133,6 +132,7 @@ **/vendor/bundle/ruby/*/gems/unf-*/ **/vendor/bundle/ruby/*/gems/unicode-display_width-*/ **/vendor/bundle/ruby/*/gems/webrobots-*/ +**/vendor/bundle/ruby/*/gems/byebug-*/ # Ignore `bin` contents (again). /bin