MCPcopy Index your code
hub / github.com/koding/kite / validatePackage

Function validatePackage

kitectl/command/install.go:241–262  ·  view source on GitHub ↗

validatePackage does some checks on kite bundle and returns the bundle path.

(tempKitePath, repoName string)

Source from the content-addressed store, hash-verified

239
240// validatePackage does some checks on kite bundle and returns the bundle path.
241func validatePackage(tempKitePath, repoName string) (bundlePath string, err error) {
242 dirs, err := ioutil.ReadDir(tempKitePath)
243 if err != nil {
244 return "", err
245 }
246
247 if len(dirs) != 1 {
248 return "", errors.New("Invalid package: Package must contain only one directory.")
249 }
250
251 bundlePath = filepath.Join(tempKitePath, dirs[0].Name())
252
253 parts := strings.Split(repoName, "/")
254 if len(parts) == 0 {
255 return "", errors.New("invalid repo URL")
256 }
257
258 kiteName := strings.TrimSuffix(parts[len(parts)-1], ".kite")
259
260 _, err = os.Stat(filepath.Join(bundlePath, "bin", kiteName))
261 return bundlePath, err
262}
263
264// installKite moves the .kite bundle into ~/kd/kites.
265func installKite(bundlePath, repoName, version string) error {

Callers 1

RunMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected