gateway

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

ignore is a library which returns a new ignorer object which can test against various paths. This is particularly useful when trying to filter files based on a .gitignore document

The rules for parsing the input file are the same as the ones listed in the Git docs here: http://git-scm.com/docs/gitignore

The summarized version of the same has been copied here:

  1. A blank line matches no files, so it can serve as a separator for readability.
  2. A line starting with # serves as a comment. Put a backslash ("\") in front of the first hash for patterns that begin with a hash.
  3. Trailing spaces are ignored unless they are quoted with backslash ("\").
  4. An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "\!important!.txt".
  5. If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git).
  6. If the pattern does not contain a slash /, Git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).
  7. Otherwise, Git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html".
  8. A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
  9. Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: i. A leading "**" followed by a slash means match in all directories. For example, "** /foo" matches file or directory "foo" anywhere, the same as pattern "foo". "** /foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". ii. A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth. iii. A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/** /b" matches "a/b", "a/x/b", "a/x/y/b" and so on. iv. Other consecutive asterisks are considered invalid.

Index

Constants

View Source
const (
	CLI_SOURCE_HEADER = "cli"
)

Variables

This section is empty.

Functions

func GetHost

func GetHost() string

Types

type GQLError added in v0.2.28

type GQLError struct {
	Message string `json:"message"`
}

func (GQLError) Error added in v0.2.28

func (e GQLError) Error() string

type GQLRequest added in v0.2.28

type GQLRequest struct {
	// contains filtered or unexported fields
}

func (*GQLRequest) Run added in v0.2.28

func (r *GQLRequest) Run(ctx context.Context, resp interface{}) error

func (*GQLRequest) Var added in v0.2.28

func (r *GQLRequest) Var(name string, value interface{})

type GQLResponse added in v0.2.28

type GQLResponse struct {
	Errors []GQLError  `json:"errors"`
	Data   interface{} `json:"data"`
}

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

func New

func New() *Gateway

func (*Gateway) ConsumeLoginSession

func (g *Gateway) ConsumeLoginSession(ctx context.Context, code string) (string, error)

func (*Gateway) CreateEnvironment added in v0.2.12

func (g *Gateway) CreateEnvironment(ctx context.Context, req *entity.CreateEnvironmentRequest) (*entity.Environment, error)

func (*Gateway) CreateEphemeralEnvironment added in v0.2.12

func (g *Gateway) CreateEphemeralEnvironment(ctx context.Context, req *entity.CreateEphemeralEnvironmentRequest) (*entity.Environment, error)

func (*Gateway) CreateLoginSession

func (g *Gateway) CreateLoginSession(ctx context.Context) (string, error)

func (*Gateway) CreatePlugin

func (g *Gateway) CreatePlugin(ctx context.Context, req *entity.CreatePluginRequest) (*entity.Plugin, error)

func (*Gateway) CreateProject

func (g *Gateway) CreateProject(ctx context.Context, req *entity.CreateProjectRequest) (*entity.Project, error)

func (*Gateway) CreateProjectFromTemplate added in v0.1.35

func (*Gateway) DeleteEnvironment added in v0.2.12

func (g *Gateway) DeleteEnvironment(ctx context.Context, req *entity.DeleteEnvironmentRequest) error

func (*Gateway) DeleteProject

func (g *Gateway) DeleteProject(ctx context.Context, projectId string) error

func (*Gateway) DeleteVariable added in v0.2.39

func (g *Gateway) DeleteVariable(ctx context.Context, req *entity.DeleteVariableRequest) error

func (*Gateway) DeployEnvironmentTriggers added in v0.2.7

func (g *Gateway) DeployEnvironmentTriggers(ctx context.Context, req *entity.DeployEnvironmentTriggersRequest) error

func (*Gateway) Down added in v1.3.0

func (g *Gateway) Down(ctx context.Context, req *entity.DownRequest) error

func (*Gateway) GetAvailablePlugins

func (g *Gateway) GetAvailablePlugins(ctx context.Context, projectId string) ([]string, error)

func (*Gateway) GetDeploymentByID added in v0.2.2

func (g *Gateway) GetDeploymentByID(ctx context.Context, req *entity.DeploymentByIDRequest) (*entity.Deployment, error)

func (*Gateway) GetDeploymentsForEnvironment added in v0.2.2

func (g *Gateway) GetDeploymentsForEnvironment(ctx context.Context, projectId, environmentId string) ([]*entity.Deployment, error)

func (*Gateway) GetEnvs

func (g *Gateway) GetEnvs(ctx context.Context, req *entity.GetEnvsRequest) (*entity.Envs, error)

func (*Gateway) GetLatestDeploymentForEnvironment added in v0.2.2

func (g *Gateway) GetLatestDeploymentForEnvironment(ctx context.Context, projectID, environmentID string) (*entity.Deployment, error)

func (*Gateway) GetProject

func (g *Gateway) GetProject(ctx context.Context, projectId string) (*entity.Project, error)

GetProject returns the project associated with the projectId, as well as it's environments, plugins, etc

func (*Gateway) GetProjectByName added in v0.2.34

func (g *Gateway) GetProjectByName(ctx context.Context, projectName string) (*entity.Project, error)

func (*Gateway) GetProjectDeploymentsURL added in v0.2.7

func (g *Gateway) GetProjectDeploymentsURL(projectID string) string

func (*Gateway) GetProjectToken added in v0.2.25

func (g *Gateway) GetProjectToken(ctx context.Context) (*entity.ProjectToken, error)

GetProjectToken looks up a project and environment by the RAILWAY_TOKEN

func (*Gateway) GetProjects

func (g *Gateway) GetProjects(ctx context.Context) ([]*entity.Project, error)

GetProjects returns all projects associated with the user, as well as their environments associated with those projects, error otherwise Performs a dual join

func (*Gateway) GetStarters added in v0.2.38

func (g *Gateway) GetStarters(ctx context.Context) ([]*entity.Starter, error)

func (*Gateway) GetUser

func (g *Gateway) GetUser(ctx context.Context) (*entity.User, error)

func (*Gateway) GetWorkflowStatus added in v0.1.35

func (g *Gateway) GetWorkflowStatus(ctx context.Context, workflowID string) (entity.WorkflowStatus, error)

func (*Gateway) GetWritableGithubScopes added in v0.1.35

func (g *Gateway) GetWritableGithubScopes(ctx context.Context) ([]string, error)

GetWritableGithubScopes returns scopes associated with Railway user

func (*Gateway) Logout added in v0.2.25

func (g *Gateway) Logout(ctx context.Context) error

func (*Gateway) NewRequestWithAuth added in v0.2.28

func (g *Gateway) NewRequestWithAuth(query string) (*GQLRequest, error)

func (*Gateway) NewRequestWithoutAuth added in v0.2.28

func (g *Gateway) NewRequestWithoutAuth(query string) *GQLRequest

func (*Gateway) OpenProjectDeploymentsInBrowser added in v0.1.35

func (g *Gateway) OpenProjectDeploymentsInBrowser(projectID string) error

func (*Gateway) OpenProjectInBrowser

func (g *Gateway) OpenProjectInBrowser(projectID string, environmentID string) error

func (*Gateway) OpenProjectPathInBrowser added in v0.2.22

func (g *Gateway) OpenProjectPathInBrowser(projectID string, environmentID string, path string) error

func (*Gateway) OpenStaticUrlInBrowser added in v0.2.22

func (g *Gateway) OpenStaticUrlInBrowser(staticUrl string) error

func (*Gateway) SendPanic

func (g *Gateway) SendPanic(ctx context.Context, req *entity.PanicRequest) (bool, error)

func (*Gateway) Up

func (*Gateway) UpdateProject

func (g *Gateway) UpdateProject(ctx context.Context, req *entity.UpdateProjectRequest) (*entity.Project, error)

func (*Gateway) UpsertVariablesFromObject added in v0.2.39

func (g *Gateway) UpsertVariablesFromObject(ctx context.Context, req *entity.UpdateEnvsRequest) error

type GitIgnore

type GitIgnore struct {
	// contains filtered or unexported fields
}

GitIgnore wraps a list of ignore pattern.

func CompileIgnoreFile

func CompileIgnoreFile(fpath string) (*GitIgnore, error)

Accepts a ignore file as the input, parses the lines out of the file and invokes the CompileIgnoreLines method

func CompileIgnoreFileAndLines

func CompileIgnoreFileAndLines(fpath string, lines ...string) (*GitIgnore, error)

Accepts a ignore file as the input, parses the lines out of the file and invokes the CompileIgnoreLines method with additional lines

func CompileIgnoreLines

func CompileIgnoreLines(lines ...string) (*GitIgnore, error)

Accepts a variadic set of strings, and returns a GitIgnore object which converts and appends the lines in the input to regexp.Regexp patterns held within the GitIgnore objects "patterns" field

func (*GitIgnore) MatchesPath

func (gi *GitIgnore) MatchesPath(f string) bool

MatchesPath returns true if the given GitIgnore structure would target a given path string `f`.

type IgnoreParser

type IgnoreParser interface {
	MatchesPath(f string) bool
}

An IgnoreParser is an interface which exposes a single method:

MatchesPath() - Returns true if the path is targeted by the patterns compiled
                in the GitIgnore structure

Jump to

Keyboard shortcuts

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