mirror of
https://github.com/strongdm/comply
synced 2025-12-06 06:14:09 +00:00
If pandoc appears in the path, it will be preferred over Docker.
The pandoc version must be 2.2.1 or greater. Defaults can be overridden by an optional "pandoc: pandoc" or "pandoc: docker" in the comply.yml.
This commit is contained in:
@@ -10,6 +10,15 @@ import (
|
||||
|
||||
var projectRoot string
|
||||
|
||||
var dockerAvailable, pandocAvailable bool
|
||||
|
||||
const (
|
||||
// UseDocker invokes pandoc within Docker
|
||||
UseDocker = "docker"
|
||||
// UsePandoc invokes pandoc directly
|
||||
UsePandoc = "pandoc"
|
||||
)
|
||||
|
||||
// SetProjectRoot is used by the test suite.
|
||||
func SetProjectRoot(dir string) {
|
||||
projectRoot = dir
|
||||
@@ -17,10 +26,32 @@ func SetProjectRoot(dir string) {
|
||||
|
||||
type Project struct {
|
||||
Name string `yaml:"name"`
|
||||
Pandoc string `yaml:"pandoc,omitempty"`
|
||||
FilePrefix string `yaml:"filePrefix"`
|
||||
Tickets map[string]interface{} `yaml:"tickets"`
|
||||
}
|
||||
|
||||
// SetPandoc records pandoc availability during initialization
|
||||
func SetPandoc(pandoc bool, docker bool) {
|
||||
pandocAvailable = pandoc
|
||||
dockerAvailable = docker
|
||||
}
|
||||
|
||||
// WhichPandoc indicates which pandoc invocation path should be used
|
||||
func WhichPandoc() string {
|
||||
cfg := Config()
|
||||
if cfg.Pandoc == UsePandoc {
|
||||
return UsePandoc
|
||||
}
|
||||
if cfg.Pandoc == UseDocker {
|
||||
return UseDocker
|
||||
}
|
||||
if pandocAvailable {
|
||||
return UsePandoc
|
||||
}
|
||||
return UseDocker
|
||||
}
|
||||
|
||||
// YAML is the parsed contents of ProjectRoot()/config.yml.
|
||||
func YAML() map[interface{}]interface{} {
|
||||
m := make(map[interface{}]interface{})
|
||||
|
||||
Reference in New Issue
Block a user