Skip to content

Commit

Permalink
feat: rename cargo-dist => dist
Browse files Browse the repository at this point in the history
This renames the crate, which means we should be sure we can publish the
crate under the name "dist". This will also start publishing the binaries
and Homebrew package under the "dist" name.
  • Loading branch information
mistydemeo committed Dec 18, 2024
1 parent 698d45b commit ad94eb4
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 185 deletions.
102 changes: 51 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-dist/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "cargo-dist"
name = "dist"
description = "Shippable application packaging for Rust"
version.workspace = true
edition.workspace = true
Expand Down
54 changes: 27 additions & 27 deletions cargo-dist/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! All the clap stuff for parsing/documenting the cli
use camino::Utf8PathBuf;
use cargo_dist::announce::{TagMode, TagSettings};
use cargo_dist_schema::TripleName;
use clap::{
builder::{PossibleValuesParser, TypedValueParser},
Args, Parser, Subcommand, ValueEnum,
};
use dist::announce::{TagMode, TagSettings};
use tracing::level_filters::LevelFilter;

#[derive(Parser, Clone, Debug)]
Expand Down Expand Up @@ -233,13 +233,13 @@ pub enum ArtifactMode {

impl ArtifactMode {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::ArtifactMode {
pub fn to_lib(self) -> dist::config::ArtifactMode {
match self {
ArtifactMode::Local => cargo_dist::config::ArtifactMode::Local,
ArtifactMode::Global => cargo_dist::config::ArtifactMode::Global,
ArtifactMode::Host => cargo_dist::config::ArtifactMode::Host,
ArtifactMode::All => cargo_dist::config::ArtifactMode::All,
ArtifactMode::Lies => cargo_dist::config::ArtifactMode::Lies,
ArtifactMode::Local => dist::config::ArtifactMode::Local,
ArtifactMode::Global => dist::config::ArtifactMode::Global,
ArtifactMode::Host => dist::config::ArtifactMode::Host,
ArtifactMode::All => dist::config::ArtifactMode::All,
ArtifactMode::Lies => dist::config::ArtifactMode::Lies,
}
}
}
Expand Down Expand Up @@ -291,10 +291,10 @@ pub enum GenerateMode {

impl GenerateMode {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::GenerateMode {
pub fn to_lib(self) -> dist::config::GenerateMode {
match self {
GenerateMode::Ci => cargo_dist::config::GenerateMode::Ci,
GenerateMode::Msi => cargo_dist::config::GenerateMode::Msi,
GenerateMode::Ci => dist::config::GenerateMode::Ci,
GenerateMode::Msi => dist::config::GenerateMode::Msi,
}
}
}
Expand Down Expand Up @@ -391,9 +391,9 @@ pub enum CiStyle {

impl CiStyle {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::CiStyle {
pub fn to_lib(self) -> dist::config::CiStyle {
match self {
CiStyle::Github => cargo_dist::config::CiStyle::Github,
CiStyle::Github => dist::config::CiStyle::Github,
}
}
}
Expand All @@ -415,13 +415,13 @@ pub enum InstallerStyle {

impl InstallerStyle {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::InstallerStyle {
pub fn to_lib(self) -> dist::config::InstallerStyle {
match self {
InstallerStyle::Shell => cargo_dist::config::InstallerStyle::Shell,
InstallerStyle::Powershell => cargo_dist::config::InstallerStyle::Powershell,
InstallerStyle::Npm => cargo_dist::config::InstallerStyle::Npm,
InstallerStyle::Homebrew => cargo_dist::config::InstallerStyle::Homebrew,
InstallerStyle::Msi => cargo_dist::config::InstallerStyle::Msi,
InstallerStyle::Shell => dist::config::InstallerStyle::Shell,
InstallerStyle::Powershell => dist::config::InstallerStyle::Powershell,
InstallerStyle::Npm => dist::config::InstallerStyle::Npm,
InstallerStyle::Homebrew => dist::config::InstallerStyle::Homebrew,
InstallerStyle::Msi => dist::config::InstallerStyle::Msi,
}
}
}
Expand Down Expand Up @@ -465,13 +465,13 @@ pub struct HostArgs {

impl HostStyle {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::HostStyle {
pub fn to_lib(self) -> dist::config::HostStyle {
match self {
HostStyle::Check => cargo_dist::config::HostStyle::Check,
HostStyle::Create => cargo_dist::config::HostStyle::Create,
HostStyle::Upload => cargo_dist::config::HostStyle::Upload,
HostStyle::Release => cargo_dist::config::HostStyle::Release,
HostStyle::Announce => cargo_dist::config::HostStyle::Announce,
HostStyle::Check => dist::config::HostStyle::Check,
HostStyle::Create => dist::config::HostStyle::Create,
HostStyle::Upload => dist::config::HostStyle::Upload,
HostStyle::Release => dist::config::HostStyle::Release,
HostStyle::Announce => dist::config::HostStyle::Announce,
}
}
}
Expand All @@ -493,10 +493,10 @@ pub enum HostStyle {

impl HostingStyle {
/// Convert the application version of this enum to the library version
pub fn to_lib(self) -> cargo_dist::config::HostingStyle {
pub fn to_lib(self) -> dist::config::HostingStyle {
match self {
HostingStyle::Github => cargo_dist::config::HostingStyle::Github,
HostingStyle::Axodotdev => cargo_dist::config::HostingStyle::Axodotdev,
HostingStyle::Github => dist::config::HostingStyle::Github,
HostingStyle::Axodotdev => dist::config::HostingStyle::Axodotdev,
}
}
}
Expand Down
34 changes: 17 additions & 17 deletions cargo-dist/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use axoprocess::Cmd;
use axoupdater::AxoUpdater;
use camino::Utf8PathBuf;
// Import everything from the lib version of ourselves
use cargo_dist::{linkage::LinkageDisplay, *};
use cargo_dist_schema::{AssetKind, DistManifest};
use clap::Parser;
use cli::{
Cli, Commands, GenerateMode, HelpMarkdownArgs, HostArgs, ManifestArgs, OutputFormat, PlanArgs,
PrintUploadFilesFromManifestArgs,
};
use console::Term;
use dist::{linkage::LinkageDisplay, *};
use miette::{miette, IntoDiagnostic};
use net::ClientSettings;

Expand Down Expand Up @@ -217,7 +217,7 @@ fn print_human_linkage(out: &mut Term, report: &DistManifest) -> Result<(), std:
}

fn cmd_build(cli: &Cli, args: &BuildArgs) -> Result<(), miette::Report> {
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(true),
create_hosting: false,
artifact_mode: args.artifacts.to_lib(),
Expand Down Expand Up @@ -254,7 +254,7 @@ fn cmd_print_upload_files_from_manifest(
}

fn cmd_host(cli: &Cli, args: &HostArgs) -> Result<(), miette::Report> {
let args = cargo_dist::config::HostArgs {
let args = dist::config::HostArgs {
steps: args.steps.iter().map(|m| m.to_lib()).collect(),
};
// host can be invoked on multiple machines, so use arg keys to disambiguate
Expand All @@ -264,7 +264,7 @@ fn cmd_host(cli: &Cli, args: &HostArgs) -> Result<(), miette::Report> {
.map(|s| s.to_string())
.collect::<Vec<_>>()
.join(",");
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(true),
create_hosting: false,
artifact_mode: config::ArtifactMode::All,
Expand All @@ -276,7 +276,7 @@ fn cmd_host(cli: &Cli, args: &HostArgs) -> Result<(), miette::Report> {
root_cmd: format!("host:{arg_key}"),
};

let report = cargo_dist::host::do_host(&config, args)?;
let report = dist::host::do_host(&config, args)?;
print(cli, &report, false, Some("host"))
}

Expand Down Expand Up @@ -382,7 +382,7 @@ fn generate_manifest(
args: &ManifestArgs,
needs_coherence: bool,
) -> Result<DistManifest, miette::Report> {
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(needs_coherence),
create_hosting: false,
artifact_mode: args.build_args.artifacts.to_lib(),
Expand Down Expand Up @@ -425,18 +425,18 @@ fn cmd_migrate(_cli: &Cli, _args: &MigrateArgs) -> Result<(), miette::Report> {
}

fn cmd_init(cli: &Cli, args: &InitArgs) -> Result<(), miette::Report> {
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(false),
create_hosting: false,
artifact_mode: cargo_dist::config::ArtifactMode::All,
artifact_mode: dist::config::ArtifactMode::All,
no_local_paths: cli.no_local_paths,
allow_all_dirty: cli.allow_dirty,
targets: cli.target.clone(),
ci: cli.ci.iter().map(|ci| ci.to_lib()).collect(),
installers: cli.installer.iter().map(|ins| ins.to_lib()).collect(),
root_cmd: "init".to_owned(),
};
let args = cargo_dist::InitArgs {
let args = dist::InitArgs {
yes: args.yes,
no_generate: args.skip_generate,
with_json_config: args.with_json_config.clone(),
Expand All @@ -447,18 +447,18 @@ fn cmd_init(cli: &Cli, args: &InitArgs) -> Result<(), miette::Report> {
}

fn cmd_generate(cli: &Cli, args: &GenerateArgs) -> Result<(), miette::Report> {
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(false),
create_hosting: false,
artifact_mode: cargo_dist::config::ArtifactMode::All,
artifact_mode: dist::config::ArtifactMode::All,
no_local_paths: cli.no_local_paths,
allow_all_dirty: cli.allow_dirty,
targets: cli.target.clone(),
ci: cli.ci.iter().map(|ci| ci.to_lib()).collect(),
installers: cli.installer.iter().map(|ins| ins.to_lib()).collect(),
root_cmd: "generate".to_owned(),
};
let args = cargo_dist::GenerateArgs {
let args = dist::GenerateArgs {
check: args.check,
modes: args.mode.iter().map(|m| m.to_lib()).collect(),
};
Expand All @@ -467,26 +467,26 @@ fn cmd_generate(cli: &Cli, args: &GenerateArgs) -> Result<(), miette::Report> {
}

fn cmd_linkage(cli: &Cli, args: &LinkageArgs) -> Result<(), miette::Report> {
let config = cargo_dist::config::Config {
let config = dist::config::Config {
tag_settings: cli.tag_settings(false),
create_hosting: false,
artifact_mode: cargo_dist::config::ArtifactMode::All,
artifact_mode: dist::config::ArtifactMode::All,
no_local_paths: cli.no_local_paths,
allow_all_dirty: cli.allow_dirty,
targets: cli.target.clone(),
ci: cli.ci.iter().map(|ci| ci.to_lib()).collect(),
installers: cli.installer.iter().map(|ins| ins.to_lib()).collect(),
root_cmd: "linkage".to_owned(),
};
let mut options = cargo_dist::linkage::LinkageArgs {
let mut options = dist::linkage::LinkageArgs {
print_output: args.print_output,
print_json: args.print_json,
from_json: args.from_json.clone(),
};
if !args.print_output && !args.print_json {
options.print_output = true;
}
cargo_dist::linkage::do_linkage(&config, &options)?;
dist::linkage::do_linkage(&config, &options)?;
Ok(())
}

Expand Down Expand Up @@ -720,7 +720,7 @@ async fn cmd_update(_config: &Cli, args: &cli::UpdateArgs) -> Result<(), miette:
// out immediately to avoid the user getting confused and thinking the update didn't work!
if !args.skip_init {
config::get_project()
.map_err(|cause| cargo_dist::errors::DistError::UpdateNotInWorkspace { cause })?;
.map_err(|cause| dist::errors::DistError::UpdateNotInWorkspace { cause })?;
}

if this_cargo_dist_provided_by_brew() {
Expand Down
3 changes: 2 additions & 1 deletion cargo-dist/tests/cli-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn test_version() {
assert_eq!(stderr, "");

let (name, ver) = stdout.split_once(' ').unwrap();
assert_eq!(name, "cargo-dist");
assert_eq!(name, "dist");
let mut ver_parts = ver.trim().split('.');
ver_parts.next().unwrap().parse::<u8>().unwrap();
ver_parts.next().unwrap().parse::<u8>().unwrap();
Expand Down Expand Up @@ -267,6 +267,7 @@ fn generate_installer(version: &axotag::Version, release_type: ReleaseSourceType
}

#[test]
#[ignore = "can't be reenabled until after the rename"]
fn test_self_update() {
// Only do this if RUIN_MY_COMPUTER_WITH_INSTALLERS is set
if std::env::var(ENV_RUIN_ME)
Expand Down
Loading

0 comments on commit ad94eb4

Please sign in to comment.