fix: Refactored grammatical errors

This commit is contained in:
dat-adi 2022-07-05 14:05:57 +05:30
parent db1d7657a7
commit a65115bfeb
9 changed files with 28 additions and 27 deletions

View file

@ -182,13 +182,13 @@ pub trait SCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
/// delete DNS challenge
async fn delete_dns_challenge(&self, key: &str) -> DBResult<()>;
/// create forge isntance
async fn create_forge_isntance(&self, f: &CreateForge) -> DBResult<()>;
/// create forge instance
async fn create_forge_instance(&self, f: &CreateForge) -> DBResult<()>;
/// get forge isntance data
/// get forge instance data
async fn get_forge(&self, hostname: &str) -> DBResult<Forge>;
/// delete forge isntance
/// delete forge instance
async fn delete_forge_instance(&self, hostname: &str) -> DBResult<()>;
/// check if a forge instance exists

View file

@ -27,10 +27,10 @@ pub async fn adding_forge_works<'a, T: SCDatabase>(
add_repo_msg: AddRepository<'a>,
) {
let _ = db.delete_forge_instance(create_forge_msg.hostname).await;
db.create_forge_isntance(&create_forge_msg).await.unwrap();
db.create_forge_instance(&create_forge_msg).await.unwrap();
assert!(
db.forge_exists(create_forge_msg.hostname).await.unwrap(),
"forge creation failed, forge existance check failure"
"forge creation failed, forge exinstance check failure"
);
{

View file

@ -111,7 +111,7 @@ impl SCDatabase for Database {
}
}
/// delete forge isntance
/// delete forge instance
async fn delete_forge_instance(&self, hostname: &str) -> DBResult<()> {
sqlx::query!(
"DELETE FROM starchart_forges WHERE hostname = ($1)",
@ -123,8 +123,8 @@ impl SCDatabase for Database {
Ok(())
}
/// create forge isntance DB
async fn create_forge_isntance(&self, f: &CreateForge) -> DBResult<()> {
/// create forge instance DB
async fn create_forge_instance(&self, f: &CreateForge) -> DBResult<()> {
let now = now_unix_time_stamp();
let forge_type = f.forge_type.to_str();
sqlx::query!(
@ -142,7 +142,7 @@ impl SCDatabase for Database {
Ok(())
}
/// get forge isntance data
/// get forge instance data
async fn get_forge(&self, hostname: &str) -> DBResult<Forge> {
struct InnerForge {
hostname: String,

View file

@ -36,10 +36,10 @@ pub trait Federate: Sync + Send {
/// utility method to remove file/dir
async fn rm_util(&self, path: &Path) -> Result<(), Self::Error>;
/// create forge isntance
async fn create_forge_isntance(&self, f: &CreateForge<'_>) -> Result<(), Self::Error>;
/// create forge instance
async fn create_forge_instance(&self, f: &CreateForge<'_>) -> Result<(), Self::Error>;
/// delete forge isntance
/// delete forge instance
async fn delete_forge_instance(&self, hostname: &str) -> Result<(), Self::Error>;
/// check if a forge instance exists
@ -48,10 +48,10 @@ pub trait Federate: Sync + Send {
/// check if an user exists.
async fn user_exists(&self, username: &str, hostname: &str) -> Result<bool, Self::Error>;
/// create user isntance
/// create user instance
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error>;
/// add repository isntance
/// add repository instance
async fn create_repository(&self, f: &AddRepository<'_>) -> Result<(), Self::Error>;
/// check if a repository exists.

View file

@ -27,7 +27,7 @@ pub async fn adding_forge_works<'a, T: Federate>(
) {
let _ = ff.delete_forge_instance(create_forge_msg.hostname).await;
assert!(!ff.forge_exists(&create_forge_msg.hostname).await.unwrap());
ff.create_forge_isntance(&create_forge_msg).await.unwrap();
ff.create_forge_instance(&create_forge_msg).await.unwrap();
assert!(ff.forge_exists(&create_forge_msg.hostname).await.unwrap());
// add user

View file

@ -128,14 +128,14 @@ impl Federate for PccFederate {
Ok(())
}
/// create forge isntance
async fn create_forge_isntance(&self, f: &CreateForge<'_>) -> FResult<()> {
/// create forge instance
async fn create_forge_instance(&self, f: &CreateForge<'_>) -> FResult<()> {
let path = self.get_instance_path(f.hostname, true).await?;
self.write_util(f, &path.join(INSTANCE_INFO_FILE)).await?;
Ok(())
}
/// delete forge isntance
/// delete forge instance
async fn delete_forge_instance(&self, hostname: &str) -> FResult<()> {
let path = self.get_instance_path(hostname, false).await?;
self.rm_util(&path).await
@ -163,13 +163,13 @@ impl Federate for PccFederate {
}
}
/// create user isntance
/// create user instance
async fn create_user(&self, f: &AddUser<'_>) -> Result<(), Self::Error> {
let path = self.get_user_path(f.username, f.hostname, true).await?;
self.write_util(f, &path.join(USER_INFO_FILE)).await
}
/// add repository isntance
/// add repository instance
async fn create_repository(&self, f: &AddRepository<'_>) -> Result<(), Self::Error> {
let path = self
.get_repo_path(f.name, f.owner, f.hostname, true)

View file

@ -193,11 +193,11 @@ def add_tag(repo: str, client: HTMLClient):
if __name__ == "__main__":
for i in range(TOTAL_NUM_REPOS):
REPOS.append(f"reopsitory_{i}")
REPOS.append(f"repository_{i}")
check_online()
print("Instace online")
print("Instance online")
install()
print("Instace configured and installed")
print("Instance configured and installed")
client = HTMLClient()
count = 0
while True:

View file

@ -32,6 +32,7 @@ pub mod routes;
pub mod settings;
pub mod spider;
pub mod static_assets;
#[cfg(test)]
mod tests;
pub mod utils;

View file

@ -37,7 +37,7 @@ impl Ctx {
hostname,
forge_type: gitea.forge_type(),
};
db.create_forge_isntance(&msg).await.unwrap();
db.create_forge_instance(&msg).await.unwrap();
} else {
if !federate.forge_exists(hostname).await.unwrap() {
let forge = db.get_forge(hostname).await.unwrap();
@ -45,7 +45,7 @@ impl Ctx {
hostname,
forge_type: forge.forge_type,
};
federate.create_forge_isntance(&msg).await.unwrap();
federate.create_forge_instance(&msg).await.unwrap();
}
}
@ -135,7 +135,7 @@ mod tests {
.unwrap());
assert!(db.user_exists(GITEA_USERNAME, None).await.unwrap());
for i in 0..100 {
let repo = format!("reopsitory_{i}");
let repo = format!("repository_{i}");
assert!(db
.repository_exists(&repo, GITEA_USERNAME, hostname.as_str())
.await