Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Commit

Permalink
started cfmanifest pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Oct 25, 2014
1 parent e1187ce commit 5fe8d1b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
40 changes: 40 additions & 0 deletions cfmanifest/manifest.go
@@ -0,0 +1,40 @@
package cfmanifest

// Manifest models a manifest.yml
// See http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html
type Manifest struct {
Apps []*ManifestApp `yaml:"applications"`
}

// ManifestApp describes an individual app as part of the manifest
type ManifestApp struct {
Name string `yaml:"name"`
Buildpack string `yaml:"buildpack"`
Command string `yaml:"command"`
Domain string `yaml:"domain"`
Instances int `yaml:"instances"`
Memory string `yaml:"memory"`
Host string `yaml:"host"`
Path string `yaml:"path"`
Timeout int `yaml:"timeout"`
NoRoute bool `yaml:"no-route"`
EnvVars map[string]string `yaml:"env"`
Services []string `yaml:"services"`
}

// NewManifest creates a Manifest
func NewManifest() (manifest *Manifest) {
return &Manifest{}
}

// AddApplication adds a default manifestApp
func (manifest *Manifest) AddApplication(appName string) (app *ManifestApp) {
app = &ManifestApp{
Name: appName,
Memory: "1024M",
Host: appName,
Timeout: 60,
}
manifest.Apps = append(manifest.Apps, app)
return
}
24 changes: 24 additions & 0 deletions cfmanifest/manifest_test.go
@@ -0,0 +1,24 @@
package cfmanifest_test

import (
"github.com/cloudfoundry-community/cf-ssh/cfmanifest"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("cfmanifest", func() {
Describe("AddApplication", func() {
var manifest *cfmanifest.Manifest

BeforeEach(func() {
manifest = cfmanifest.NewManifest()
})

It("adds first app", func() {
app := manifest.AddApplication("first")
Expect(app.Name).To(Equal("first"))

})

})
})
13 changes: 13 additions & 0 deletions cfmanifest/suite_test.go
@@ -0,0 +1,13 @@
package cfmanifest_test

import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

func TestApi(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "cfssh/cfmanifest suite")
}
13 changes: 13 additions & 0 deletions suite_test.go
@@ -0,0 +1,13 @@
package main_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"testing"
)

func TestCFSSH(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "cfssh suite")
}

0 comments on commit 5fe8d1b

Please sign in to comment.