diff options
author | The Bundler Bot <bot@bundler.io> | 2016-12-14 21:32:54 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2016-12-14 21:32:54 +0000 |
commit | aa246fb680c8ef19ca315133fc4d51668fd67ab6 (patch) | |
tree | 24a489006d9348f136ab362ec964337bf700fd4e /lib | |
parent | 478bd39dcf9cc91c980db06d7da04526257d8a17 (diff) | |
parent | 926a79e2b376f304a5a8928385b81e5955482456 (diff) | |
download | bundler-aa246fb680c8ef19ca315133fc4d51668fd67ab6.tar.gz |
Auto merge of #5218 - bundler:seg-bundle-env-markdown, r=indirect
[Env] Print as GFM
I don't know if this is a good idea, but it might help increase the proportion of new issues we get that are properly formatted?
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/env.rb | 45 | ||||
-rw-r--r-- | lib/bundler/friendly_errors.rb | 30 |
2 files changed, 48 insertions, 27 deletions
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index f7c6f7e83d..7e9bcc2866 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -12,44 +12,49 @@ module Bundler print_gemfile = options.delete(:print_gemfile) print_gemspecs = options.delete(:print_gemspecs) - out = String.new("Environment\n\n") - out << " Bundler #{Bundler::VERSION}\n" - out << " Rubygems #{Gem::VERSION}\n" - out << " Ruby #{ruby_version}" - out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? - out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"] - out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"] - out << " Git #{git_version}\n" - out << " Platform #{Gem::Platform.local}\n" - out << " OpenSSL #{OpenSSL::OPENSSL_VERSION}\n" if defined?(OpenSSL::OPENSSL_VERSION) + out = String.new("## Environment\n\n```\n") + out << "Bundler #{Bundler::VERSION}\n" + out << "Rubygems #{Gem::VERSION}\n" + out << "Ruby #{ruby_version}" + out << "GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? + out << "GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"] + out << "RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"] + out << "Git #{git_version}\n" + out << "Platform #{Gem::Platform.local}\n" + out << "OpenSSL #{OpenSSL::OPENSSL_VERSION}\n" if defined?(OpenSSL::OPENSSL_VERSION) %w(rubygems-bundler open_gem).each do |name| specs = Bundler.rubygems.find_name(name) - out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty? + out << "#{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty? end - out << "\nBundler settings\n\n" unless Bundler.settings.all.empty? + out << "```\n" + + out << "\n## Bundler settings\n\n```\n" unless Bundler.settings.all.empty? Bundler.settings.all.each do |setting| - out << " " << setting << "\n" + out << setting << "\n" Bundler.settings.pretty_values_for(setting).each do |line| - out << " " << line << "\n" + out << " " << line << "\n" end end + out << "```\n" return out unless SharedHelpers.in_bundle? if print_gemfile - out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n" - out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n" + out << "\n## Gemfile\n" + out << "\n### #{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n" + out << "```ruby\n" << read_file(Bundler.default_gemfile).chomp << "\n```\n" - out << "\n#{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n" - out << " " << read_file(Bundler.default_lockfile).gsub(/\n/, "\n ") << "\n" + out << "\n### #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n" + out << "```\n" << read_file(Bundler.default_lockfile).chomp << "\n```\n" end if print_gemspecs dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) } + out << "\n## Gemspecs\n" unless dsl.gemspecs.empty? dsl.gemspecs.each do |gs| - out << "\n#{File.basename(gs.loaded_from)}" - out << "\n\n " << read_file(gs.loaded_from).gsub(/\n/, "\n ") << "\n" + out << "\n### #{File.basename(gs.loaded_from)}" + out << "\n\n```ruby\n" << read_file(gs.loaded_from).chomp << "\n```\n" end end diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index c2853294a7..3a46473448 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -58,25 +58,41 @@ module Bundler def request_issue_report_for(e) Bundler.ui.info <<-EOS.gsub(/^ {8}/, "") --- ERROR REPORT TEMPLATE ------------------------------------------------------- - - What did you do? + # Error Report + + ## Questions + + Please fill out answers to these questions, it'll help us figure out + why things are going wrong. + + - **What did you do?** I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}` - - What did you expect to happen? + - **What did you expect to happen?** I expected Bundler to... - - What happened instead? + - **What happened instead?** Instead, what happened was... + - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?** + + I tried... + + - **Have you read our issues document, https://github.com/bundler/bundler/blob/master/ISSUES.md?** + + ... - Error details + ## Backtrace - #{e.class}: #{e.message} - #{e.backtrace && e.backtrace.join("\n ")} + ``` + #{e.class}: #{e.message} + #{e.backtrace && e.backtrace.join("\n ").chomp} + ``` - #{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false).gsub(/\n/, "\n ").strip} + #{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false)} --- TEMPLATE END ---------------------------------------------------------------- EOS |