pkg

package
v0.0.0-...-7776c26 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GEN_CFG_FILENAME      = "package.yml"
	TEMPLATE_DIRNAME      = "templates"
	DEFAULT_TEMPLATES_DIR = "~/.jumpstart/" + TEMPLATE_DIRNAME
	TEMPLATE_SOURCE       = "https://github.com/nurdsoft/jumpstart-templates"
)
View Source
const (
	DEFAULT_CODEPROVIDER = "github.com"
)

Variables

View Source
var (
	VERSION   string
	COMMIT    string
	BUILDTIME string
)

Functions

func NewApp

func NewApp() *cli.App

func SetupGithubRemote

func SetupGithubRemote(ctx context.Context, namespace string, repoName string, localRepo *git.Repository, push bool) error

namespace should be empty if it is not an org

func SyncTemplates

func SyncTemplates(dest string) error

func SynthesizePipelineConfigurationFile

func SynthesizePipelineConfigurationFile(pipeline Pipeline, outDir string) (string, error)

func SynthesizeProject

func SynthesizeProject(ctx context.Context, tid string, dm *DerivedMetadata) error

func SynthesizeProjectFromDir

func SynthesizeProjectFromDir(ctx map[string]any, srcTemplateDir string, cfg *Configuration, outDir string) (err error)

func VersionControl

func VersionControl(dir, repoName string) (*git.Repository, error)

Types

type Commands

type Commands struct {
	UnixLike []string `yaml:"unix"`
	Windows  []string `yaml:"windows"`
	All      []string
}

func (*Commands) UnmarshalYAML

func (c *Commands) UnmarshalYAML(unmarshal func(interface{}) error) error

type Configuration

type Configuration struct {
	Name     string   `yaml:"name"`
	Binary   string   `yaml:"binary"`
	Commands Commands `yaml:"commands"`
	Pipeline Pipeline `yaml:"pipeline"`
}

func GetTemplateConfiguration

func GetTemplateConfiguration(ctx pongo2.Context, srcTemplateDir string) (*Configuration, error)

type DerivedMetadata

type DerivedMetadata struct {
	// Project name
	Name string
	// Github namespace / organization
	Namespace string
	// Authenticated user
	User string
	// Code provider
	CodeProvider string
	// Output directory
	OutDir string
}

func NewDerivedMetadata

func NewDerivedMetadata(ctx context.Context, input string) (*DerivedMetadata, error)

func (*DerivedMetadata) IsGithubOrg

func (dm *DerivedMetadata) IsGithubOrg() bool

type GithubAPI

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

func NewGithubAPI

func NewGithubAPI() *GithubAPI

func (*GithubAPI) CreateRepo

func (api *GithubAPI) CreateRepo(ctx context.Context, orgName, repoName string) (*github.Repository, error)

orgName is the name of the organization to create the repo in. If it is an empty string, the repo will be created in the user's account.

func (*GithubAPI) GetAuthUser

func (api *GithubAPI) GetAuthUser(ctx context.Context) (*github.User, error)

type Pipeline

type Pipeline struct {
	Setup   []string
	Build   []string
	Install []string
	Run     string
}

func (*Pipeline) Dockerfile

func (pipeline *Pipeline) Dockerfile() string

type SSHKeys

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

func NewSSHKeys

func NewSSHKeys() *SSHKeys

func (*SSHKeys) Get

func (s *SSHKeys) Get() string

func (*SSHKeys) List

func (s *SSHKeys) List() []string

func (*SSHKeys) SetSelected

func (s *SSHKeys) SetSelected(i int)

type TemplateProvider

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

func NewTemplateProvider

func NewTemplateProvider(baseDir string) (*TemplateProvider, error)

func (*TemplateProvider) GetTemplate

func (tp *TemplateProvider) GetTemplate(name string) string

func (*TemplateProvider) ListTemplates

func (tp *TemplateProvider) ListTemplates() []string

Jump to

Keyboard shortcuts

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