* 1. user docker remote api instead of docker golang sdk to do stuff 2. remote gRPC code 3. simplify command * fix(dep): remove private import * chore(*): clean up * chore(*): clean up * chore(*): commit source * fix(test): * * fix(env): enable docker remote api * fix(env): enable docker remote api * chore(*): clean up * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * fix(ci): use machine to do build * feat(timeout): longger timeout * fix(test): * * fix(typo): flag is name * chore(*): debug * chore(*): debug * chore(*): decrease test time * fix(type): disable call test since not well design yet * fix(typo): remove, * feat(images): pull images * fix(Pkg): using Pkg first * fix(Pkg): using Pkg first * feat(julia): fix version * chore(*): clean up * fix(file): ensure file exist * feat(http): remote http test * fix(circleci): fix deploy job * chore(*): update info * feat(init): update script * doc(architect): update readme * refactor(api): refactor api code * refacot(api): seperate version * refactor(build): service build as single file * feat(concurrent): down concurrent * refactor(api): refactor API * fix(endpoint): valid endpoint * fix(path): path change * feat(release): fix release script * fix(path): correct path * feat(api): seperate service run * fix(release): install goreleaser * fix(cc): fix cc * fix(releaser): install releaser from script outside of circleci config * fix(env): init logic move env * fix(cli): fix init * fix(env): avoid conflict * chore(*): update output * test(stop): add test for stop * feat(label):apply default label * doc(readme): update workflow graph * fix(init): should just start when container exist * feat(state): update container by state
38 lines
614 B
Go
38 lines
614 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/mholt/archiver"
|
|
)
|
|
|
|
// TarDir make tar of a dir
|
|
func TarDir(dir string, tarFileName string) error {
|
|
if !strings.HasSuffix(tarFileName, "tar") {
|
|
return fmt.Errorf("destination file name must end with .tar")
|
|
}
|
|
|
|
if err := os.Chdir(dir); err != nil {
|
|
return err
|
|
}
|
|
wd, err := os.Getwd()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
files, err := ioutil.ReadDir(wd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
sources := []string{}
|
|
for _, file := range files {
|
|
sources = append(sources, file.Name())
|
|
}
|
|
|
|
return archiver.Archive(sources, tarFileName)
|
|
}
|