Skip to content

Commit 206cc35

Browse files
fix: files updater plugin
1 parent 6796710 commit 206cc35

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func InitConfig(cmd *cobra.Command) error {
151151
cmd.Flags().String("changelog-generator", "default", "changelog-generator plugin name")
152152
cmd.Flags().StringArray("changelog-generator-opt", []string{}, "options that are passed to the changelog-generator plugin")
153153
cmd.Flags().String("changelog", "", "creates a changelog file")
154-
cmd.Flags().StringArray("files-updater", []string{"npm"}, "files-updater plugin names")
154+
cmd.Flags().StringSlice("files-updater", []string{"npm"}, "files-updater plugin names")
155155
cmd.Flags().StringArray("files-updater-opt", []string{}, "options that are passed to the files-updater plugins")
156156
cmd.Flags().StringArrayP("update", "u", []string{}, "updates the version of a certain files")
157157
cmd.Flags().String("match", "", "only consider tags matching the given glob(7) pattern, excluding the \"refs/tags/\" prefix.")

pkg/plugin/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func startPlugin(opts *PluginOpts) (interface{}, error) {
4949
rpcClient, err := client.Client()
5050
if err != nil {
5151
client.Kill()
52-
panic(err)
52+
return nil, err
5353
}
5454
raw, err := rpcClient.Dispense(opts.Type)
5555
if err != nil {

pkg/updater/updater_wrapper.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ type FilesUpdaterServer struct {
1212
UnimplementedFilesUpdaterPluginServer
1313
}
1414

15+
func (f *FilesUpdaterServer) Init(ctx context.Context, request *FilesUpdaterInit_Request) (*FilesUpdaterInit_Response, error) {
16+
err := f.Impl.Init(request.Config)
17+
res := &FilesUpdaterInit_Response{}
18+
if err != nil {
19+
res.Error = err.Error()
20+
}
21+
return res, nil
22+
}
23+
1524
func (f *FilesUpdaterServer) Name(ctx context.Context, request *FilesUpdaterName_Request) (*FilesUpdaterName_Response, error) {
1625
return &FilesUpdaterName_Response{Name: f.Impl.Name()}, nil
1726
}
@@ -37,6 +46,19 @@ type FilesUpdaterClient struct {
3746
Impl FilesUpdaterPluginClient
3847
}
3948

49+
func (f *FilesUpdaterClient) Init(m map[string]string) error {
50+
res, err := f.Impl.Init(context.Background(), &FilesUpdaterInit_Request{
51+
Config: m,
52+
})
53+
if err != nil {
54+
return err
55+
}
56+
if res.Error != "" {
57+
return errors.New(res.Error)
58+
}
59+
return nil
60+
}
61+
4062
func (f *FilesUpdaterClient) Name() string {
4163
res, err := f.Impl.Name(context.Background(), &FilesUpdaterName_Request{})
4264
if err != nil {

0 commit comments

Comments
 (0)