Compare commits
3 Commits
perl
...
0.8.88-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c375fb9eaf | ||
|
|
70c314229f | ||
|
|
66e23ead00 |
10
.github/workflows/docker.yml
vendored
10
.github/workflows/docker.yml
vendored
@@ -57,11 +57,11 @@ jobs:
|
||||
run: |
|
||||
docker push metrue/fx-python-base:latest
|
||||
|
||||
# - name: build and publish fx rust image
|
||||
# if: always()
|
||||
# run: |
|
||||
# docker build -t metrue/fx-rust-base:latest -f ./assets/dockerfiles/base/rust/Dockerfile ./assets/dockerfiles/base/python
|
||||
# docker push metrue/fx-rust-base:latest
|
||||
- name: build and publish fx perl image
|
||||
if: always()
|
||||
run: |
|
||||
docker build -t metrue/fx-perl-base:latest -f ./assets/dockerfiles/base/perl/Dockerfile ./assets/dockerfiles/base/perl
|
||||
docker push metrue/fx-perl-base:latest
|
||||
|
||||
- name: build and publish fx julia image
|
||||
if: always()
|
||||
|
||||
1
assets/dockerfiles/base/perl/cpanfile
vendored
1
assets/dockerfiles/base/perl/cpanfile
vendored
@@ -1,2 +1,3 @@
|
||||
requires "EV";
|
||||
requires "JSON";
|
||||
requires "Mojolicious::Lite";
|
||||
|
||||
2
fx.go
2
fx.go
@@ -17,7 +17,7 @@ import (
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
)
|
||||
|
||||
const version = "0.8.87"
|
||||
const version = "0.8.88"
|
||||
|
||||
func init() {
|
||||
go checkForUpdate()
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/metrue/fx/context"
|
||||
"github.com/metrue/fx/utils"
|
||||
)
|
||||
|
||||
// Parse parse input
|
||||
@@ -15,7 +16,11 @@ func Parse(action string) func(ctx context.Contexter) (err error) {
|
||||
case "up":
|
||||
sources := []string{}
|
||||
for _, s := range cli.Args() {
|
||||
sources = append(sources, s)
|
||||
if utils.IsDir(s) || utils.IsRegularFile(s) {
|
||||
sources = append(sources, s)
|
||||
} else {
|
||||
return fmt.Errorf("no such file or directory: %s", s)
|
||||
}
|
||||
}
|
||||
ctx.Set("sources", sources)
|
||||
name := cli.String("name")
|
||||
|
||||
49
middlewares/parse_test.go
Normal file
49
middlewares/parse_test.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"flag"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
mockCtx "github.com/metrue/fx/context/mocks"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
t.Run("source code not existed", func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
ctx := mockCtx.NewMockContexter(ctrl)
|
||||
argset := flag.NewFlagSet("test", 0)
|
||||
cli := cli.NewContext(nil, argset, nil)
|
||||
argset.Parse([]string{"this_file_should_not_existed"})
|
||||
ctx.EXPECT().GetCliContext().Return(cli)
|
||||
if err := Parse("up")(ctx); err == nil {
|
||||
t.Fatal("should got file or directory not existed error")
|
||||
}
|
||||
})
|
||||
t.Run("source code ready", func(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
ctx := mockCtx.NewMockContexter(ctrl)
|
||||
argset := flag.NewFlagSet("test", 0)
|
||||
cli := cli.NewContext(nil, argset, nil)
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
argset.Parse([]string{pwd})
|
||||
ctx.EXPECT().GetCliContext().Return(cli)
|
||||
ctx.EXPECT().Set("sources", []string{pwd})
|
||||
ctx.EXPECT().Set("name", "")
|
||||
ctx.EXPECT().Set("port", 0)
|
||||
ctx.EXPECT().Set("force", false)
|
||||
if err := Parse("up")(ctx); err != nil {
|
||||
t.Fatal("should got file or directory not existed error")
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user