Skip to content

Commit

Permalink
chore: use dependencies directly
Browse files Browse the repository at this point in the history
previously, we had been re-exporting common functionality
in the saucer crate which lived in a personal repository of mine.

this lead to not great readability and upgrading dependencies/usage
patterns became unsustainable.

this PR reverts those changes and starts using those crates directly,
in addition to creating a new `rover_std` workspace crate for reusable
functionality related to command input/output
  • Loading branch information
EverlastingBugstopper committed Nov 8, 2022
1 parent 181cbeb commit 6732654
Show file tree
Hide file tree
Showing 133 changed files with 1,362 additions and 985 deletions.
20 changes: 10 additions & 10 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ In general, it's best to keep related commands together, and to avoid cognitive
- `crates/houston`: logic related to configuring rover
- `crates/robot-panic`: Fork of `human-panic` to create panic handlers that allows users to submit crash reports as GitHub issues
- `crates/rover-client`: logic for querying apollo services
- `crates/rover-std`: wrappers around `std` modules with standardized logging and behavior
- `crates/sputnik`: logic for capturing anonymous usage data
- `crates/timber`: output formatting and logging logic
- `crates/xtask`: logic for building and testing Rover
Expand Down Expand Up @@ -113,14 +114,14 @@ A minimal command in Rover would be laid out exactly like this:

```rust
use serde::{Deserialize, Serialize};
use saucer::Parser
use crate::output::RoverOutput;
use clap::Parser
use crate::{RoverResult, RoverOutput};

#[derive(Debug, Serialize, Parser)]
pub struct MyNewCommand { }

impl MyNewCommand {
pub fn run(&self) -> Result<RoverOutput> {
pub fn run(&self) -> RoverResult<RoverOutput> {
Ok(RoverOutput::EmptySuccess)
}
}
Expand All @@ -130,16 +131,15 @@ For our `graph hello` command, we'll add a new `hello.rs` file under `src/comman

```rust
use serde::Serialize;
use saucer::{clap, Parser};
use clap::Parser;

use crate::command::RoverOutput;
use crate::Result;
use crate::{RoverResult, RoverOutput};

#[derive(Debug, Serialize, Parser)]
pub struct Hello { }

impl Hello {
pub fn run(&self) -> Result<RoverOutput> {
pub fn run(&self) -> RoverResult<RoverOutput> {
eprintln!("Hello, world!");
Ok(RoverOutput::EmptySuccess)
}
Expand Down Expand Up @@ -357,13 +357,13 @@ Before we go any further, lets make sure everything is set up properly. We're go
It should look something like this (you should make sure you are following the style of other commands when creating new ones):

```rust
pub fn run(&self, client_config: StudioClientConfig) -> Result<RoverOutput> {
pub fn run(&self, client_config: StudioClientConfig) -> RoverResult<RoverOutput> {
let client = client_config.get_client(&self.profile.name)?;
let graph_ref = self.graph.graph_ref.to_string();
eprintln!(
"Checking deletion of graph {} using credentials from the {} profile.",
Cyan.normal().paint(&graph_ref),
Yellow.normal().paint(&self.profile.name)
Style::Link.paint(&graph_ref),
Style::Command.paint(&self.profile.name)
);
let deleted_at = hello::run(
hello::graph_hello::Variables {
Expand Down
102 changes: 34 additions & 68 deletions Cargo.lock

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

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ binstall = { path = "./installers/binstall" }
houston = { path = "./crates/houston" }
robot-panic = { path = "./crates/robot-panic" }
rover-client = { path = "./crates/rover-client" }
rover-std = { path = "./crates/rover-std" }
sputnik = { path = "./crates/sputnik" }
timber = { path = "./crates/timber" }

Expand All @@ -67,20 +68,20 @@ billboard = { git = "https://github.com/EverlastingBugstopper/billboard.git", br
# https://github.com/apollographql/introspector-gadget
introspector-gadget = "0.2"

# https://github.com/EverlastingBugstopper/awc
saucer = { git = "https://github.com/EverlastingBugstopper/awc.git", rev = "fd8df605e39fdbdf4985f255a7390afccc2600cd" }

# crates.io dependencies
ansi_term = "0.12"
assert_fs = "1"
assert_cmd = "2"
assert-json-diff = "2"
atty = "0.2"
anyhow = "1"
backtrace = "0.3"
backoff = "0.4"
base64 = "0.13"
cargo_metadata = "0.15"
calm_io = "0.1"
camino = "1"
clap = "3"
chrono = "0.4"
ci_info = "0.14"
console = "0.15"
Expand Down Expand Up @@ -143,13 +144,16 @@ zip = "0.6"
### rover specific dependencies
[dependencies]
ansi_term = { workspace = true }
anyhow = { workspace = true }
assert_fs = { workspace = true }
apollo-federation-types = { workspace = true }
apollo-parser = { workspace = true }
atty = { workspace = true }
billboard = { workspace = true }
binstall = { workspace = true }
calm_io = { workspace = true }
camino = { workspace = true }
clap = { workspace = true, features = ["derive", "env"] }
chrono = { workspace = true }
console = { workspace = true }
crossbeam-channel = { workspace = true }
Expand All @@ -173,7 +177,7 @@ reqwest = { workspace = true, default-features = false, features = [
] }
robot-panic = { workspace = true }
rover-client = { workspace = true }
saucer = { workspace = true }
rover-std = { workspace = true }
semver = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion crates/houston/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ publish = false

[dependencies]
# workspace dependencies
anyhow = { workspace = true }
camino = { workspace = true }
directories-next = { workspace = true }
saucer = { workspace = true }
rover-std = { workspace = true }
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
toml = { workspace = true }
Expand Down
Loading

0 comments on commit 6732654

Please sign in to comment.