forked from opencontrol/compliance-masonry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.go
40 lines (36 loc) · 1.04 KB
/
docs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package docs
import (
"os"
"github.com/opencontrol/compliance-masonry/commands/docs/docx"
"github.com/opencontrol/compliance-masonry/commands/docs/gitbook"
"github.com/opencontrol/compliance-masonry/tools/certifications"
"errors"
)
func BuildTemplate(config docx.Config) error {
if config.TemplatePath == "" {
return errors.New("Error: No Template Supplied")
}
if _, err := os.Stat(config.TemplatePath); os.IsNotExist(err) {
return errors.New("Error: Template does not exist")
}
err := config.BuildDocx()
if err != nil {
return err
}
return nil
}
func MakeGitbook(config gitbook.Config) (string, []error) {
warning := ""
certificationPath, err := certifications.GetCertification(config.OpencontrolDir, config.Certification)
if certificationPath == "" {
return warning, err
}
if _, err := os.Stat(config.MarkdownPath); os.IsNotExist(err) {
warning = "Warning: markdown directory does not exist"
}
config.Certification = certificationPath
if err := config.BuildGitbook(); err != nil {
return warning, err
}
return warning, nil
}