project

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package project has the definitions and implementations required for setting up the project. It copies the boilerplate code to the required destination

Index

Constants

View Source
const (
	//ProjectName denotes the string to be replaced by the project name in the boilerplate code
	ProjectName = "{{.Name}}"
	//ProjectDescription denotes the string to be replaced by the project description in the boilerplate code
	ProjectDescription = "{{.Description}}"
	//AuthorName denotes the string to be replaced by the author name in the boilerplate code
	AuthorName = "{{.Author.Name}}"
	//AuthorEmail denotes the string to be replaced by the author email in the boilerplate code
	AuthorEmail = "{{.Author.Email}}"
	//Package denotes the string to be replaced by the package in the boilerplate code
	Package = "{{.Package}}"
	//CuttleAI denotes the string to be replaced by the author across the lICENSE information in all files
	CuttleAI = "Cuttle.ai"
	//MitStyle denotes the string to be replaced by the LICENSE Template
	MitStyle = "MIT-style"
	//Year denotes the string to be replaced by the year in LICENSE files
	Year = "{{.Year}}"
	//Organisation denotes the string to be replaced by the orgianisation in LICENSE files
	Organisation = "{{.Organisation}}"
)
View Source
const (
	//MainProjectName is the refactor name for the project name in main.go file
	MainProjectName = "Main project name"
	//MainProjectDescription is the refactor name of the project description in main.go file
	MainProjectDescription = "Main project description"
	//BoilerPlatePackage is the boiler plate package name in the import packages
	BoilerPlatePackage = "Boiler plate package name"
	//ReadmeProjectName is the refactor name for the project name in README.md file
	ReadmeProjectName = "README project name"
	//ReadmeProjectDescription is the refactor description for the project description in README.md file
	ReadmeProjectDescription = "README project description"
	//ReadmePackage is the refactor package for the package in README.md file
	ReadmePackage = "README package"
	//ReadmeAuthorName is the refactor for author name for the author name in README.md file
	ReadmeAuthorName = "README author name"
	//ReadmeAuthorEmail is the refactor for author email for the author email in README.md file
	ReadmeAuthorEmail = "README project email"
	//LicenseOrganisation is the refactor for organisation in the license files and license disclaimer in all the files
	LicenseOrganisation = "LICENSE organisation"
	//LicenseTemplate is the refactor for LICENSE type like MIT-style, closed etc.
	LicenseTemplate = "LICENSE template"
	//LicenseYear is the refactor for year in the license file
	LicenseYear = "LICENSE year"
	//LicenseProjectName is the refactor for project name in the license file
	LicenseProjectName = "LICENSE project name"
	//VersionProjectName is the refactor name for the project name in version.go file
	VersionProjectName = "Version project name"
)

Variables

View Source
var BoilerplatePackagePath = PackagePath + Separator + "boilerplate"

BoilerplatePackagePath is the package path of the boilr plate code

View Source
var BoilerplatePath = GoPath() + BoilerplatePackagePath

BoilerplatePath is the absolute path to the boilerplate code

View Source
var ConfigPath = BoilerplatePath + Separator + "config"

ConfigPath is the path of the config package in the boilerplate code

View Source
var LicensesPath = GoPath() + PackagePath + Separator + "licenses"

LicensesPath is the location where all license templates are kept

View Source
var LogPath = BoilerplatePath + Separator + "log"

LogPath is the path of the log package in the boilerplate code

View Source
var PackagePath = "github.com" + Separator + "cuttle-ai" + Separator + "web-starter"

PackagePath is the package name of web starter project

View Source
var ResponsePath = RoutesPath + Separator + "response"

ResponsePath is the path of the response package in the boilerplate code

View Source
var RoutesPath = BoilerplatePath + Separator + "routes"

RoutesPath is the path of the routes package in the boilerplate code

View Source
var Separator = string([]rune{filepath.Separator})

Separator based on the os

View Source
var VersionPath = BoilerplatePath + Separator + "version"

VersionPath is the path of the version package in the boilerplate code

Functions

func GoPath

func GoPath() string

GoPath is the gopath in the system

Types

type Author

type Author struct {
	//Name of the author
	Name string
	//Email of the author
	Email string
}

Author refers to the initial project author

func (Author) String

func (a Author) String() string

String is the stringer implementation of the author

type License

type License struct {
	//Type is the type of license
	Type LicenseType
	//Year of the license validity
	Year string
	//Organisation that issed the license
	Organisation string
}

License gives info about the license

type LicenseType

type LicenseType string

LicenseType is the type of license

const (
	//AGPL3 type license
	AGPL3 LicenseType = "AGPL-3"
	//BSD2 type license
	BSD2 LicenseType = "BSD-2"
	//BSD3 type license
	BSD3 LicenseType = "BSD-3"
	//CLOSED type license
	CLOSED LicenseType = "CLOSED"
	//GPL2 type license
	GPL2 LicenseType = "GPL-2"
	//GPL3 type license
	GPL3 LicenseType = "GPL-3"
	//MIT type license
	MIT LicenseType = "MIT"
	//UNLICENSED type license
	UNLICENSED LicenseType = "UNLICENSED"
)

type Project

type Project struct {
	//Name of the project
	Name string
	//Description of the project
	Description string
	//Author information for the project
	Author Author
	//Destination target for setting up the boilerplate code
	Destination string
	//Package is the package path to be used by the project
	Package string
	//Sources is the list of sources with refactors in the boilerplate code
	Sources []generate.Source
	//License is the license to be provided for the project
	License License
}

Project struct lists the information about the project

func (*Project) BoilerplatePackageRefactors

func (p *Project) BoilerplatePackageRefactors() generate.Refactor

BoilerplatePackageRefactors returns the package name refactor to be done in every go source file

func (*Project) InitSources

func (p *Project) InitSources()

InitSources will init the sources of the project

func (*Project) LicenseRefactors

func (p *Project) LicenseRefactors() []generate.Refactor

LicenseRefactors returns the license refactors to be done in every go source file

func (Project) Setup

func (p Project) Setup() error

Setup will setup a project with boilerplate code.

Jump to

Keyboard shortcuts

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