Separate license and version from docs

This commit is contained in:
Hajime Hoshi 2014-12-29 23:16:02 +09:00
parent b77181e37a
commit 075c67a84c
6 changed files with 60 additions and 34 deletions

View File

@ -23,27 +23,37 @@ import (
"os"
"path/filepath"
"regexp"
"strings"
)
const (
outputPath = "public/index.html"
templatePath = "index_tmpl.html"
templatePath = "index.tmpl.html"
)
// TODO: License should be on another file
const license = `Copyright 2014 Hajime Hoshi
var license = ""
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
func init() {
b, err := ioutil.ReadFile("../license.txt")
if err != nil {
panic(err)
}
license = string(b)
http://www.apache.org/licenses/LICENSE-2.0
// TODO: Year check
}
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.`
var stableVersion = ""
var devVersion = ""
func init() {
b, err := ioutil.ReadFile("../version.txt")
if err != nil {
panic(err)
}
devVersion = string(b)
}
func comment(text string) template.HTML {
// TODO: text should be escaped
@ -86,6 +96,17 @@ func (e *example) Source() string {
return str
}
func versions() string {
vers := []string{}
if stableVersion != "" {
vers = append(vers, "Stable: "+stableVersion)
}
if devVersion != "" {
vers = append(vers, "Development: "+devVersion)
}
return strings.Join(vers, ", ")
}
func main() {
f, err := os.Create(outputPath)
if err != nil {
@ -102,6 +123,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
examples := []example{
{Name: "blocks"},
{Name: "hue"},
@ -111,6 +133,7 @@ func main() {
}
data := map[string]interface{}{
"License": license,
"Versions": versions(),
"Examples": examples,
}
if err := t.Funcs(funcs).Execute(f, data); err != nil {

View File

@ -19,9 +19,9 @@ table.examples td.code pre {
height: 240px;
overflow: auto;
}
</style>
<h1>Ebiten (海老天) v1.0.0-alpha</h1>
<h1>Ebiten (海老天)</h1>
<p>{{.Versions}}</p>
<ul>
<li>A simple SNES-like 2D game library in Go</li>
<li>Works on

View File

@ -11,7 +11,8 @@ 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.-->
limitations under the License.
-->
<link rel="shortcut icon" href="./favicon.png" type="image/png" >
<link rel="icon" href="./favicon.png" type="image/png" >
<title>Ebiten - A simple SNES-like 2D game library in Go</title>
@ -31,9 +32,10 @@ table.examples td.code pre {
height: 240px;
overflow: auto;
}
</style>
<h1>Ebiten (海老天) v1.0.0-alpha</h1>
<h1>Ebiten (海老天)</h1>
<p>Development: 1.0.0-alpha
</p>
<ul>
<li>A simple SNES-like 2D game library in Go</li>
<li>Works on
@ -299,4 +301,5 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an &#34;AS IS&#34; 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.</code></pre>
limitations under the License.
</code></pre>

13
license.txt Normal file
View File

@ -0,0 +1,13 @@
Copyright 2014 Hajime Hoshi
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.

View File

@ -1,4 +1,4 @@
# Ebiten (海老天) v1.0.0-alpha
# Ebiten (海老天)
[![Build Status](https://travis-ci.org/hajimehoshi/ebiten.svg?branch=master)](https://travis-ci.org/hajimehoshi/ebiten)
@ -53,18 +53,4 @@
## License
```
Copyright 2014 Hajime Hoshi
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.
```
See license.txt.

1
version.txt Normal file
View File

@ -0,0 +1 @@
1.0.0-alpha