-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ set up cli systems for preparation and directory cleaning
Still need to do `build` and `serve` commands.
- Loading branch information
1 parent
fd59eb3
commit 36660f8
Showing
9 changed files
with
141 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use std::path::PathBuf; | ||
use crate::errors::*; | ||
|
||
/// Builds the subcrates to get a directory that we can serve. | ||
pub fn build(dir: PathBuf, prog_args: &[String]) -> Result<()> { | ||
todo!("build command") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
mod help; | ||
mod prepare; | ||
pub mod errors; | ||
mod build; | ||
mod serve; | ||
|
||
pub const PERSEUS_VERSION: &str = "0.1.0"; | ||
use errors::*; | ||
use std::fs; | ||
use std::path::PathBuf; | ||
|
||
pub const PERSEUS_VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
pub use help::help; | ||
pub use prepare::{prepare, check_env}; | ||
pub use build::build; | ||
pub use serve::serve; | ||
|
||
/// Deletes a corrupted '.perseus/' directory. This qwill be called on certain error types that would leave the user with a half-finished | ||
/// product, which is better to delete for safety and sanity. | ||
pub fn delete_bad_dir(dir: PathBuf) -> Result<()> { | ||
let mut target = dir; | ||
target.extend([".perseus"]); | ||
// We'll only delete the directory if it exists, otherwise we're fine | ||
if target.exists() { | ||
if let Err(err) = fs::remove_dir_all(&target) { | ||
bail!(ErrorKind::RemoveBadDirFailed(target.to_str().map(|s| s.to_string()), err.to_string())) | ||
} | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use std::path::PathBuf; | ||
use crate::errors::*; | ||
|
||
/// Serves the user's app. If no arguments are provided, this will build in watch mode and serve. If `-p/--prod` is specified, we'll | ||
/// build for development, and if `--no-build` is specified, we won't build at all (useful for pseudo-production serving). | ||
/// General message though: do NOT use the CLI for production serving! | ||
pub fn serve(dir: PathBuf, prog_args: &[String]) -> Result<()> { | ||
todo!("serve command") | ||
} |