This repository has been archived by the owner on Nov 29, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")) | ||
|
||
}) | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |