shared.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package buildpacks
  2. import (
  3. "github.com/google/go-github/github"
  4. )
  5. const (
  6. // NodeJS
  7. yarn = "yarn"
  8. npm = "npm"
  9. // Go
  10. mod = "mod"
  11. dep = "dep"
  12. // Python
  13. pipenv = "pipenv"
  14. pip = "pip"
  15. conda = "conda"
  16. // Ruby
  17. puma = "puma"
  18. thin = "thin"
  19. unicorn = "unicorn"
  20. passenger = "passenger"
  21. rackup = "rackup"
  22. rake = "rake"
  23. // Common
  24. standalone = "standalone"
  25. // Builders
  26. PaketoBuilder = "paketo"
  27. HerokuBuilder = "heroku"
  28. )
  29. type BuildpackInfo struct {
  30. Name string `json:"name"`
  31. Buildpack string `json:"buildpack"`
  32. Config map[string]interface{} `json:"config"`
  33. }
  34. type BuilderInfo struct {
  35. Name string `json:"name"`
  36. Builders []string `json:"builders"`
  37. Detected []BuildpackInfo `json:"detected"`
  38. Others []BuildpackInfo `json:"others"`
  39. }
  40. type Runtime interface {
  41. Detect(
  42. *github.Client, // github client to pull contents of files
  43. []*github.RepositoryContent, // the root folder structure of the git repo
  44. string, // owner
  45. string, // name
  46. string, // path
  47. github.RepositoryContentGetOptions, // SHA, branch or tag
  48. *BuilderInfo, // paketo
  49. *BuilderInfo, // heroku
  50. ) error
  51. }
  52. // Runtimes is a list of all API runtimes
  53. var Runtimes = []Runtime{
  54. NewGoRuntime(),
  55. NewNodeRuntime(),
  56. NewPythonRuntime(),
  57. NewRubyRuntime(),
  58. }