-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: Support monorepos for
github://
locators. (#555)
- Loading branch information
Showing
11 changed files
with
179 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,23 +25,43 @@ mod locator { | |
|
||
assert_eq!( | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "proto_plugin".into(), | ||
repo_slug: "moonrepo/proto".into(), | ||
tag: None, | ||
project_name: None, | ||
})) | ||
.to_string(), | ||
"github://moonrepo/proto" | ||
); | ||
|
||
assert_eq!( | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "proto_plugin".into(), | ||
repo_slug: "moonrepo/proto".into(), | ||
tag: None, | ||
project_name: Some("tool".into()), | ||
})) | ||
.to_string(), | ||
"github://moonrepo/proto/tool" | ||
); | ||
|
||
assert_eq!( | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
repo_slug: "moonrepo/proto".into(), | ||
tag: Some("latest".into()), | ||
project_name: None, | ||
})) | ||
.to_string(), | ||
"github://moonrepo/proto@latest" | ||
); | ||
|
||
assert_eq!( | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
repo_slug: "moonrepo/proto".into(), | ||
tag: Some("latest".into()), | ||
project_name: Some("tool".into()), | ||
})) | ||
.to_string(), | ||
"github://moonrepo/proto/tool@latest" | ||
); | ||
} | ||
|
||
#[test] | ||
|
@@ -150,9 +170,9 @@ mod locator { | |
assert_eq!( | ||
PluginLocator::try_from("github:moonrepo/bun".to_string()).unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_plugin".into(), | ||
repo_slug: "moonrepo/bun".into(), | ||
tag: None, | ||
project_name: None, | ||
})) | ||
); | ||
} | ||
|
@@ -162,9 +182,9 @@ mod locator { | |
assert_eq!( | ||
PluginLocator::try_from("github://moonrepo/bun".to_string()).unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_plugin".into(), | ||
repo_slug: "moonrepo/bun".into(), | ||
tag: None, | ||
project_name: None, | ||
})) | ||
); | ||
} | ||
|
@@ -174,9 +194,9 @@ mod locator { | |
assert_eq!( | ||
PluginLocator::try_from("github://moonrepo/tools/bun_tool".to_string()).unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_tool".into(), | ||
repo_slug: "moonrepo/tools".into(), | ||
tag: None, | ||
project_name: Some("bun_tool".into()), | ||
})) | ||
); | ||
} | ||
|
@@ -186,9 +206,9 @@ mod locator { | |
assert_eq!( | ||
PluginLocator::try_from("github://moonrepo/bun-plugin@latest".to_string()).unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_plugin".into(), | ||
repo_slug: "moonrepo/bun-plugin".into(), | ||
tag: Some("latest".into()), | ||
project_name: None, | ||
})) | ||
); | ||
} | ||
|
@@ -198,9 +218,9 @@ mod locator { | |
assert_eq!( | ||
PluginLocator::try_from("github://moonrepo/[email protected]".to_string()).unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_plugin".into(), | ||
repo_slug: "moonrepo/bun_plugin".into(), | ||
tag: Some("v1.2.3".into()), | ||
project_name: None, | ||
})) | ||
); | ||
} | ||
|
@@ -211,9 +231,9 @@ mod locator { | |
PluginLocator::try_from("github://moonrepo/tools/[email protected]".to_string()) | ||
.unwrap(), | ||
PluginLocator::GitHub(Box::new(GitHubLocator { | ||
file_prefix: "bun_tool".into(), | ||
repo_slug: "moonrepo/tools".into(), | ||
tag: Some("v1.2.3".into()), | ||
project_name: Some("bun_tool".into()), | ||
})) | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,16 +67,17 @@ Download an asset from a GitHub release. This approach communicates with the Git | |
Defining a `GITHUB_TOKEN` environment variable is recommended to avoid rate limiting. | ||
|
||
```rust | ||
// github:org/repo | ||
// github:org/[email protected] | ||
// github://org/repo | ||
// github://org/[email protected] | ||
// github://org/repo/project | ||
PluginLocator::GitHub(GitHubLocator{ | ||
file_prefix: "file_prefix".into(), | ||
repo_slug: "org/repo".into(), | ||
project_name: None, | ||
tag: Some("v1.2.3".into()), // Latest if `None` | ||
}) | ||
``` | ||
|
||
> The `file_prefix` cannot be configured with the string format, and defaults to the repository name in snake_case, suffixed with `_plugin`. | ||
> The `project_name` field exists to support monorepos. When defined, it will look for a tag/release that starts with the project name. For example, if the project name was `example_plugin`, it will match `example_plugin-v1.2.3` or `[email protected]` tags. | ||
## Extism plugin containers | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.