Created
April 11, 2016 23:19
-
-
Save jaredatron/9c06ace46821b080dd368cc54d52b3aa to your computer and use it in GitHub Desktop.
# Monkey Patch Knapsack to merge reports instead of overwrite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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