Skip to content

Instantly share code, notes, and snippets.

@jaredatron
Created April 11, 2016 23:19
Show Gist options
  • Save jaredatron/9c06ace46821b080dd368cc54d52b3aa to your computer and use it in GitHub Desktop.
Save jaredatron/9c06ace46821b080dd368cc54d52b3aa to your computer and use it in GitHub Desktop.
# Monkey Patch Knapsack to merge reports instead of overwrite
# Monkey Patch Knapsack to merge reports instead of overwrite
begin
class Knapsack::Report
alias_method :save_without_leading_existing_report, :save
def save
Knapsack::Presenter.existing_report = open
save_without_leading_existing_report
end
end
class << Knapsack::Presenter
attr_writer :existing_report
def report_hash
@existing_report.merge(Knapsack.tracker.test_files_with_time).sort.to_h
end
def report_yml
report_hash.to_yaml
end
def report_json
JSON.pretty_generate(report_hash)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment