Skip to content

Commit

Permalink
Make sure both scripts/ can live side by side (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger authored Mar 15, 2017
1 parent 42032fd commit 780cb69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
17 changes: 7 additions & 10 deletions scripts/generate-gitignores.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !build
// +build ignore

package main

Expand All @@ -17,17 +17,14 @@ import (
"strings"
)

var (
prefix = "gitea-gitignore"
url = "https://api.github.com/repos/github/gitignore/tarball"
destination = ""
)
func main() {
var (
prefix = "gitea-gitignore"
url = "https://api.github.com/repos/github/gitignore/tarball"
destination = ""
)

func init() {
flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores")
}

func main() {
flag.Parse()

file, err := ioutil.TempFile(os.TempDir(), prefix)
Expand Down
22 changes: 7 additions & 15 deletions scripts/generate-licenses.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !build
// +build ignore

package main

Expand All @@ -17,17 +17,14 @@ import (
"strings"
)

var (
prefix = "gitea-licenses"
url = "https://api.github.com/repos/spdx/license-list/tarball"
destination = ""
)
func main() {
var (
prefix = "gitea-licenses"
url = "https://api.github.com/repos/spdx/license-list/tarball"
destination = ""
)

func init() {
flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
}

func main() {
flag.Parse()

file, err := ioutil.TempFile(os.TempDir(), prefix)
Expand Down Expand Up @@ -73,9 +70,6 @@ func main() {
log.Fatalf("Failed to iterate archive. %s", err)
}

fmt.Println(hdr.Name)
fmt.Println(filepath.Ext(hdr.Name))

if filepath.Ext(hdr.Name) != ".txt" {
continue
}
Expand All @@ -88,8 +82,6 @@ func main() {
continue
}

fmt.Println(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))

out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))

if err != nil {
Expand Down

0 comments on commit 780cb69

Please sign in to comment.