Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Better
Builder
Commits
708644f6
Verified
Commit
708644f6
authored
Sep 25, 2018
by
Aral Balkan
Browse files
Fix rule partial path on production
parent
a2d5fc9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Blockdown.coffee
View file @
708644f6
...
...
@@ -398,8 +398,10 @@ class Blockdown
parsedFilePath
=
(
path
.
parse
file
)
# console.log(parsedFilePath)
# On development, the cache folder is at /users/<name>/better.fyi/.private/cache/…
# In production, it is accessed via /app/better.fyi/.private/cache/…
# So choose the start index of the file path accordingly.
indexToStartFrom
=
if
app
.
isRunningInProduction
then
4
else
5
filePathKey
=
path
.
join
parsedFilePath
.
dir
.
split
(
'/'
)[
indexToStartFrom
..].
join
(
'/'
),
parsedFilePath
.
base
# console.log(filePathKey)
...
...
@@ -718,7 +720,7 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
#
console
.
log
(
"
\t
✓ Saving new blockerList.json and metadata.json files."
)
blockerListJSONFilePath
=
path
.
join
dataDirectory
,
'blockerList.json'
metadataFilePath
=
path
.
join
dataDirectory
,
'metadata.json'
...
...
@@ -849,7 +851,12 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
# 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
(
'/'
)
# On development, the cache folder is at /users/<name>/better.fyi/.private/cache/…
# In production, it is accessed via /app/better.fyi/.private/cache/…
# So choose the start index of the file path accordingly.
indexToStartFrom
=
if
app
.
isRunningInProduction
then
4
else
5
partialRuleFileRelativePath
=
parsedPathOfOriginalFile
.
dir
.
split
(
'/'
)[
indexToStartFrom
..].
join
(
'/'
)
partialRuleFilePath
=
path
.
join
app
.
rulePartialsDirectory
,
partialRuleFileRelativePath
fs
.
ensureDirSync
partialRuleFilePath
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment