-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to disable file sanitization
- Loading branch information
1 parent
723c000
commit 06da8ba
Showing
5 changed files
with
211 additions
and
50 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,60 @@ | ||
var fs = require("fs"); | ||
|
||
function EngineConfig(path) { | ||
this.engineJSON = JSON.parse(fs.readFileSync(path)); | ||
}; | ||
|
||
EngineConfig.prototype.includePaths = function() { | ||
return this.engineJSON.include_paths; | ||
}; | ||
|
||
// cc-yaml currently ends up passing bools as stringy equivalents | ||
function _coerceBool(val) { | ||
if (typeof(val) === "string") { | ||
return val === "true"; | ||
} else { | ||
return !!val; | ||
} | ||
}; | ||
} | ||
|
||
function UserEngineConfig(json) { | ||
this.json = json; | ||
}; | ||
class UserEngineConfig { | ||
constructor(json) { | ||
this.json = json; | ||
} | ||
|
||
EngineConfig.prototype.userConfig = function() { | ||
return new UserEngineConfig(this.engineJSON.config || {}); | ||
}; | ||
get configPath() { | ||
return this.json.config; | ||
} | ||
|
||
UserEngineConfig.prototype.configPath = function() { | ||
return this.json.config; | ||
}; | ||
get extensions() { | ||
return this.json.extensions; | ||
} | ||
|
||
UserEngineConfig.prototype.extensions = function() { | ||
return this.json.extensions; | ||
}; | ||
get debug() { | ||
return _coerceBool(this.json.debug); | ||
} | ||
|
||
UserEngineConfig.prototype.debug = function() { | ||
return _coerceBool(this.json.debug); | ||
}; | ||
get ignorePath() { | ||
return this.json.ignore_path; | ||
} | ||
|
||
UserEngineConfig.prototype.ignorePath = function() { | ||
return this.json.ignore_path; | ||
}; | ||
get ignoreWarnings() { | ||
return _coerceBool(this.json.ignore_warnings); | ||
} | ||
|
||
UserEngineConfig.prototype.ignoreWarnings = function() { | ||
return _coerceBool(this.json.ignore_warnings); | ||
}; | ||
get sanitizeBatch() { | ||
if (this.json.hasOwnProperty("sanitize_batch")) { | ||
return _coerceBool(this.json.sanitize_batch); | ||
} else { | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
class EngineConfig { | ||
constructor(path) { | ||
this.engineJSON = JSON.parse(fs.readFileSync(path)); | ||
} | ||
|
||
get includePaths() { | ||
return this.engineJSON.include_paths; | ||
} | ||
|
||
get userConfig() { | ||
return new UserEngineConfig(this.engineJSON.config || {}); | ||
} | ||
} | ||
|
||
module.exports = EngineConfig; |
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
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