Fix files for 'example' tag

This commit is contained in:
Hajime Hoshi 2016-08-26 01:21:01 +09:00
parent 7410a9d814
commit bb6da8f85c
4 changed files with 14 additions and 4 deletions

View File

@ -32,7 +32,7 @@ before_script:
script: script:
- go build -tags example -v ./... - go build -tags example -v ./...
- gopherjs build -tags example -v github.com/hajimehoshi/ebiten/examples/blocks - gopherjs build --tags example -v github.com/hajimehoshi/ebiten/examples/blocks
# Give up testing on Travis CI because of X error # Give up testing on Travis CI because of X error
# https://travis-ci.org/hajimehoshi/ebiten/jobs/107404013 # https://travis-ci.org/hajimehoshi/ebiten/jobs/107404013

View File

@ -58,10 +58,12 @@ pre {
{{- end}} {{- end}}
</p> </p>
<h2>Execute the example</h2> <h2>Execute the examples</h2>
<pre><code>:; go get github.com/hajimehoshi/ebiten <pre><code>:; go get github.com/hajimehoshi/ebiten
:; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples :; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples
:; go run rotate/main.go</code></pre> :; go run -tags example rotate/main.go</code></pre>
<p>Note that you need to specify <code>example</code> tag.</p>
<h2>Getting Started</h2> <h2>Getting Started</h2>

8
examples/README.md Normal file
View File

@ -0,0 +1,8 @@
# Exacute the examples
```sh
:; cd $GOPATH/src/github.com/hajimehoshi/ebiten/examples
:; go run -tags example rotate/main.go
```
Note that you need to specify `example` tag.

View File

@ -63,7 +63,7 @@ func createJSIfNeeded(name string) (string, error) {
} }
if (err != nil && os.IsNotExist(err)) || time.Now().Sub(stat.ModTime()) > 5*time.Second { if (err != nil && os.IsNotExist(err)) || time.Now().Sub(stat.ModTime()) > 5*time.Second {
target := "github.com/hajimehoshi/ebiten/examples/" + name target := "github.com/hajimehoshi/ebiten/examples/" + name
out, err := exec.Command("gopherjs", "build", "-o", out, target).CombinedOutput() out, err := exec.Command("gopherjs", "build", "--tags", "example", "-o", out, target).CombinedOutput()
if err != nil { if err != nil {
log.Print(string(out)) log.Print(string(out))
return "", errors.New(string(out)) return "", errors.New(string(out))