Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## `Unreleased`

### Changed

- Modified the `rokit install` command to check if Rokit is in the user's PATH after installation, and provide appropriate instructions based on the user's operating system and shell ([#92])

[#92]: https://github.com/rojo-rbx/rokit/pull/92

## `1.0.0` - November 13th, 2024

Given that Rokit is already used in production by many Roblox developers, and many months have passed with no new major issues, it is time to release version `1.0.0`.
Expand Down
37 changes: 36 additions & 1 deletion src/cli/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use clap::Parser;

use console::style;
use futures::{stream::FuturesUnordered, TryStreamExt};
use rokit::{discovery::discover_all_manifests, storage::Home};
use rokit::{discovery::discover_all_manifests, storage::Home, system::exists_in_path};

use crate::util::{find_most_compatible_artifact, prompt_for_trust_specs, CliProgressTracker};

Expand Down Expand Up @@ -132,6 +132,41 @@ impl InstallSubcommand {
pt.formatted_elapsed(),
));

// 6. Check if PATH was updated and if the user needs to restart their terminal
// or source their shell configuration file to make Rokit available
if !exists_in_path(home) {
if cfg!(windows) {
// Windows users need to restart their PC for PATH changes to take effect
pt.finish_with_emoji_and_message(
"⚠️",
"You need to restart your computer for Rokit to be available.",
);
} else {
// Unix systems with alternative source commands
let restart_message =
"You need to restart your terminal for Rokit to be available.";
let shell_command = if let Ok(shell) = std::env::var("SHELL") {
if shell.ends_with("/zsh") {
"source ~/.zshenv"
} else if shell.ends_with("/bash") {
"source ~/.bashrc"
} else {
"source ~/.profile"
}
} else {
"source ~/.profile"
};

pt.finish_with_emoji_and_message(
"⚠️",
format!(
"{restart_message}\n\nAlternatively, run {} in your current terminal.",
style(shell_command).bold().green()
),
);
}
}

Ok(())
}
}