Verified Commit 7eaa6264 authored by Aral Balkan's avatar Aral Balkan
Browse files

WIP: Generate deployment diff stats (correctly aggregating now)

(Using sets instead of arrays to correctly count changes without duplicates.)
parent 822a8e0e
......@@ -809,27 +809,72 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
#
# Prepare metadata
#
rulesAdded = []
rulesUpdated = []
rulesDeleted = []
rulesAdded = new Set()
rulesUpdated = new Set()
rulesDeleted = new Set()
sitesAdded = new Set()
sitesUpdated = new Set()
sitesDeleted = new Set()
trackersAdded = new Set()
trackersUpdated = new Set()
trackersDeleted = new Set()
TRACKERS = 'trackers'
SITES = 'sites'
for key, value of @contentCurrentModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1"
# Added?
if (@contentPreviousModifiedTimes[key] == undefined)
rulesAdded.push key
rulesAdded.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersAdded.add uniqueIdentifier
if (key.indexOf SITES) > -1
sitesAdded.add uniqueIdentifier
# Updated?
else if (@contentPreviousModifiedTimes[key] != value)
rulesUpdated.push key
rulesUpdated.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersUpdated.add uniqueIdentifier
if (key.indexOf SITES) > -1
sitesUpdated.add uniqueIdentifier
for key, value of @contentPreviousModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1"
# Deleted?
if (@contentCurrentModifiedTimes[key] == undefined)
rulesDeleted.push key
rulesDeleted.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersDeleted.add uniqueIdentifier
if (key.indexOf SITES) > -1
trackersDeleted.add uniqueIdentifier
console.log("Rules added: #{rulesAdded.length}")
console.log("Rules added: #{rulesAdded.size}")
console.log(rulesAdded)
console.log("Ruled updated: #{rulesUpdated.length}")
console.log("Ruled updated: #{rulesUpdated.size}")
console.log(rulesUpdated)
console.log("Rules deleted: #{rulesDeleted.length}")
console.log("Rules deleted: #{rulesDeleted.size}")
console.log(rulesDeleted)
console.log("Trackers added: #{trackersAdded.size}")
console.log(trackersAdded)
console.log("Trackers updated: #{trackersUpdated.size}")
console.log(trackersUpdated)
console.log("Trackers deleted: #{trackersDeleted.size}")
console.log(trackersDeleted)
console.log("Sites added: #{sitesAdded.size}")
console.log(sitesAdded)
console.log("Sites updated: #{sitesUpdated.size}")
console.log(sitesUpdated)
console.log("Sites deleted: #{sitesDeleted.size}")
console.log(sitesDeleted)
# Calculate the last update time based on the content cache.
# Since timestamps have lexographical order, we can use a reduce
# on the values of the cache dictionary to achieve this.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment