Skip to content

Commit

Permalink
docs: Update changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Sep 8, 2023
1 parent 4ef4df9 commit 2e05797
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
#### 🚀 Updates

- Added colors to command line `--help` menus.
- Added canary support to all applicable tools.
- New `--canary` flag for `proto install`.
- Canary release will always be the latest, and can be re-installed.
- Updated the following locations to support partial versions and aliases:
- Tool versions in `.prototools`.
- Pinning a default version with `proto install --pin`.
- Setting global version with `proto global`.
- Setting local version with `proto local`.
- TOML API
- Added `install.download_url_canary` and `install.checksum_url_canary` settings.
- WASM API
- Added `command_exists`, `is_musl`, and `get_target_triple` helper functions.
- Added `skip_install` field to `NativeInstallOutput`.
- Added `skip_uninstall` field to `NativeUninstallOutput`.

#### ⚙️ Internal

Expand Down
14 changes: 11 additions & 3 deletions crates/cli/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ pub struct InstallArgs {
#[arg(required = true, help = "ID of tool")]
pub id: Id,

#[arg(default_value = "latest", help = "Version or alias of tool")]
#[arg(
default_value = "latest",
help = "Version or alias of tool",
group = "version-type"
)]
pub spec: Option<UnresolvedVersionSpec>,

#[arg(long, help = "Install a canary (next, nightly, etc) version")]
#[arg(
long,
help = "Install a canary (next, nightly, etc) version",
group = "version-type"
)]
pub canary: bool,

#[arg(long, help = "Pin version as the global default")]
Expand All @@ -36,7 +44,7 @@ pub async fn internal_install(args: InstallArgs) -> SystemResult {
args.spec.clone().unwrap_or_default()
};

if !args.canary && tool.is_setup(&version).await? {
if !version.is_canary() && tool.is_setup(&version).await? {
info!(
"{} has already been installed at {}",
tool.get_name(),
Expand Down
6 changes: 2 additions & 4 deletions crates/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ pub async fn run(args: ArgsRef<RunArgs>) -> SystemResult {
// Install the tool
debug!("Auto-install setting is configured, attempting to install");

let resolved_version = tool.get_resolved_version();

internal_install(InstallArgs {
canary: resolved_version.is_canary(),
canary: false,
id: args.id.clone(),
pin: false,
passthrough: vec![],
spec: Some(resolved_version.to_unresolved_spec()),
spec: Some(tool.get_resolved_version().to_unresolved_spec()),
})
.await?;

Expand Down
4 changes: 4 additions & 0 deletions crates/core/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ impl UnresolvedVersionSpec {
Ok(Self::from_str(value.as_ref())?)
}

pub fn is_canary(&self) -> bool {
matches!(self, UnresolvedVersionSpec::Canary)
}

pub fn to_spec(&self) -> VersionSpec {
match self {
UnresolvedVersionSpec::Canary => VersionSpec::Alias("canary".to_owned()),
Expand Down
3 changes: 2 additions & 1 deletion crates/pdk/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ where
}

/// Fetch the provided URL, deserialize the response as JSON,
/// and cache the response in memory for the duration of the WASM instance.
/// and cache the response in memory for the duration of the WASM function call.
/// Caches *does not* persist across function calls.
pub fn fetch_url_with_cache<R, U>(url: U) -> anyhow::Result<R>
where
R: DeserializeOwned,
Expand Down
6 changes: 0 additions & 6 deletions crates/pdk/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ macro_rules! err {
1,
))
};
($msg:literal, $code:expr) => {
Err(WithReturnCode::new(
PluginError::Message($msg.into()).into(),
$code,
))
};
($msg:expr) => {
Err(WithReturnCode::new($msg, 1))
};
Expand Down

0 comments on commit 2e05797

Please sign in to comment.