Skip to content

Commit

Permalink
Merge pull request #35 from mario-eth/release/v0.2.7
Browse files Browse the repository at this point in the history
Added the dependency name as dependency key in the config
  • Loading branch information
mario-eth authored Mar 27, 2024
2 parents cbecec7 + f3b5f4a commit 051f70c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
name = "soldeer"
readme = "./README.md"
repository = "https://github.com/mario-eth/soldeer"
version = "0.2.6"
version = "0.2.7"

[dependencies]
chrono = {version = "0.4.34", features = ["serde"]}
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ This project was started to solve the following issues:
- npmjs was built for the js ecosystem not for solidity
- github versioning of the releases is a pain and not all the projects are using it correctly

## Version 0.2.6
## Version 0.2.7

#### Breaking Changes introduced in 0.2.6
#### Version 0.2.7 introduces the following changes:

Save the dependency key as the dependency name to respect the Cargo.toml format. For multiple versions for the same dependency an issue has been created to be added as a feature [#34](https://github.com/mario-eth/soldeer/issues/34). For now the dependency name is the key in the toml file.

### Breaking Changes introduced in 0.2.6

In 0.2.6 the `sdependencies` has been renamed to `dependencies`. Furthermore a dependency now stored in the toml respects Cargo toml format with `version` and `url` included.

Expand Down
12 changes: 3 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ pub fn read_config(filename: String) -> Result<Vec<Dependency>, ConfigError> {

let mut dependencies: Vec<Dependency> = Vec::new();
data.dependencies.iter().for_each(|(k, v)| {
let parts: Vec<&str> = k.split('~').collect::<Vec<&str>>();
dependencies.push(Dependency {
name: parts[0].to_string(),
name: k.to_string(),
version: v["version"].to_string().replace('"', ""),
url: v["url"].to_string().replace('\"', ""),
});
Expand Down Expand Up @@ -185,7 +184,7 @@ pub fn add_to_config(
let dir = get_current_working_dir()
.unwrap()
.join("dependencies")
.join(format!("{}-{}", dependency_name, dependency_version));
.join(dependency_name);
remove_dir_all(dir).unwrap();
match cleanup_dependency(dependency_name, dependency_version) {
Ok(_) => {}
Expand Down Expand Up @@ -257,15 +256,10 @@ pub fn add_to_config(
let mut new_item: Item = Item::None;
new_item["version"] = value(dependency_version);
new_item["url"] = value(dependency_url);
let dependency_name = format!(
"{}~{}",
dependency_name.to_string().as_str(),
dependency_version.to_string().as_str()
);
doc["dependencies"]
.as_table_mut()
.unwrap()
.insert(dependency_name.as_str(), new_item);
.insert(dependency_name.to_string().as_str(), new_item);
let mut file: std::fs::File = fs::OpenOptions::new()
.write(true)
.append(false)
Expand Down

0 comments on commit 051f70c

Please sign in to comment.