Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement coffee nurse Handler for Locally Missing Repository #197

Merged
merged 5 commits into from
Sep 29, 2023

Conversation

tareknaser
Copy link
Collaborator

No description provided.

@netlify
Copy link

netlify bot commented Sep 19, 2023

Deploy Preview for coffee-docs canceled.

Name Link
🔨 Latest commit 92aa1b2
🔍 Latest deploy log https://app.netlify.com/sites/coffee-docs/deploys/651567dd680272000881ee0d

coffee_cmd/src/main.rs Outdated Show resolved Hide resolved
coffee_core/src/nurse/chain.rs Outdated Show resolved Hide resolved
coffee_core/src/nurse/chain.rs Outdated Show resolved Hide resolved
@tareknaser tareknaser marked this pull request as ready for review September 26, 2023 16:23
@tareknaser tareknaser changed the title Prepare Coffee Nurse Command Skeleton Implement 'coffee nurse' Handler for Locally Missing Repository Sep 26, 2023
@tareknaser tareknaser changed the title Implement 'coffee nurse' Handler for Locally Missing Repository Implement coffee nurse Handler for Locally Missing Repository Sep 26, 2023
Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice job. I really like this.

I wondered what happens if I delete the repositories directory and not just a sub-directory.

Maybe the directory is a default one and it is always created, right?

coffee_cmd/src/main.rs Outdated Show resolved Hide resolved
coffee_core/src/coffee.rs Show resolved Hide resolved
coffee_core/src/coffee.rs Outdated Show resolved Hide resolved
coffee_core/src/coffee.rs Show resolved Hide resolved
coffee_core/src/coffee.rs Show resolved Hide resolved
coffee_core/src/nurse/chain.rs Show resolved Hide resolved
coffee_core/src/nurse/strategy.rs Outdated Show resolved Hide resolved
coffee_github/src/repository.rs Outdated Show resolved Hide resolved
coffee_github/src/repository.rs Show resolved Hide resolved
coffee_lib/src/types/mod.rs Outdated Show resolved Hide resolved
@tareknaser
Copy link
Collaborator Author

I wondered what happens if I delete the repositories directory and not just a sub-directory.

Maybe the directory is a default one and it is always created, right?

Yes, we call

check_dir_or_make_if_missing(format!("{def_path}/repositories")).await?;

with each command

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Small comment but this can be a followup PR

Ok(nurse) => {
// special case: if the nurse is sane
// we print a message and return
if nurse.status[0] == NurseStatus::Sane {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the future we should like to have a struct

struct NurseStatus {
   defects: Vec<...>,
}

impl NurseStatus {
   fn is_sane(&self) -> bool {
        ....
    }
}

@vincenzopalazzo
Copy link
Contributor

➜  coffee git:(pr197) cargo run --bin coffee -- --network testnet nurse
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/coffee --network testnet nurse`
╭────────────────────────────────────────────────╮
│ ●   Actions Taken        Affected repositories │
├────────────────────────────────────────────────┤
│ ●   Restored using Git   folgore-git           │
╰────────────────────────────────────────────────╯

Amazing!

@vincenzopalazzo vincenzopalazzo merged commit 21e8be0 into coffee-tools:master Sep 29, 2023
8 checks passed
@tareknaser tareknaser deleted the nurse-handler branch September 30, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants