devmode

package
v0.0.0-...-68371d7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package devmode contains helpers to configure Development Mode.

Index

Constants

View Source
const (

	// WatchAndRun is the name of the script that watches source files and runs the
	// build_and_run.sh script when those files change.
	WatchAndRun = "watch_and_run.sh"
)

Variables

View Source
var (
	// GoWatchedExtensions is the list of file extensions to be watched for changes in Dev Mode for Go.
	GoWatchedExtensions = []string{"go"}
)
View Source
var (
	// JavaWatchedExtensions is the list of file extensions to be watched for changes in Dev Mode for Java.
	// A change to any of those files triggers a rebuild/restart of the application.
	JavaWatchedExtensions = []string{"java", "kt", "scala", "groovy", "clj"}
)
View Source
var (
	// NodeWatchedExtensions is the list of file extensions to be watched for changes in Dev Mode for NodeJS.
	NodeWatchedExtensions = []string{"js", "mjs", "coffee", "litcoffee", "json"}
)

Functions

func AddFileWatcherProcess

func AddFileWatcherProcess(ctx *gcp.Context, cfg Config)

AddFileWatcherProcess installs and configures a file watcher as the entrypoint.

func AddSyncMetadata

func AddSyncMetadata(ctx *gcp.Context, syncRulesFn func(string) []SyncRule)

AddSyncMetadata adds sync metadata to the final image.

func Enabled

func Enabled(ctx *gcp.Context) bool

Enabled indicates that the builder is running in Development mode.

func WriteBuildScript

func WriteBuildScript(ctx *gcp.Context, layerSrc, dest string, command []string)

WriteBuildScript writes the build steps to a script to be run on each file change in dev mode.

Types

type Config

type Config struct {
	BuildCmd []string
	RunCmd   []string
	// Ext lists the file extensions that trigger a restart.
	Ext []string
}

Config describes the dev mode for a given language.

type SyncRule

type SyncRule struct {
	// Src is a glob, and assumed to be a path relative to the user's workspace.
	Src string `toml:"src"`

	// Dest is the destination root folder where changed files are copied.
	// Relative directory structure is preserved while copying.
	Dest string `toml:"dest"`
}

SyncRule represents a sync rule.

func DotNetSyncRules

func DotNetSyncRules(dest string) []SyncRule

DotNetSyncRules is the list of SyncRules to be configured in Dev Mode for .NET.

func GoSyncRules

func GoSyncRules(dest string) []SyncRule

GoSyncRules is the list of SyncRules to be configured in Dev Mode for Go.

func JavaSyncRules

func JavaSyncRules(dest string) []SyncRule

JavaSyncRules is the list of SyncRules to be configured in Dev Mode for Java.

func NodeSyncRules

func NodeSyncRules(dest string) []SyncRule

NodeSyncRules is the list of SyncRules to be configured in Dev Mode for NodeJS.

Jump to

Keyboard shortcuts

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