예제 #1
0
파일: repo.go 프로젝트: jcfrank/gogs
// extractGitBareZip extracts git-bare.zip to repository path.
func extractGitBareZip(repoPath string) error {
	z, err := zip.Open(path.Join(setting.RepoRootPath, "git-bare.zip"))
	if err != nil {
		return err
	}
	defer z.Close()

	return z.ExtractTo(repoPath)
}
예제 #2
0
파일: repo.go 프로젝트: kristofer/gogs
// extractGitBareZip extracts git-bare.zip to repository path.
func extractGitBareZip(repoPath string) error {
	z, err := zip.Open("conf/content/git-bare.zip")
	if err != nil {
		return err
	}
	defer z.Close()

	return z.ExtractTo(repoPath)
}
예제 #3
0
func ExtractBundleBytes() {
	// origin from https://github.com/wendal/gor/blob/master/gor/gor.go
	decoder := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(zipBytes))
	b, _ := ioutil.ReadAll(decoder)
	ioutil.WriteFile(tmpZipFile, b, os.ModePerm)
	z, e := zip.Open(tmpZipFile)
	if e != nil {
		panic(e)
		os.Exit(1)
	}
	z.ExtractTo("")
	defer func() {
		z.Close()
		decoder = nil
		os.Remove(tmpZipFile)
	}()
}
예제 #4
0
파일: install.go 프로젝트: insionng/purine
// new site assets
func NewSiteAsset(ctx *cli.Context) {
	zip.Verbose = false
	tmpZipFile := "tmp.zip"
	decoder := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(zipBytes))
	b, _ := ioutil.ReadAll(decoder)
	if err := ioutil.WriteFile(tmpZipFile, b, os.ModePerm); err != nil {
		log.Fatal("NewSite | %s", err.Error())
	}
	z, err := zip.Open(tmpZipFile)
	if err != nil {
		log.Fatal("NewSite | %s", err.Error())
	}
	z.ExtractTo("")
	z.Close()
	decoder = nil
	os.Remove(tmpZipFile)
	log.Info("NewSite | %-8s | Success", "Asset")
}
예제 #5
0
파일: install.go 프로젝트: WytheOnly/GoBlog
func DoInstall() {
	// origin from https://github.com/wendal/gor/blob/master/gor/gor.go
	decoder := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(zipBytes))
	b, _ := ioutil.ReadAll(decoder)
	ioutil.WriteFile(tmpZipFile, b, os.ModePerm)
	z, e := zip.Open(tmpZipFile)
	if e != nil {
		panic(e)
		os.Exit(1)
	}
	z.ExtractTo("")
	defer func() {
		z.Close()
		decoder = nil
		os.Remove(tmpZipFile)
	}()
	ioutil.WriteFile(installLockFile, []byte(fmt.Sprint(utils.Now())), os.ModePerm)
	println("install success")
}