From d28c24d91ce9fbffd062a3c9a165cf6a7211999a Mon Sep 17 00:00:00 2001 From: Jonathan Pike Date: Tue, 7 Mar 2017 09:57:24 -0500 Subject: [PATCH 1/4] Add bundle issue command that prints instructions for reporting issues --- lib/bundler/cli.rb | 6 ++++++ lib/bundler/cli/issue.rb | 40 +++++++++++++++++++++++++++++++++++++ spec/commands/issue_spec.rb | 11 ++++++++++ 3 files changed, 57 insertions(+) create mode 100644 lib/bundler/cli/issue.rb create mode 100644 spec/commands/issue_spec.rb diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index d5054e80547..400e0eaf9ff 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -528,6 +528,12 @@ def doctor Doctor.new(options).run end + desc "issue", "Learn how to report an issue in Bundler" + def issue + require "bundler/cli/issue" + Issue.new.run + end + if Bundler.feature_flag.plugins? require "bundler/cli/plugin" desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins" diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb new file mode 100644 index 00000000000..8e785f961ba --- /dev/null +++ b/lib/bundler/cli/issue.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require "rbconfig" + +module Bundler + class CLI::Issue + def run + Bundler.ui.info <<-EOS.gsub(/^ {8}/, "") + Did you find an issue with Bundler? Before filing a new issue, + be sure to check out these resources: + + 1. Check out our troubleshooting guide for quick fixes to common issues: + https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md + + 2. Instructions for common Bundler uses can be found on the documentation + site: http://bundler.io/ + + 3. Information about each Bundler command can be found in the Bundler + man pages: http://bundler.io/man/bundle.1.html + + Hopefully the trouble shooting steps above resolved your problem! If things + still aren't working the way you expect them to, please let us know so + that we can diagnose and hopefully fix the problem you're having. Please + view the Filing Issues guide for more information: + https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md + + EOS + + Bundler.ui.info Bundler::Env.new.report + + Bundler.ui.info "\n## Bundle Doctor" + doctor + end + + def doctor + require "bundler/cli/doctor" + Bundler::CLI::Doctor.new({}).run + end + end +end diff --git a/spec/commands/issue_spec.rb b/spec/commands/issue_spec.rb new file mode 100644 index 00000000000..e93201d76bc --- /dev/null +++ b/spec/commands/issue_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true +require "spec_helper" + +RSpec.describe "bundle issue" do + it "exits with a message" do + bundle "issue" + expect(out).to include "Did you find an issue with Bundler?" + expect(out).to include "## Environment" + expect(out).to include "## Bundle Doctor" + end +end From 58265e240a51268765d999d0961b4d78a0642e81 Mon Sep 17 00:00:00 2001 From: Jonathan Pike Date: Wed, 15 Mar 2017 16:15:54 -0400 Subject: [PATCH 2/4] Print gemfile and gemfile.lock with env output --- lib/bundler/cli/issue.rb | 2 +- spec/commands/issue_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb index 8e785f961ba..0ada298fc89 100644 --- a/lib/bundler/cli/issue.rb +++ b/lib/bundler/cli/issue.rb @@ -26,7 +26,7 @@ def run EOS - Bundler.ui.info Bundler::Env.new.report + Bundler.ui.info Bundler::Env.new.report(print_gemfile: true) Bundler.ui.info "\n## Bundle Doctor" doctor diff --git a/spec/commands/issue_spec.rb b/spec/commands/issue_spec.rb index e93201d76bc..056ef0f3003 100644 --- a/spec/commands/issue_spec.rb +++ b/spec/commands/issue_spec.rb @@ -3,9 +3,15 @@ RSpec.describe "bundle issue" do it "exits with a message" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rails" + G + bundle "issue" expect(out).to include "Did you find an issue with Bundler?" expect(out).to include "## Environment" + expect(out).to include "## Gemfile" expect(out).to include "## Bundle Doctor" end end From 0debe477ee7f005ac49dc5ca04918df7947f70b0 Mon Sep 17 00:00:00 2001 From: Jonathan Pike Date: Wed, 15 Mar 2017 17:04:29 -0400 Subject: [PATCH 3/4] Use hashrocket syntax with print_gemfile option --- lib/bundler/cli/issue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb index 0ada298fc89..06d1d828460 100644 --- a/lib/bundler/cli/issue.rb +++ b/lib/bundler/cli/issue.rb @@ -26,7 +26,7 @@ def run EOS - Bundler.ui.info Bundler::Env.new.report(print_gemfile: true) + Bundler.ui.info Bundler::Env.new.report(:print_gemfile => true) Bundler.ui.info "\n## Bundle Doctor" doctor From 6351c689470f7df4b9f52e957e2c2395bbf00786 Mon Sep 17 00:00:00 2001 From: Jonathan Pike Date: Tue, 4 Apr 2017 10:38:40 -0400 Subject: [PATCH 4/4] Minor copy changes to issue command --- lib/bundler/cli/issue.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb index 06d1d828460..c9d653296cd 100644 --- a/lib/bundler/cli/issue.rb +++ b/lib/bundler/cli/issue.rb @@ -18,9 +18,9 @@ def run 3. Information about each Bundler command can be found in the Bundler man pages: http://bundler.io/man/bundle.1.html - Hopefully the trouble shooting steps above resolved your problem! If things + Hopefully the troubleshooting steps above resolved your problem! If things still aren't working the way you expect them to, please let us know so - that we can diagnose and hopefully fix the problem you're having. Please + that we can diagnose and help fix the problem you're having. Please view the Filing Issues guide for more information: https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md