Skip to content

Commit

Permalink
Merge pull request #144 from mackerelio/fix-windows-plugin-zip
Browse files Browse the repository at this point in the history
Fix copying plugin archives while installing a plugin on Windows
  • Loading branch information
itchyny committed Jan 19, 2018
2 parents edd3209 + 46292bf commit 313f0e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugin/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func installByArtifact(artifactFile, bindir, workdir string, overwrite bool) err
}

func looksLikePlugin(name string) bool {
if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.gz") || strings.HasSuffix(name, ".tgz") {
return false
}
return strings.HasPrefix(name, "check-") || strings.HasPrefix(name, "mackerel-plugin-")
}

Expand Down
3 changes: 3 additions & 0 deletions plugin/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func TestLooksLikePlugin(t *testing.T) {
{"hoge-mackerel-plugin-sample", false},
{"hoge-check-sample", false},
{"wrong-sample", false},
{"mackerel-plugin-sample.zip", false},
{"mackerel-plugin-sample.tgz", false},
{"check-sample.tar.gz", false},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 313f0e1

Please sign in to comment.