Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'remove-bug-reporter' -- doesn't give us much over manua…

…l bug reports.

The bug reporter was only reporting a narrow set of bugs, i.e. exceptions hit
during dep definition. The intention was to report bugs in babushka core, but
the way it was being triggered meant it reported problems defining any dep, not
just core ones, and excluded exceptions occurring in babushka itself.

Secondly, this class was a UI problem, because failed runs during dep
definition would block at a confirmation prompt instead of exiting straight to
the command prompt. This is unexpected behaviour and would only be justified by
a big enough win elsewhere.

Thirdly, the reporter just wasn't used much. I hardly ever got bug reporter
emails, which means either it's almost never triggered, or users don't send
the reports through when it is. Either way, it's not doing anything useful, so
it's time to prune it.
  • Loading branch information...
commit 0929009452f1e09161a5003c4df76a01482fbaa5 2 parents 9741eb3 + d2d2fb7
@benhoskings authored
View
50 lib/babushka/bug_reporter.rb
@@ -1,50 +0,0 @@
-module Babushka
- class BugReporter
- extend LogHelpers
- extend ShellHelpers
-
- # This method creates a bug report for +dep+, by reading the debug log
- # associated with it and posting them as a gist. If the github user is
- # set in the git config, it's marked as from that user, otherwise it's
- # anonymous.
- def self.report dep
- Prompt.confirm "I can file a bug report for that now, if you like.", :default => 'n', :otherwise => "OK, you're on your own :)" do
- post_report dep,
- (which('git') && shell('git config github.user')) || 'anonymous',
- Base.task.log_path_for(dep).read
- end
- end
-
-
- private
-
- # gist.github.com API example at http://gist.github.com/4277
- def self.post_report dep, user, log
- require 'net/http'
- require 'uri'
-
- Net::HTTP.post_form(
- URI.parse('http://gist.github.com/api/v1/xml/new'), {
- "files[from]" => user,
- "files[#{dep.contextual_name}.log]" => log.decolorize
- }
- ).tap {|response|
- report_report_result dep, response
- }.is_a? Net::HTTPSuccess
- end
-
- def self.report_report_result dep, response
- if response.is_a? Net::HTTPSuccess
- gist_id = response.body.scan(/<repo>(\d+)<\/repo>/).flatten.first
- if gist_id.nil?
- log_stderr "Done, but the report's URL couldn't be parsed. Here's some info:"
- log_stderr response.body
- else
- log "You can view the report at http://gist.github.com/#{gist_id} - thanks :)"
- end
- else
- log_stderr "Deary me, the bug report couldn't be submitted! Would you mind emailing the contents of '#{Base.task.log_path_for(dep)}' to ben@hoskings.net? Thanks."
- end
- end
- end
-end
View
1  lib/babushka/dep.rb
@@ -254,7 +254,6 @@ def process! and_meet
nil
rescue StandardError => e
log_exception_in_dep(e)
- Base.task.reportable = e.is_a?(DepDefinitionError)
nil
end
View
2  lib/babushka/task.rb
@@ -5,7 +5,6 @@ class Task
include ShellHelpers
attr_reader :cmd, :caches, :persistent_log
- attr_accessor :reportable
def initialize
clear
@@ -35,7 +34,6 @@ def process_dep dep_name, with_args
dep.with(task_args_for(dep, with_args)).process(!opt(:dry_run))
}.tap {|result|
log_stderr "You can view #{opt(:debug) ? 'the' : 'a more detailed'} log at '#{log_path_for(dep)}'." unless result
- BugReporter.report(dep) if reportable
}
end
end
View
1  lib/components.rb
@@ -50,7 +50,6 @@ module Babushka
system_profile
system_detector
system_matcher
- bug_reporter
pkg_helper
pkg_helpers/unknown_pkg_helper
pkg_helpers/apt_helper
View
6 spec/spec_helper.rb
@@ -41,10 +41,4 @@ def self.print_log message, printable, as
# Don't log while running specs.
end
end
-
- class BugReporter
- def self.report dep
- # Don't report exceptions during tests.
- end
- end
end
Please sign in to comment.
Something went wrong with that request. Please try again.