-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6e2fee
commit e14228d
Showing
18 changed files
with
255 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::{path::Path, sync::Arc}; | ||
|
||
use anyhow::Result; | ||
|
||
use crate::api::{app::App, models::{lockfile::{Lockfile, LOCKFILE}, Addon}}; | ||
|
||
impl App { | ||
pub async fn reset_lockfile(&self) -> Result<()> { | ||
Check warning on line 8 in src/api/app/actions/lockfile/mod.rs GitHub Actions / clippymethod `reset_lockfile` is never used
|
||
let mut new_lockfile = self.new_lockfile.write().await; | ||
*new_lockfile = Lockfile::default(); | ||
|
||
Ok(()) | ||
} | ||
|
||
pub async fn read_existing_lockfile(&self, base: &Path) -> Result<()> { | ||
let path = base.join(LOCKFILE); | ||
|
||
if path.exists() { | ||
let mut existing_lockfile = self.existing_lockfile.write().await; | ||
*existing_lockfile = Some(serde_json::from_str::<Lockfile>(&tokio::fs::read_to_string(base.join(LOCKFILE)).await?)?); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
pub async fn write_lockfile(&self, base: &Path) -> Result<()> { | ||
let lockfile = self.new_lockfile.read().await; | ||
|
||
tokio::fs::write(base.join(LOCKFILE), serde_json::to_vec(&*lockfile)?).await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub async fn add_addon_to_lockfile(self: Arc<Self>, addon: Addon) { | ||
println!("Added Addon to lockfile"); | ||
self.new_lockfile.write().await.addons.push(addon); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ mod build; | |
mod init; | ||
mod markdown; | ||
mod script; | ||
mod lockfile; |
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
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
Oops, something went wrong.