Skip to content

Commit

Permalink
refactor: library (#116)
Browse files Browse the repository at this point in the history
- removed `SVM_DATA_DIR` in favor of `data_dir()` function
- renamed `current_version` to `get_global_version`
- renamed `use_version` to `set_global_version`
- renamed `SolcVmError` to `SvmError`
- renamed lib name `svm_lib` to `svm`
- added `version_binary` to calculate the solc executable path for a
version
- made `patch_for_nixos` private
- made `setup_data_dir` private
- made `hex_string::serialize` add hex prefix to match deserialized
version

Rest are non functional changes for performance or readability.
  • Loading branch information
DaniPopes authored Feb 7, 2024
1 parent 5d2142f commit efd7d70
Show file tree
Hide file tree
Showing 19 changed files with 540 additions and 415 deletions.
146 changes: 116 additions & 30 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ license = "MIT OR Apache-2.0"
readme = "./README.md"
repository = "https://github.com/alloy-rs/svm-rs"
homepage = "https://github.com/alloy-rs/svm-rs"

[workspace.dependencies]
svm = { package = "svm-rs", version = "0.3.5", path = "crates/svm-rs", default-features = false }

hex = { package = "const-hex", version = "1.10" }
semver = "1"
serde = "1"
serde_json = "1"
reqwest = { version = "0.11", default-features = false }
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[<img alt="docs.rs" src="https://img.shields.io/docsrs/svm-rs/latest?color=66c2a5&label=docs-rs&style=for-the-badge" height="20">](https://docs.rs/svm-rs/latest/svm_lib/)
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/roynalnaruto/svm-rs/ci.yml?branch=master&style=for-the-badge" height="20">](https://github.com/roynalnaruto/svm-rs/actions?query=branch%3Amaster)

### Install
## Install

From [crates.io](https://crates.io):

Expand All @@ -18,28 +18,21 @@ Or from the repository:
cargo install --locked --git https://github.com/alloy-rs/svm-rs/
```

### Usage

- List available versions

```sh
svm list
```

- Install a version
## Usage

```sh
svm install <version>
```
Solc version manager

- Use an installed version
Usage: svm <COMMAND>

```sh
svm use <version>
```
Commands:
help Print this message or the help of the given subcommand(s)
install Install Solc versions
list List all Solc versions
remove Remove a Solc version, or "all" to remove all versions
use Set a Solc version as the global default

- Remove an installed version

```sh
svm remove <version>
Options:
-h, --help Print help
-V, --version Print version
```
15 changes: 6 additions & 9 deletions crates/svm-builds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@ repository.workspace = true
homepage.workspace = true

[build-dependencies]
svm = { package = "svm-rs", path = "../svm-rs", version = "0.3.5", default-features = false, features = [
"blocking",
"rustls",
] }
svm = { workspace = true, default-features = false, features = ["blocking", "rustls"] }

build_const = "0.2"
hex = "0.4"
semver = { version = "1.0", features = ["serde"] }
serde_json = "1.0"
hex.workspace = true
semver = { workspace = true, features = ["serde"] }
serde_json.workspace = true

[dependencies]
build_const = "0.2"
hex = "0.4"
semver = { version = "1.0", features = ["serde"] }
hex.workspace = true
semver = { workspace = true, features = ["serde"] }

[features]
# helper feature to block network access
Expand Down
1 change: 1 addition & 0 deletions crates/svm-builds/README.md
2 changes: 1 addition & 1 deletion crates/svm-builds/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//! Contains all solc builds for the platform it was compiled with
//! Contains all Solc builds for the platform it was compiled with.
build_const::build_const!("builds");
Loading

0 comments on commit efd7d70

Please sign in to comment.