2018-02-22 09:15:12 +01:00
|
|
|
// Copyright 2018 The Hugo Authors. All rights reserved.
|
2015-12-10 15:19:38 -07:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-11-26 10:11:22 +01:00
|
|
|
package hugo
|
2014-12-09 08:36:07 -07:00
|
|
|
|
2015-01-19 08:26:06 +01:00
|
|
|
import (
|
2015-03-18 12:23:13 +01:00
|
|
|
"fmt"
|
2015-01-19 08:26:06 +01:00
|
|
|
"html/template"
|
|
|
|
)
|
|
|
|
|
2014-12-09 08:36:07 -07:00
|
|
|
var (
|
2016-04-07 16:05:23 +02:00
|
|
|
// CommitHash contains the current Git revision. Use make to build to make
|
|
|
|
// sure this gets set.
|
2014-12-09 08:36:07 -07:00
|
|
|
CommitHash string
|
2016-04-07 16:05:23 +02:00
|
|
|
|
|
|
|
// BuildDate contains the date of the current build.
|
|
|
|
BuildDate string
|
2014-12-09 08:36:07 -07:00
|
|
|
)
|
|
|
|
|
2018-11-26 10:11:22 +01:00
|
|
|
// Info contains information about the current Hugo environment
|
|
|
|
type Info struct {
|
|
|
|
Version VersionString
|
2015-01-19 08:26:06 +01:00
|
|
|
Generator template.HTML
|
2014-12-09 08:36:07 -07:00
|
|
|
CommitHash string
|
|
|
|
BuildDate string
|
|
|
|
}
|
|
|
|
|
2018-11-26 10:11:22 +01:00
|
|
|
func NewInfo() Info {
|
|
|
|
return Info{
|
|
|
|
Version: CurrentVersion.Version(),
|
2015-01-19 03:06:07 +01:00
|
|
|
CommitHash: CommitHash,
|
|
|
|
BuildDate: BuildDate,
|
2018-11-26 10:11:22 +01:00
|
|
|
Generator: template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String())),
|
2014-12-09 08:36:07 -07:00
|
|
|
}
|
|
|
|
}
|