Skip to content

Commit

Permalink
Merge pull request #9 from rstudio/jmw/bump-bioc-manifest-version
Browse files Browse the repository at this point in the history
chore: add v5 manifest schema for bioc
  • Loading branch information
jmwoliver authored Mar 13, 2024
2 parents cfab93c + 6651ddc commit da47c83
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions pkg/metadata/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var validSchemas = []int{
var validBiocSchemas = []int{
3,
4,
5,
}

func IsValidSchema(v version.ManifestVersion) bool {
Expand Down
3 changes: 3 additions & 0 deletions pkg/metadata/schemas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ func (s *SchemaSuite) TestIsValidBiocSchema() {
{"v2", false},
{"v3", true},
{"v4", true},
{"v5", true},
{"v13", false},
{"1", false},
{"2", false},
{"3", true},
{"4", true},
{"5", true},
{"13", false},
{"v1/2", false},
{"v2/2", false},
Expand All @@ -73,6 +75,7 @@ func (s *SchemaSuite) TestIsValidBiocSchema() {
{"v2/2/4", false},
{"v3/2/4", true},
{"v4/2/4", true},
{"v5/2/4", true},
{"v13/2/4", false},
} {
v, err := version.ParseNewManifestVersion(test.version)
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/filepath_getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/rstudio/package-manager-rpackagerewriter/pkg/archive"
"github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v1"
"github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v2"
v1 "github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v1"
v2 "github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v2"
)

type FilePathGetter interface {
Expand Down Expand Up @@ -42,7 +42,7 @@ func (f *defaultFilePathGetterFactory) GetFilePathGetter(schemaVersion int) (Fil

func (f *biocFilePathGetterFactory) GetFilePathGetter(schemaVersion int) (FilePathGetter, error) {
switch schemaVersion {
case 3, 4:
case 3, 4, 5:
// Bioc was originally created at parity with CRAN at version 3. Version 4 of bioc was a simple copy
// of version 3 that was used to force a fresh sync so that a fix in the sync code would be picked
// up. For both of these reasons, the Bioc transformer here is the same as the CRAN V2V3FilePathGetter.
Expand Down
8 changes: 6 additions & 2 deletions pkg/utils/filepath_getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/suite"

"github.com/rstudio/package-manager-rpackagerewriter/pkg/archive"
"github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v1"
"github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v2"
v1 "github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v1"
v2 "github.com/rstudio/package-manager-rpackagerewriter/pkg/utils/v2"
)

func TestFilePathGetterSuite(t *testing.T) {
Expand Down Expand Up @@ -65,6 +65,10 @@ func (s *FilePathGetterSuite) TestGetBioc() {
s.Require().Nil(err)
s.Require().IsType(&v2.V2V3FilePathGetter{}, fpg)

fpg, err = fpf.GetFilePathGetter(5)
s.Require().Nil(err)
s.Require().IsType(&v2.V2V3FilePathGetter{}, fpg)

_, err = fpf.GetFilePathGetter(13)
s.Require().ErrorContains(err, "Invalid version 13 for GetFilePathGetter")
}

0 comments on commit da47c83

Please sign in to comment.