Skip to content

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJepsen committed Jul 26, 2023
1 parent 9c3ba5a commit c9944fa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ thiserror = "1.0.40"
tokio = { version = "1.28.1", features = ["macros", "full"] }
toml = "0.7.4"
chrono = "0.4"
log = "0.4.19"

# Revm and related dependencies
bytes = "1.4.0"
Expand Down
2 changes: 2 additions & 0 deletions bin/bind.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::process::Command;
use log::info;

pub(crate) fn bind_forge() -> std::io::Result<()> {
let output = Command::new("forge")
Expand All @@ -14,6 +15,7 @@ pub(crate) fn bind_forge() -> std::io::Result<()> {
if output.status.success() {
let output_str = String::from_utf8_lossy(&output.stdout);
println!("Command output: {}", output_str);
println!("Note: revert strings are on");
Ok(())
} else {
let err_str = String::from_utf8_lossy(&output.stderr);
Expand Down
19 changes: 18 additions & 1 deletion bin/init.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
fs::{self, File},
fs::{self, File, OpenOptions},
io::{Read, Write},
};
use toml::value::{Table, Value};
Expand Down Expand Up @@ -28,6 +28,9 @@ pub(crate) fn create_simulation(simulation_name: &str) -> std::io::Result<()> {
let sim_path = format!("src/simulations/{}", simulation_name);
fs::create_dir_all(sim_path)?;

// Add bidings to gitignore
add_to_gitignore("src/bindings")?;

// write the cargo toml
write_cargo_toml(simulation_name)?;

Expand Down Expand Up @@ -115,3 +118,17 @@ fn update_import_paths(file_path: &str) -> std::io::Result<()> {

Ok(())
}

fn add_to_gitignore(path: &str) -> std::io::Result<()> {
// Open the file in append mode (or create it if it doesn't exist yet)
let mut file = OpenOptions::new()
.write(true)
.append(true)
.create(true)
.open(".gitignore")?;

// Add a newline and the path to the end of the file
writeln!(file, "{}", path)?;

Ok(())
}

0 comments on commit c9944fa

Please # to comment.