package hugo
import "github.com/gohugoio/hugo/common/hugo"
Index ¶
- Constants
- Variables
- func BuildVersionString() string
- func CompareVersion(version interface{}) int
- func GetDependencyList() []string
- func GetExecEnviron(workDir string, cfg config.Provider, fs afero.Fs) []string
- func GoMinorVersion() int
- func IsRunningAsTest() bool
- type Info
- func NewInfo(environment string) Info
- func (i Info) Generator() template.HTML
- func (i Info) IsExtended() bool
- func (i Info) IsProduction() bool
- func (i Info) Version() VersionString
- type Version
- func MustParseVersion(s string) Version
- func ParseVersion(s string) (Version, error)
- func (v Version) Next() Version
- func (v Version) NextPatchLevel(level int) Version
- func (v Version) Prev() Version
- func (v Version) ReleaseVersion() Version
- func (v Version) String() string
- func (v Version) Version() VersionString
- type VersionString
Constants ¶
const ( EnvironmentDevelopment = "development" EnvironmentProduction = "production" )
Variables ¶
var CurrentVersion = Version{ Number: 0.86, PatchLevel: 0, Suffix: "", }
CurrentVersion represents the current build version. This should be the only one.
var IsExtended = false
Functions ¶
func BuildVersionString ¶
func BuildVersionString() string
BuildVersionString creates a version string. This is what you see when running "hugo version".
func CompareVersion ¶
func CompareVersion(version interface{}) int
CompareVersion compares the given version string or number against the running Hugo version. It returns -1 if the given version is less than, 0 if equal and 1 if greater than the running version.
func GetDependencyList ¶
func GetDependencyList() []string
GetDependencyList returns a sorted dependency list on the format package="version". It includes both Go dependencies and (a manually maintained) list of C(++) dependencies.
func GetExecEnviron ¶
func GoMinorVersion ¶
func GoMinorVersion() int
func IsRunningAsTest ¶
func IsRunningAsTest() bool
IsRunningAsTest reports whether we are running as a test.
Types ¶
type Info ¶
type Info struct { CommitHash string BuildDate string // The build environment. // Defaults are "production" (hugo) and "development" (hugo server). // This can also be set by the user. // It can be any string, but it will be all lower case. Environment string }
Info contains information about the current Hugo environment
func NewInfo ¶
NewInfo creates a new Hugo Info object.
func (Info) Generator ¶
Generator a Hugo meta generator HTML tag.
func (Info) IsExtended ¶
func (Info) IsProduction ¶
func (Info) Version ¶
func (i Info) Version() VersionString
Version returns the current version as a comparable version string.
type Version ¶
type Version struct { // Major and minor version. Number float32 // Increment this for bug releases PatchLevel int // HugoVersionSuffix is the suffix used in the Hugo version string. // It will be blank for release versions. Suffix string }
Version represents the Hugo build version.
func MustParseVersion ¶
MustParseVersion parses a version string and panics if any error occurs.
func ParseVersion ¶
ParseVersion parses a version string.
func (Version) Next ¶
Next returns the next Hugo release version.
func (Version) NextPatchLevel ¶
NextPatchLevel returns the next patch/bugfix Hugo version. This will be a patch increment on the previous Hugo version.
func (Version) Prev ¶
Prev returns the previous Hugo release version.
func (Version) ReleaseVersion ¶
ReleaseVersion represents the release version.
func (Version) String ¶
func (Version) Version ¶
func (v Version) Version() VersionString
Version returns the Hugo version.
type VersionString ¶
type VersionString string
VersionString represents a Hugo version string.
func (VersionString) Compare ¶
func (h VersionString) Compare(other interface{}) int
Compare implements the compare.Comparer interface.
func (VersionString) Eq ¶
func (h VersionString) Eq(other interface{}) bool
Eq implements the compare.Eqer interface.
func (VersionString) String ¶
func (h VersionString) String() string
Source Files ¶
hugo.go vars_regular.go version.go version_current.go
- Version
- v0.86.0
- Published
- Jul 21, 2021
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 7 hours ago –
Tools for package owners.