From e7b228d13b5da3885532ff5d42d7f41c90dcbcb0 Mon Sep 17 00:00:00 2001
From: Eliza Weisman <eliza@buoyant.io>
Date: Thu, 20 Jan 2022 10:43:06 -0800
Subject: [PATCH] chore(console): rename `console` dir to `tokio-console`
 (#263)

Currently, the `tokio-console` CLI's crate is named `tokio-console`, but
the directory is just named `console`. This causes some problems: for
example, when we publish a release, the release tags are named
`tokio-console-vX.Y.Z`. The GitHub Action for automatically publishing
changelogs to GitHub Releases looks for the changelog in
`<tag-prefix>/CHANGELOG.md`, but this doesn't work, because the tag
prefix is not the name of the directory. So, the automatic release
publishing currently fails for the console crate:
https://github.com/tokio-rs/console/runs/4860467681?check_suite_focus=true

I figured the easiest solution was just to rename the directory to match
the crate name --- this is more consistent anyway.
---
 Cargo.toml                                    |  2 +-
 nix/tokio-console.nix                         | 22 ++++++-------------
 {console => tokio-console}/CHANGELOG.md       |  0
 {console => tokio-console}/Cargo.toml         |  0
 {console => tokio-console}/README.md          |  0
 {console => tokio-console}/src/config.rs      |  0
 {console => tokio-console}/src/conn.rs        |  0
 {console => tokio-console}/src/input.rs       |  0
 {console => tokio-console}/src/intern.rs      |  0
 {console => tokio-console}/src/lib.rs         |  0
 {console => tokio-console}/src/main.rs        |  0
 .../src/state/async_ops.rs                    |  0
 {console => tokio-console}/src/state/mod.rs   |  0
 .../src/state/resources.rs                    |  0
 {console => tokio-console}/src/state/tasks.rs |  0
 {console => tokio-console}/src/term.rs        |  0
 {console => tokio-console}/src/util.rs        |  0
 .../src/view/async_ops.rs                     |  0
 .../src/view/mini_histogram.rs                |  0
 {console => tokio-console}/src/view/mod.rs    |  0
 .../src/view/resource.rs                      |  0
 .../src/view/resources.rs                     |  0
 {console => tokio-console}/src/view/styles.rs |  0
 {console => tokio-console}/src/view/table.rs  |  0
 {console => tokio-console}/src/view/task.rs   |  0
 {console => tokio-console}/src/view/tasks.rs  |  0
 {console => tokio-console}/src/warnings.rs    |  0
 27 files changed, 8 insertions(+), 16 deletions(-)
 rename {console => tokio-console}/CHANGELOG.md (100%)
 rename {console => tokio-console}/Cargo.toml (100%)
 rename {console => tokio-console}/README.md (100%)
 rename {console => tokio-console}/src/config.rs (100%)
 rename {console => tokio-console}/src/conn.rs (100%)
 rename {console => tokio-console}/src/input.rs (100%)
 rename {console => tokio-console}/src/intern.rs (100%)
 rename {console => tokio-console}/src/lib.rs (100%)
 rename {console => tokio-console}/src/main.rs (100%)
 rename {console => tokio-console}/src/state/async_ops.rs (100%)
 rename {console => tokio-console}/src/state/mod.rs (100%)
 rename {console => tokio-console}/src/state/resources.rs (100%)
 rename {console => tokio-console}/src/state/tasks.rs (100%)
 rename {console => tokio-console}/src/term.rs (100%)
 rename {console => tokio-console}/src/util.rs (100%)
 rename {console => tokio-console}/src/view/async_ops.rs (100%)
 rename {console => tokio-console}/src/view/mini_histogram.rs (100%)
 rename {console => tokio-console}/src/view/mod.rs (100%)
 rename {console => tokio-console}/src/view/resource.rs (100%)
 rename {console => tokio-console}/src/view/resources.rs (100%)
 rename {console => tokio-console}/src/view/styles.rs (100%)
 rename {console => tokio-console}/src/view/table.rs (100%)
 rename {console => tokio-console}/src/view/task.rs (100%)
 rename {console => tokio-console}/src/view/tasks.rs (100%)
 rename {console => tokio-console}/src/warnings.rs (100%)

diff --git a/Cargo.toml b/Cargo.toml
index 6c7ec0843..0f289d821 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [workspace]
 members = [
-    "console",
+    "tokio-console",
     "console-subscriber",
     "console-api"
 ]
diff --git a/nix/tokio-console.nix b/nix/tokio-console.nix
index b6f302153..bc43123f7 100644
--- a/nix/tokio-console.nix
+++ b/nix/tokio-console.nix
@@ -1,8 +1,4 @@
-{ lib
-, protobuf
-, rustPlatform
-, nix-gitignore
-}:
+{ lib, protobuf, rustPlatform, nix-gitignore }:
 let
   inherit (nix-gitignore) gitignoreFilterPure withGitignoreFile;
   # Workaround for the builtins.filterSource issue mentioned in
@@ -12,7 +8,8 @@ let
   # builtins.filterSource in favor of builtins.path.
   gitignoreSource = patterns: path:
     builtins.path {
-      filter = gitignoreFilterPure (_: _: true) (withGitignoreFile patterns path) path;
+      filter =
+        gitignoreFilterPure (_: _: true) (withGitignoreFile patterns path) path;
       path = path;
       name = "src";
     };
@@ -33,21 +30,16 @@ let
 
   src = gitignoreSource extraIgnores ../.;
 
-  cargoTOML = lib.importTOML "${src}/console/Cargo.toml";
-in
-rustPlatform.buildRustPackage rec {
+  cargoTOML = lib.importTOML "${src}/tokio-console/Cargo.toml";
+in rustPlatform.buildRustPackage rec {
   pname = cargoTOML.package.name;
   version = cargoTOML.package.version;
 
-  nativeBuildInputs = [
-    protobuf
-  ];
+  nativeBuildInputs = [ protobuf ];
 
   inherit src;
 
-  cargoLock = {
-    lockFile = "${src}/Cargo.lock";
-  };
+  cargoLock = { lockFile = "${src}/Cargo.lock"; };
 
   meta = {
     inherit (cargoTOML.package) description homepage license;
diff --git a/console/CHANGELOG.md b/tokio-console/CHANGELOG.md
similarity index 100%
rename from console/CHANGELOG.md
rename to tokio-console/CHANGELOG.md
diff --git a/console/Cargo.toml b/tokio-console/Cargo.toml
similarity index 100%
rename from console/Cargo.toml
rename to tokio-console/Cargo.toml
diff --git a/console/README.md b/tokio-console/README.md
similarity index 100%
rename from console/README.md
rename to tokio-console/README.md
diff --git a/console/src/config.rs b/tokio-console/src/config.rs
similarity index 100%
rename from console/src/config.rs
rename to tokio-console/src/config.rs
diff --git a/console/src/conn.rs b/tokio-console/src/conn.rs
similarity index 100%
rename from console/src/conn.rs
rename to tokio-console/src/conn.rs
diff --git a/console/src/input.rs b/tokio-console/src/input.rs
similarity index 100%
rename from console/src/input.rs
rename to tokio-console/src/input.rs
diff --git a/console/src/intern.rs b/tokio-console/src/intern.rs
similarity index 100%
rename from console/src/intern.rs
rename to tokio-console/src/intern.rs
diff --git a/console/src/lib.rs b/tokio-console/src/lib.rs
similarity index 100%
rename from console/src/lib.rs
rename to tokio-console/src/lib.rs
diff --git a/console/src/main.rs b/tokio-console/src/main.rs
similarity index 100%
rename from console/src/main.rs
rename to tokio-console/src/main.rs
diff --git a/console/src/state/async_ops.rs b/tokio-console/src/state/async_ops.rs
similarity index 100%
rename from console/src/state/async_ops.rs
rename to tokio-console/src/state/async_ops.rs
diff --git a/console/src/state/mod.rs b/tokio-console/src/state/mod.rs
similarity index 100%
rename from console/src/state/mod.rs
rename to tokio-console/src/state/mod.rs
diff --git a/console/src/state/resources.rs b/tokio-console/src/state/resources.rs
similarity index 100%
rename from console/src/state/resources.rs
rename to tokio-console/src/state/resources.rs
diff --git a/console/src/state/tasks.rs b/tokio-console/src/state/tasks.rs
similarity index 100%
rename from console/src/state/tasks.rs
rename to tokio-console/src/state/tasks.rs
diff --git a/console/src/term.rs b/tokio-console/src/term.rs
similarity index 100%
rename from console/src/term.rs
rename to tokio-console/src/term.rs
diff --git a/console/src/util.rs b/tokio-console/src/util.rs
similarity index 100%
rename from console/src/util.rs
rename to tokio-console/src/util.rs
diff --git a/console/src/view/async_ops.rs b/tokio-console/src/view/async_ops.rs
similarity index 100%
rename from console/src/view/async_ops.rs
rename to tokio-console/src/view/async_ops.rs
diff --git a/console/src/view/mini_histogram.rs b/tokio-console/src/view/mini_histogram.rs
similarity index 100%
rename from console/src/view/mini_histogram.rs
rename to tokio-console/src/view/mini_histogram.rs
diff --git a/console/src/view/mod.rs b/tokio-console/src/view/mod.rs
similarity index 100%
rename from console/src/view/mod.rs
rename to tokio-console/src/view/mod.rs
diff --git a/console/src/view/resource.rs b/tokio-console/src/view/resource.rs
similarity index 100%
rename from console/src/view/resource.rs
rename to tokio-console/src/view/resource.rs
diff --git a/console/src/view/resources.rs b/tokio-console/src/view/resources.rs
similarity index 100%
rename from console/src/view/resources.rs
rename to tokio-console/src/view/resources.rs
diff --git a/console/src/view/styles.rs b/tokio-console/src/view/styles.rs
similarity index 100%
rename from console/src/view/styles.rs
rename to tokio-console/src/view/styles.rs
diff --git a/console/src/view/table.rs b/tokio-console/src/view/table.rs
similarity index 100%
rename from console/src/view/table.rs
rename to tokio-console/src/view/table.rs
diff --git a/console/src/view/task.rs b/tokio-console/src/view/task.rs
similarity index 100%
rename from console/src/view/task.rs
rename to tokio-console/src/view/task.rs
diff --git a/console/src/view/tasks.rs b/tokio-console/src/view/tasks.rs
similarity index 100%
rename from console/src/view/tasks.rs
rename to tokio-console/src/view/tasks.rs
diff --git a/console/src/warnings.rs b/tokio-console/src/warnings.rs
similarity index 100%
rename from console/src/warnings.rs
rename to tokio-console/src/warnings.rs