Fix init
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
pub module decl_test;
|
pub module decl_test;
|
||||||
|
pub module decl_test;
|
||||||
|
|
||||||
pub void test_let_basic()
|
pub void test_let_basic()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module expr_test;
|
pub module expr_test;
|
||||||
|
pub module expr_test;
|
||||||
|
|
||||||
pub void test_literals()
|
pub void test_literals()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pub module package;
|
||||||
pub module common;
|
pub module common;
|
||||||
|
|
||||||
pub void test_package() {}
|
pub void test_package() {}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module statement_test;
|
pub module statement_test;
|
||||||
|
pub module statement_test;
|
||||||
|
|
||||||
pub void test_var_decl()
|
pub void test_var_decl()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module types_test;
|
pub module types_test;
|
||||||
|
pub module types_test;
|
||||||
|
|
||||||
pub void test_integer_type() {
|
pub void test_integer_type() {
|
||||||
i32 x = 42;
|
i32 x = 42;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module attribute_test;
|
pub module attribute_test;
|
||||||
|
pub module attribute_test;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Debuggable
|
pub struct Debuggable
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module class_test;
|
pub module class_test;
|
||||||
|
pub module class_test;
|
||||||
|
|
||||||
pub class Animal
|
pub class Animal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module enum_test;
|
pub module enum_test;
|
||||||
|
pub module enum_test;
|
||||||
|
|
||||||
enum OptionInt
|
enum OptionInt
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module function_test;
|
pub module function_test;
|
||||||
|
pub module function_test;
|
||||||
|
|
||||||
void greet()
|
void greet()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module impl_test;
|
pub module impl_test;
|
||||||
|
pub module impl_test;
|
||||||
|
|
||||||
struct Vector2
|
struct Vector2
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module struct_test;
|
pub module struct_test;
|
||||||
|
pub module struct_test;
|
||||||
|
|
||||||
struct Point
|
struct Point
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
pub module trait_test;
|
pub module trait_test;
|
||||||
|
pub module trait_test;
|
||||||
|
|
||||||
trait Speak
|
trait Speak
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pub module main;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
println!("running common tests...");
|
println!("running common tests...");
|
||||||
|
|||||||
+7
-4
@@ -82,18 +82,21 @@ void print_usage()
|
|||||||
void init_project(Vec<String> mut args)
|
void init_project(Vec<String> mut args)
|
||||||
{
|
{
|
||||||
args.remove(0);
|
args.remove(0);
|
||||||
process::Command::new("cargo").args(args).stdout(process::Stdio::inherit()).stderr(process::Stdio::inherit()).stdin(process::Stdio::inherit()).spawn().expect("Failed to run cargo").wait().expect("Unable to wait");
|
let status = process::Command::new("cargo").args(args).stdout(process::Stdio::inherit()).stderr(process::Stdio::inherit()).stdin(process::Stdio::inherit()).spawn().expect("Failed to run cargo").wait().expect("Unable to wait");
|
||||||
|
if !status.success() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool is_lib = fs::metadata("src/lib.rs").is_ok();
|
bool is_lib = fs::metadata("src/lib.rs").is_ok();
|
||||||
if is_lib {
|
if is_lib {
|
||||||
fs::remove_file("src/lib.rs").expect("Failed to remove src/lib.rs");
|
fs::remove_file("src/lib.rs").expect("Failed to remove src/lib.rs");
|
||||||
fs::write("src/lib.mist", "fn test() {\n}").expect("Failed to create src/lib.mist");
|
fs::write("src/lib.mist", "void test() {\n}").expect("Failed to create src/lib.mist");
|
||||||
} else {
|
} else {
|
||||||
fs::remove_file("src/main.rs").expect("Failed to remove src/main.rs");
|
fs::remove_file("src/main.rs").expect("Failed to remove src/main.rs");
|
||||||
fs::write("src/main.mist", "fn main() {\n println!(\"Hello, World!\");\n}\n").expect("Failed to create src/main.mist");
|
fs::write("src/main.mist", "void main() {\n println!(\"Hello, World!\");\n}\n").expect("Failed to create src/main.mist");
|
||||||
}
|
}
|
||||||
inject_mist_target(is_lib);
|
inject_mist_target(is_lib);
|
||||||
add_mist_toml(is_lib);
|
add_mist_toml(is_lib);
|
||||||
println!("\n\x1b[34minfo\x1b[0m: Please open Cargo.toml and adjust `\x1b[35mname\x1b[0m = ` as needed, Thank you for using Mist!\n");
|
println!("Thank you for using Mist!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void inject_mist_target(bool is_lib)
|
void inject_mist_target(bool is_lib)
|
||||||
|
|||||||
Reference in New Issue
Block a user