1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

Make sure both scripts/ can live side by side (#1264)

This commit is contained in:
Thomas Boerger 2017-03-15 16:11:26 +01:00 committed by GitHub
parent 42032fdecf
commit 780cb692d6
2 changed files with 16 additions and 27 deletions

View file

@ -1,4 +1,4 @@
// +build !build
// +build ignore
package main
@ -17,17 +17,14 @@ import (
"strings"
)
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() {
var (
prefix = "gitea-gitignore"
url = "https://api.github.com/repos/github/gitignore/tarball"
destination = ""
)
flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores")
flag.Parse()
file, err := ioutil.TempFile(os.TempDir(), prefix)

View file

@ -1,4 +1,4 @@
// +build !build
// +build ignore
package main
@ -17,17 +17,14 @@ import (
"strings"
)
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() {
var (
prefix = "gitea-licenses"
url = "https://api.github.com/repos/spdx/license-list/tarball"
destination = ""
)
flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
flag.Parse()
file, err := ioutil.TempFile(os.TempDir(), prefix)
@ -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
}
@ -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 {