harness

package
v0.0.0-...-0d733fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2013 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const MAIN = `` /* 1627-byte string literal not displayed */
View Source
const ROUTES = `` /* 558-byte string literal not displayed */

Variables

This section is empty.

Functions

func IsBuiltinType

func IsBuiltinType(name string) bool

Types

type App

type App struct {
	BinaryPath string // Path to the app executable
	Port       int    // Port to pass as a command line argument.
	// 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() (app *App, compileError *revel.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.

func NewApp

func NewApp(binPath string) *App

func (*App) Cmd

func (a *App) Cmd() AppCmd

Return a command to run the app server using the current configuration.

func (*App) Kill

func (a *App) Kill()

Kill the last app command returned.

type AppCmd

type AppCmd struct {
	*exec.Cmd
}

AppCmd manages the running of a Revel app server. It requires revel.Init to have been called previously.

func NewAppCmd

func NewAppCmd(binPath string, port int) AppCmd

func (AppCmd) Kill

func (cmd AppCmd) Kill()

Terminate the app server if it's running.

func (AppCmd) Run

func (cmd AppCmd) Run()

Run the app server inline. Never returns.

func (AppCmd) Start

func (cmd AppCmd) Start() error

Start the app server, and wait until it is ready to serve requests.

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() *Harness

Return a reverse proxy that forwards requests to the given port.

func (*Harness) Refresh

func (h *Harness) Refresh() (err *revel.Error)

Rebuild the Revel application and run it on the given port.

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 (hp *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.

func (*Harness) WatchDir

func (h *Harness) WatchDir(info os.FileInfo) bool

func (*Harness) WatchFile

func (h *Harness) WatchFile(filename string) bool

type MethodArg

type MethodArg struct {
	Name       string   // Name of the argument.
	TypeExpr   TypeExpr // The name of the type, e.g. "int", "*pkg.UserType"
	ImportPath string   // If the arg is of an imported type, this is the import path.
}

type MethodSpec

type MethodSpec struct {
	Name        string        // Name of the method, e.g. "Index"
	Args        []*MethodArg  // Argument descriptors
	RenderCalls []*methodCall // Descriptions of Render() invocations from this Method.
}

type SourceInfo

type SourceInfo struct {
	// StructSpecs lists type info for all structs found under the code paths.
	// They may be queried to determine which ones (transitively) embed certain types.
	StructSpecs []*TypeInfo
	// ValidationKeys provides a two-level lookup.  The keys are:
	// 1. The fully-qualified function name,
	//    e.g. "github.com/robfig/revel/samples/chat/app/controllers.(*Application).Action"
	// 2. Within that func's file, the line number of the (overall) expression statement.
	//    e.g. the line returned from runtime.Caller()
	// The result of the lookup the name of variable being validated.
	ValidationKeys map[string]map[int]string
	// A list of import paths.
	// Revel notices files with an init() function and imports that package.
	InitImportPaths []string
	// contains filtered or unexported fields
}

SourceInfo is the top-level struct containing all extracted information about the app source code, used to generate main.go.

func ProcessSource

func ProcessSource(roots []string) (*SourceInfo, *revel.Error)

Parse the app controllers directory and return a list of the controller types found. Returns a CompileError if the parsing fails.

func (*SourceInfo) ControllerSpecs

func (s *SourceInfo) ControllerSpecs() []*TypeInfo

func (*SourceInfo) TestSuites

func (s *SourceInfo) TestSuites() []*TypeInfo

func (*SourceInfo) TypesThatEmbed

func (s *SourceInfo) TypesThatEmbed(targetType string) (filtered []*TypeInfo)

TypesThatEmbed returns all types that (directly or indirectly) embed the target type, which must be a fully qualified type name, e.g. "github.com/robfig/revel.Controller"

type TypeExpr

type TypeExpr struct {
	Expr    string // The unqualified type expression, e.g. "[]*MyType"
	PkgName string // The default package idenifier

	Valid bool
	// contains filtered or unexported fields
}

TypeExpr provides a type name that may be rewritten to use a package name.

func NewTypeExpr

func NewTypeExpr(pkgName string, expr ast.Expr) TypeExpr

This returns the syntactic expression for referencing this type in Go.

func (TypeExpr) TypeName

func (e TypeExpr) TypeName(pkgOverride string) string

TypeName returns the fully-qualified type name for this expression. The caller may optionally specify a package name to override the default.

type TypeInfo

type TypeInfo struct {
	StructName  string // e.g. "Application"
	ImportPath  string // e.g. "github.com/robfig/revel/samples/chat/app/controllers"
	PackageName string // e.g. "controllers"
	MethodSpecs []*MethodSpec
	// contains filtered or unexported fields
}

TypeInfo summarizes information about a struct type in the app source code.

func (*TypeInfo) String

func (s *TypeInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL