-
Notifications
You must be signed in to change notification settings - Fork 4
/
heuristics.go
63 lines (59 loc) · 1.7 KB
/
heuristics.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// heuristics determines how projects are built in git-based Pancake.io projects.
package heuristics
type StaticSiteType struct {
Name string
Canary string
Command string
}
var DefaultBuild = &StaticSiteType{
Name: "html",
Command: "cp -vLR $PANCAKE_SOURCE/* $PANCAKE_ARTIFACT_DIR",
}
var StaticSites = map[string]*StaticSiteType{
"jekyll": {
Name: "jekyll",
Canary: "_config.yml",
Command: gemfile("jekyll") +
" && bundle exec jekyll build --source $PANCAKE_SOURCE --destination $PANCAKE_ARTIFACT_DIR",
},
"pelican": {
Name: "pelican",
Canary: "pelicanconf.py",
Command: "pelican $PANCAKE_SOURCE --output $PANCAKE_ARTIFACT_DIR --verbose",
},
"wintersmith": {
Name: "wintersmith",
Canary: "config.json",
Command: "npm install && wintersmith build -C $PANCAKE_SOURCE -o $PANCAKE_ARTIFACT_DIR",
},
"middleman": {
Name: "middleman",
Canary: "config.rb",
Command: gemfile("middleman") +
" && bundle exec middleman build && cp -vLR $PANCAKE_SOURCE/build/* $PANCAKE_ARTIFACT_DIR/",
},
"hyde": {
Name: "hyde",
Canary: "info.yaml",
Command: "hyde gen -s $PANCAKE_SOURCE -d $PANCAKE_ARTIFACT_DIR",
},
"sphinx": {
Name: "sphinx",
Canary: "conf.py",
Command: "sphinx-build -b html $PANCAKE_SOURCE $PANCAKE_ARTIFACT_DIR",
},
"harp": {
Name: "harp",
Canary: "harp.json",
Command: "npm install && harp compile $PANCAKE_SOURCE $PANCAKE_ARTIFACT_DIR",
},
"node": {
Name: "node",
Canary: "package.json",
Command: "npm install && npm run build && cp -vLR $PANCAKE_SOURCE/build/* $PANCAKE_ARTIFACT_DIR/",
},
}
func gemfile(gem string) string {
return `if [ ! -e Gemfile ]; then echo "gem '` + gem + `'" >> Gemfile ; fi` +
` && bundle install`
}