Documentation ¶
Overview ¶
Package harness for a Revel Framework.
It has a following responsibilities:
- Parse the user program, generating a main.go file that registers controller classes and starts the user's server.
- Build and run the user program. Show compile errors.
- Monitor the user source and re-build / restart the program when necessary.
Source files are generated in the app/tmp directory.
Index ¶
Constants ¶
const RevelMainTemplate = `` /* 717-byte string literal not displayed */
const RevelRoutesTemplate = `` /* 661-byte string literal not displayed */
RevelRoutesTemplate template for app/conf/routes
const RevelRunTemplate = `` /* 1594-byte string literal not displayed */
RevelMainTemplate template for app/tmp/run/run.go
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { BinaryPath string // Path to the app executable Port int // Port to pass as a command line argument. PackagePathMap map[string]string // Package to directory path map Paths *model.RevelContainer // contains filtered or unexported fields }
App contains the configuration for running a Revel app. (Not for the app itself) Its only purpose is constructing the command to execute.
func Build ¶
func Build(c *model.CommandConfig, paths *model.RevelContainer) (_ *App, err error)
Build the app: 1. Generate the the main.go file. 2. Run the appropriate "go build" command. Requires that revel.Init has been called previously. Returns the path to the built binary, and an error if there was a problem building it.
type AppCmd ¶
AppCmd manages the running of a Revel app server. It requires revel.Init to have been called previously.
func (AppCmd) Run ¶
func (cmd AppCmd) Run(c *model.CommandConfig)
Run the app server inline. Never returns.
type Harness ¶
type Harness struct {
// contains filtered or unexported fields
}
Harness reverse proxies requests to the application server. It builds / runs / rebuilds / restarts the server when code is changed.
func NewHarness ¶
func NewHarness(c *model.CommandConfig, paths *model.RevelContainer, runMode string, noProxy bool) *Harness
NewHarness method returns a reverse proxy that forwards requests to the given port.
func (*Harness) Refresh ¶
func (h *Harness) Refresh() (err *utils.SourceError)
Refresh method rebuilds the Revel application and run it on the given port. called by the watcher
func (*Harness) Run ¶
func (h *Harness) Run()
Run the harness, which listens for requests and proxies them to the app server, which it runs and rebuilds as necessary.
func (*Harness) ServeHTTP ¶
func (h *Harness) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles all requests. It checks for changes to app, rebuilds if necessary, and forwards the request.