├── README.md └── heuristics.go /README.md: -------------------------------------------------------------------------------- 1 | # Heuristics 2 | 3 | Heuristics for determining what static site generator gets executed in Pancake.io when a git push is received. 4 | -------------------------------------------------------------------------------- /heuristics.go: -------------------------------------------------------------------------------- 1 | // heuristics determines how projects are built in git-based Pancake.io projects. 2 | package heuristics 3 | 4 | type StaticSiteType struct { 5 | Name string 6 | Canary string 7 | Command string 8 | } 9 | 10 | var DefaultBuild = &StaticSiteType{ 11 | Name: "html", 12 | Command: "cp -vLR $PANCAKE_SOURCE/* $PANCAKE_ARTIFACT_DIR", 13 | } 14 | 15 | var StaticSites = map[string]*StaticSiteType{ 16 | "jekyll": { 17 | Name: "jekyll", 18 | Canary: "_config.yml", 19 | Command: gemfile("jekyll") + 20 | " && bundle exec jekyll build --source $PANCAKE_SOURCE --destination $PANCAKE_ARTIFACT_DIR", 21 | }, 22 | "pelican": { 23 | Name: "pelican", 24 | Canary: "pelicanconf.py", 25 | Command: "pelican $PANCAKE_SOURCE --output $PANCAKE_ARTIFACT_DIR --verbose", 26 | }, 27 | "wintersmith": { 28 | Name: "wintersmith", 29 | Canary: "config.json", 30 | Command: "npm install && wintersmith build -C $PANCAKE_SOURCE -o $PANCAKE_ARTIFACT_DIR", 31 | }, 32 | "middleman": { 33 | Name: "middleman", 34 | Canary: "config.rb", 35 | Command: gemfile("middleman") + 36 | " && bundle exec middleman build && cp -vLR $PANCAKE_SOURCE/build/* $PANCAKE_ARTIFACT_DIR/", 37 | }, 38 | "hyde": { 39 | Name: "hyde", 40 | Canary: "info.yaml", 41 | Command: "hyde gen -s $PANCAKE_SOURCE -d $PANCAKE_ARTIFACT_DIR", 42 | }, 43 | "sphinx": { 44 | Name: "sphinx", 45 | Canary: "conf.py", 46 | Command: "sphinx-build -b html $PANCAKE_SOURCE $PANCAKE_ARTIFACT_DIR", 47 | }, 48 | "harp": { 49 | Name: "harp", 50 | Canary: "harp.json", 51 | Command: "npm install && harp compile $PANCAKE_SOURCE $PANCAKE_ARTIFACT_DIR", 52 | }, 53 | "node": { 54 | Name: "node", 55 | Canary: "package.json", 56 | Command: "npm install && npm run build && cp -vLR $PANCAKE_SOURCE/build/* $PANCAKE_ARTIFACT_DIR/", 57 | }, 58 | } 59 | 60 | func gemfile(gem string) string { 61 | return `if [ ! -e Gemfile ]; then echo "gem '` + gem + `'" >> Gemfile ; fi` + 62 | ` && bundle install` 63 | } 64 | --------------------------------------------------------------------------------