1
1
#![ allow( dead_code) ]
2
2
3
3
use anyhow:: Result ;
4
- use postgresql_archive:: configuration:: custom;
4
+ use postgresql_archive:: configuration:: { custom, theseus } ;
5
5
use postgresql_archive:: repository:: github:: repository:: GitHub ;
6
6
use postgresql_archive:: { VersionReq , matcher} ;
7
7
use postgresql_archive:: { get_archive, repository} ;
@@ -24,10 +24,13 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {
24
24
25
25
let releases_url = match env:: var ( "POSTGRESQL_RELEASES_URL" ) {
26
26
Ok ( custom_url) if !default_releases_url. is_empty ( ) => {
27
- register_github_repository ( ) ?;
27
+ register_custom_repository ( ) ?;
28
28
custom_url
29
29
}
30
- _ => default_releases_url,
30
+ _ => {
31
+ register_theseus_repository ( ) ?;
32
+ default_releases_url
33
+ }
31
34
} ;
32
35
println ! ( "PostgreSQL releases URL: {releases_url}" ) ;
33
36
let postgres_version_req = env:: var ( "POSTGRESQL_VERSION" ) . unwrap_or ( "*" . to_string ( ) ) ;
@@ -65,8 +68,14 @@ fn supports_github_url(url: &str) -> postgresql_archive::Result<bool> {
65
68
Ok ( host. ends_with ( "github.com" ) )
66
69
}
67
70
68
- fn register_github_repository ( ) -> Result < ( ) > {
71
+ fn register_custom_repository ( ) -> Result < ( ) > {
72
+ repository:: registry:: register ( supports_github_url, Box :: new ( GitHub :: new) ) ?;
73
+ matcher:: registry:: register ( supports_github_url, custom:: matcher) ?;
74
+ Ok ( ( ) )
75
+ }
76
+
77
+ fn register_theseus_repository ( ) -> Result < ( ) > {
69
78
repository:: registry:: register ( supports_github_url, Box :: new ( GitHub :: new) ) ?;
70
- matcher:: registry:: register ( supports_github_url, custom :: matcher :: matcher) ?;
79
+ matcher:: registry:: register ( supports_github_url, theseus :: matcher) ?;
71
80
Ok ( ( ) )
72
81
}
0 commit comments