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

Feature setup #84

Closed
wants to merge 91 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
f328a8d
Removed unneccesary files, start fresh. Here we go
lordofwizard Mar 11, 2024
8b69042
New start with hw
lordofwizard Mar 11, 2024
2570663
Simple change to remove target generated files from getting open
lordofwizard Mar 11, 2024
0af13c1
Added serde and serde_toml
lordofwizard Mar 11, 2024
77d2bc9
A simple config.toml change, and working flawlessly. need to customiz…
lordofwizard Apr 1, 2024
4ac0d32
basic impl of server config need to add items based on requirement
lordofwizard Apr 1, 2024
f311137
20 april sesion
lordofwizard Apr 20, 2024
35bfdc7
A basic template ready
lordofwizard Apr 21, 2024
95c2982
[WORKING] Parser done, of the configuration file.
lordofwizard May 21, 2024
df0d18b
[WORKING] Replaced the type_ notation to server_type for more improve…
lordofwizard May 21, 2024
9a08dea
Added function to download openjdk version, provided a u8 version as …
lordofwizard Jun 10, 2024
8238b73
Added function to download openjdk version, provided a u8 version as …
lordofwizard Jun 10, 2024
bda09d6
finally added a parser
lordofwizard Jun 11, 2024
6f06687
Added functionality to the run function which will also parse arguments
lordofwizard Jun 11, 2024
a817a2f
Added functionality to check if cwd has config.toml or not
lordofwizard Jun 12, 2024
7e2dbfd
appropriate name to server_present
lordofwizard Jun 12, 2024
733d8fb
appropriate name to server_present
lordofwizard Jun 12, 2024
dca8020
Stuff worked
lordofwizard Jun 12, 2024
6f7aa18
Added commands with their functionality
lordofwizard Jun 12, 2024
820ed9e
Added proper dividor functions to appropriate file pathing.
lordofwizard Jun 12, 2024
430ed21
Added many functionalities, working on the generator part now
lordofwizard Jun 12, 2024
a120e67
Utils changes weren't cached now they are
lordofwizard Jun 12, 2024
f06ea08
moved, project name gathering to it's own function
lordofwizard Jun 12, 2024
eae3502
Added functionality to automatically put the default config.toml in p…
lordofwizard Jun 12, 2024
b01b9c6
function added for download jdk from config
lordofwizard Jun 13, 2024
729f7f1
Added devcontainer
lordofwizard Jun 20, 2024
60fa7c3
moved generate
lordofwizard Jun 30, 2024
4df9d4e
idk some space ig
lordofwizard Jun 30, 2024
dc0bde8
function added to fetch the latest version.
lordofwizard Jun 30, 2024
325bb9c
removed warnings and unused main func
lordofwizard Jun 30, 2024
31aa839
Added function to grab latest java version and automatically set that…
lordofwizard Jun 30, 2024
4a286dd
Added function to download in cache folder of the file path. lmao
lordofwizard Jul 1, 2024
8ca0314
adding the usual project i make
lordofwizard Jul 1, 2024
2ca88fb
proper extractor added
lordofwizard Jul 1, 2024
d29ceb2
removed a unused import
lordofwizard Jul 1, 2024
b364c1f
another unused import removed
lordofwizard Jul 1, 2024
a89e61e
formattt
lordofwizard Jul 1, 2024
ba567e0
More make sense changes to the repository. Now shit is at it's places.
lordofwizard Jul 29, 2024
923a8a5
Did many changes, downloading of the minecraft works.
lordofwizard Jul 29, 2024
9432cf1
Color changes
lordofwizard Jul 29, 2024
fbc2539
Added proper extractor and files mover
lordofwizard Jul 29, 2024
c8d416b
Added python download file
lordofwizard Jul 29, 2024
9030f9d
Removed few warnings
lordofwizard Jul 29, 2024
30c1841
Merge pull request #78 from lordofwizard/new
lordofwizard Jul 30, 2024
de115b4
a simple todo list for me
lordofwizard Aug 21, 2024
458da15
new beginning
lordofwizard Oct 16, 2024
6142472
Added simple test suite
lordofwizard Oct 16, 2024
4045de3
Added simple test suite
lordofwizard Oct 16, 2024
c302469
check this
lordofwizard Oct 16, 2024
0d00cca
added automatic workflow without compile logs
lordofwizard Oct 16, 2024
a70a470
Removed build deps and added quite in tests
lordofwizard Oct 16, 2024
df527b1
Removed build deps and added quite in tests
lordofwizard Oct 16, 2024
afb205a
Merge pull request #79 from lordofwizard/feature-testing-setup-check
lordofwizard Oct 16, 2024
c5514c6
added run and it works
lordofwizard Oct 16, 2024
ddafa28
Added the run file
lordofwizard Oct 16, 2024
f6343a6
changed the workflow
lordofwizard Oct 16, 2024
8d81646
changed the workflow file, typo fixed
lordofwizard Oct 16, 2024
b0158e4
Merge branch 'develop' into feature-run-setup
lordofwizard Oct 16, 2024
742cb70
Merge pull request #80 from lordofwizard/feature-run-setup
lordofwizard Oct 16, 2024
ed7df99
changed the workflow file, typo fixed
lordofwizard Oct 16, 2024
18555f8
Added run.rs
lordofwizard Oct 16, 2024
2306926
Merge pull request #81 from lordofwizard/feature-args-parse
lordofwizard Oct 16, 2024
9455a3d
Removed the big build process overhead
lordofwizard Oct 16, 2024
96146f8
Added lock file back for future versioning
lordofwizard Oct 16, 2024
2114a9a
Added new files with their impls and a basic test that checks few thi…
lordofwizard Oct 16, 2024
2ae1a69
Merge pull request #82 from lordofwizard/feature-arg
lordofwizard Oct 16, 2024
ced7437
[improvement] changed the debug output if no subcommands found.
lordofwizard Oct 16, 2024
9e3c2bf
Added relavent subcommand files without any code inside them
lordofwizard Oct 16, 2024
22acdca
TODO items added
lordofwizard Oct 16, 2024
8c666d7
warning removed
lordofwizard Oct 16, 2024
7cf4dab
relavent help message changes
lordofwizard Oct 16, 2024
71c1dda
Merge pull request #83 from lordofwizard/feature-subcommands
lordofwizard Oct 16, 2024
b7d243b
[NEW] Formatted the code and added a function with tests called take_…
lordofwizard Oct 17, 2024
870f820
[NEW] Project name folder creation added.
lordofwizard Oct 17, 2024
29d4b39
[Format] Format Changes.
lordofwizard Oct 17, 2024
c9bcd8f
[NEW] Added function for building the file tree and tests
lordofwizard Oct 17, 2024
cb6c1d6
[FIX+NEW] Implemented the file system empty config.toml
lordofwizard Oct 17, 2024
75a53eb
[WARN] Removed unwanted warnings
lordofwizard Oct 17, 2024
c4e10d1
[FORMAT] Formated changes added
lordofwizard Oct 17, 2024
29f4bda
[ADD] added baseline config struct
lordofwizard Oct 17, 2024
fccc9a4
added configuration builder.
lordofwizard Oct 17, 2024
41416b9
[added tests] for the config.rs
lordofwizard Oct 17, 2024
8d8eec5
[FIX] fixed the test cases by using the /tmp env
lordofwizard Oct 17, 2024
bb787ba
[ADD] Added few more tests
lordofwizard Oct 17, 2024
2e9a7ab
[FORMAT] formatting changes
lordofwizard Oct 17, 2024
e772778
[ADD] Added functionality to get the latest jdk version
lordofwizard Oct 17, 2024
d809429
[FORMAT] Any format changes
lordofwizard Oct 17, 2024
4d2a6a2
proper tests
lordofwizard Oct 17, 2024
f2fdacf
[ADD] Added function to download latest version of vanilla mc
lordofwizard Oct 17, 2024
b31cdd0
[TEST ADD] Added a test that is aligned with latest version
lordofwizard Oct 17, 2024
9f31b5f
[ADD] Added baseline project file gen. Worked but tests writing is re…
lordofwizard Oct 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[NEW] Formatted the code and added a function with tests called take_…
…project_name
lordofwizard committed Oct 17, 2024
commit b7d243b357f46079215dc6cd0dae5b5ce05fd0e3
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
@@ -28,4 +28,4 @@ pub enum Commands {
Check,
/// Prints the connectable url of the Minecraft Server.
GetUrl,
}
}
2 changes: 1 addition & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn build() {
// TODO Build this
}
}
4 changes: 2 additions & 2 deletions src/check.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn check(){
pub fn check() {
// TODO Build this
}
}
2 changes: 1 addition & 1 deletion src/get_url.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn get_url() {
// TODO Build this
}
}
2 changes: 1 addition & 1 deletion src/log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn log() {
// TODO Build this
}
}
11 changes: 5 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
mod run;
mod args;
mod start;
mod build;
mod setup;
mod log;
mod check;
mod stop;
mod get_url;
mod log;
mod run;
mod setup;
mod start;
mod stop;
use run::Run;
fn main() {
println!("Hello, world!");
Run::new();
}

19 changes: 9 additions & 10 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pub struct Run;
use clap::Parser;
use crate::args::{MCServer,Commands};
use crate::args::{Commands, MCServer};
use crate::build::build;
use crate::check::check;
use crate::get_url::get_url;
use crate::log::log;
use crate::setup::setup;
use crate::start::start_server;
use crate::stop::stop;
use crate::log::log;
use crate::check::check;
use crate::get_url::get_url;
use clap::Parser;

impl Run {
pub fn new() {
@@ -20,14 +20,13 @@ impl Run {
Commands::Setup => setup(),
Commands::Build => build(),
Commands::Start => start_server(),
Commands::Log => log(),
Commands::Log => log(),
Commands::Check => check(),
Commands::Stop => stop(),
Commands::Stop => stop(),
Commands::GetUrl => get_url(),
#[allow(unreachable_patterns)]
_ => println!("No Implementation found for this command"),
}

}
}

@@ -37,9 +36,9 @@ mod tests {

#[test]
fn run_has_std_practices() {
// Commented this test cause while parsing it fails
// Commented this test cause while parsing it fails
// Waits for a user subcommand and takes directly
// To help
// To help

//Run::new();
assert!(true);
100 changes: 99 additions & 1 deletion src/setup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@
pub fn setup(){
use std::{
io::{self, Write},
panic,
};
pub fn setup() {
// TODO Build this
}

fn take_project_name() -> String {
print!("What do you wanna call the project? ");
io::stdout().flush().unwrap();

let mut project_name = String::new();
io::stdin()
.read_line(&mut project_name)
.expect("Failed to read input");

project_name_validator(&project_name)
}

fn project_name_validator(project_name: &str) -> String{

if project_name.contains(" ") {
panic!("Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")
}

if project_name.trim().is_empty() {
panic!("Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")
}

// Trim whitespace from the input
let project_name = project_name.trim();

// Check if the input meets the criteria
if !project_name.is_empty() && project_name.chars().all(|c| c.is_alphabetic() || c == '_') {
return project_name.to_string();
} else {
panic!("Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.");
}
}
#[cfg(test)]
mod tests {
use super::*;

// Valid Cases
#[test]
fn valid_project_name_with_alphabets() {
let result = project_name_validator("project");
assert_eq!(result, "project".to_string());
}

#[test]
fn valid_project_name_with_underscore() {
let result = project_name_validator("my_project");
assert_eq!(result, "my_project".to_string());
}

#[test]
fn valid_project_name_with_only_underscores() {
let result = project_name_validator("____");
assert_eq!(result, "____".to_string());
}


// Invalid Cases: Expected to Panic
#[test]
#[should_panic]
fn invalid_project_name_with_trailing_spaces() {
let result = project_name_validator(" myproject ");
}

#[test]
#[should_panic]
fn project_name_with_space_should_panic() {
project_name_validator("my project");
}

#[test]
#[should_panic(expected = "Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")]
fn project_name_with_numbers_should_panic() {
project_name_validator("project123");
}

#[test]
#[should_panic(expected = "Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")]
fn project_name_with_special_chars_should_panic() {
project_name_validator("project!@#");
}

#[test]
#[should_panic(expected = "Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")]
fn empty_project_name_should_panic() {
project_name_validator("");
}

#[test]
#[should_panic(expected = "Invalid project name. Please enter only alphabetic characters or underscores, no numbers or whitespace.")]
fn project_name_with_only_spaces_should_panic() {
project_name_validator(" ");
}
}
4 changes: 2 additions & 2 deletions src/start.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn start_server(){
pub fn start_server() {
// TODO Build this
}
}
2 changes: 1 addition & 1 deletion src/stop.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub fn stop() {
// TODO Build this
}
}