Verified Commit de3f7167 authored by Aral Balkan's avatar Aral Balkan
Browse files

Remove remaining functionality/references to data generation for app

parent 119122c5
......@@ -73,7 +73,6 @@ class Blockdown
pathOfTheFileCurrentlyBeingRendered: null
rendering: null
theme: null
#
......@@ -182,7 +181,6 @@ class Blockdown
# @log.debug "Rendering data for site."
@theme = app.siteTheme
@rendering = @site
# Reset the rules
@rules = []
......@@ -213,10 +211,7 @@ class Blockdown
# TODO: Make this async
# TODO: Update render pipeline to only render content (and these partials)
# in the content pass.
# Note: Only save rule partials if we’re running in development
# ===== (the cache feature is not used in production.)
if app.isRunningInDevelopment
@saveRulePartials()
@saveRulePartials()
@saveBlockerListJSON app.dataForSiteDirectory
.then =>
......@@ -282,9 +277,6 @@ class Blockdown
themeAssetExtensions: =>
return (['.woff', '.js', '.css', '.html'].concat @imageExtensions).join '|'
themeForAppDataAssets: =>
return (extensions: @themeAssetExtensions(), path: (path.join app.themeForAppDataDirectory, 'static'))
themeForSiteDataAssets: =>
fontExtensions = ['.woff2', '.ttf', '.svg', '.eot'].join '|'
safariExtensionExtensions = ['.safariextz', '.plist'].join '|'
......@@ -515,24 +507,21 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
indexContent[category][titleOfPageClean] = listItem
#
# Save the index title info for the cache
# (only if we’re running in development. The cache feature
# is currently not used in production.)
# Save the index title info for the cache.
#
if app.isRunningInDevelopment
pathObject = path.parse file
relativeFolder = pathObject.dir.replace contentPath, ''
jsonFileName = "#{pathObject.name}.html.json"
indexCacheFile = path.join app.indicesDirectory, relativeFolder, jsonFileName
indexCacheObject =
category: category
titleOfPageClean: titleOfPageClean
listItem: listItem
# @log.info "Index cache file: #{indexCacheFile}"
# @log.info "Index cache object:"
# console.log indexCacheObject
fs.outputJSONSync indexCacheFile, indexCacheObject
pathObject = path.parse file
relativeFolder = pathObject.dir.replace contentPath, ''
jsonFileName = "#{pathObject.name}.html.json"
indexCacheFile = path.join app.indicesDirectory, relativeFolder, jsonFileName
indexCacheObject =
category: category
titleOfPageClean: titleOfPageClean
listItem: listItem
# @log.info "Index cache file: #{indexCacheFile}"
# @log.info "Index cache object:"
# console.log indexCacheObject
fs.outputJSONSync indexCacheFile, indexCacheObject
# Strip the markdown from the title for the site (keep it for the app
......@@ -847,7 +836,7 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
for pathOfOriginalFile, rules of @rulePartials
# Determine where to store the partial rule (used in caching so that we
# Determine where to store the partial rule (used in caching so that we
# can create the blocker list without having to render every rule every time).
parsedPathOfOriginalFile = path.parse pathOfOriginalFile
partialRuleFileRelativePath = parsedPathOfOriginalFile.dir.split('/')[5..].join('/')
......@@ -1075,7 +1064,7 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
#
# Renders a static badge list item (these are the badges that contain an icon, title, and explanation).
# The icon is added in the CSS (see the theme-for-app-data and theme-for-site-data repositories).
# The icon is added in the CSS (see the theme-for-site-data repository).
#
renderStaticBadgeListItem: (title, explanation) =>
......@@ -1148,12 +1137,7 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
trackersArray.map (obj) -> delete obj.formattedEntryForSite
trackersListCode = ''
if @rendering == @site
# Site code
trackersListCode = "<aside id='trackers-list' class='mfp-hide'>\n\t<h4>#{numberOfTrackers} trackers</h4>\n\t<ul>#{trackersList}\t\t</ul></aside>"
else
# App code
trackersListCode = "<script>var trackersList = #{JSON.stringify trackersArray};</script>"
trackersListCode = "<aside id='trackers-list' class='mfp-hide'>\n\t<h4>#{numberOfTrackers} trackers</h4>\n\t<ul>#{trackersList}\t\t</ul></aside>"
# Udpate global statistics.
GlobalStatistics.trackers.push numberOfTrackers
......@@ -1180,7 +1164,7 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
#
# Read in the statistics file and transform the data into the same format
# used by the ‘improvements’ section on site pages so we can reuse this
# on the main page for aggregate statistics.
# on the main page for aggregate statistics.
#
(fs.readFileAsync (path.join app.privateDirectory, 'statistics.json'), 'utf-8').then (json) =>
_ = JSON.parse json
......
......@@ -118,9 +118,6 @@ class Builder
#
updateCache: =>
Promise.try =>
if app.isRunningInProduction
@log.info "\t✓ App is running in production, not creating cache."
else
(new Cache).build()
#
......
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