Skip to content

Commit

Permalink
Fixes #66 and #50
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-eth committed Jun 25, 2024
1 parent 92c940c commit cb6cf06
Show file tree
Hide file tree
Showing 6 changed files with 402 additions and 88 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SolDeer ![Rust][rust-badge] [![License: MIT][license-badge]][license]
# Soldeer ![Rust][rust-badge] [![License: MIT][license-badge]][license]

[rust-badge]: https://img.shields.io/badge/Built%20with%20-Rust-e43716.svg
[license]: https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -123,6 +123,12 @@ soldeer install <dependency_name>~<version> <url>

This command will download the zip file of the dependency, unzip it, install it in the `dependencies` directory.

```bash
soldeer install
```

This command will install all the dependencies from the `soldeer.toml`/`foundry.toml` file.

### How to push a new dependency to the repository

In order to push a new dependency to the repository you have create an account on [https://soldeer.xyz](https://soldeer.xyz), create a project that it will match the dependency name.
Expand Down
4 changes: 2 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub enum Subcommands {
override_usage = "soldeer install <DEPENDENCY>~<VERSION> [URL]"
)]
pub struct Install {
#[clap(required = true)]
pub dependency: String,
#[clap(required = false)]
pub dependency: Option<String>,
#[clap(required = false)]
pub remote_url: Option<String>,
}
Expand Down
15 changes: 13 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ use std::fs::{
self,
File,
};
use std::io;
use std::io::Write;
use std::path::Path;
use std::{
env,
io,
};
use toml::Table;
use toml_edit::{
value,
Expand Down Expand Up @@ -111,7 +114,15 @@ pub async fn read_config(filename: String) -> Result<Vec<Dependency>, ConfigErro
}

pub fn define_config_file() -> Result<String, ConfigError> {
let mut filename: String = String::from(FOUNDRY_CONFIG_FILE.to_str().unwrap());
let mut filename: String;
if cfg!(test) {
filename =
env::var("config_file").unwrap_or(String::from(FOUNDRY_CONFIG_FILE.to_str().unwrap()))
} else {
filename = String::from(FOUNDRY_CONFIG_FILE.to_str().unwrap());
};

println!("confiog file {}", filename);

// check if the foundry.toml has the dependencies defined, if so then we setup the foundry.toml as the config file
if fs::metadata(&filename).is_ok() {
Expand Down
Loading

0 comments on commit cb6cf06

Please sign in to comment.