Skip to content

Commit

Permalink
chore: deprecate deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
blckngm committed Dec 22, 2023
1 parent 366e6ee commit 7e8f907
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 38 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ The following must be installed and available to use Capsule.
$ cargo install cross --git https://github.com/cross-rs/cross
```

- ckb-cli (optional) - Capsule requires `ckb-cli` to enable the smart contract deployment feature. https://github.com/nervosnetwork/ckb-cli/releases

Note: All commands must be accessible in the `PATH` in order for them to be used by Capsule.

Note: The current user must have permission to manage Docker instances. [How to manage Docker as a non-root user.](https://docs.docker.com/engine/install/linux-postinstall/)
Expand Down Expand Up @@ -88,7 +86,6 @@ capsule test
### Project Layout

* `capsule.toml` - Capsule manifest file.
* `deployment.toml` - Deployment configuration.
* `contracts` - Contracts directory.
* `tests` - Contracts tests.
* `build` - Contracts binaries.
Expand Down
2 changes: 0 additions & 2 deletions crates/tests/test-contract/capsule.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

# capsule version
version = "0.10.0"
# path of deployment config file
deployment = "deployment.toml"

[[contracts]]
name = "test-contract"
Expand Down
4 changes: 3 additions & 1 deletion src/bin/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn run_cli() -> Result<()> {
).display_order(5))
.subcommand(
SubCommand::with_name("deploy")
.about("Deploy contracts, edit deployment.toml to custodian deployment recipe.")
.about("[DEPRECATED] Deploy contracts, edit deployment.toml to custodian deployment recipe.")
.args(&[
Arg::with_name("address").long("address").help(
"Denote which address provides cells",
Expand Down Expand Up @@ -374,6 +374,8 @@ fn run_cli() -> Result<()> {
Tester::run(&context, build_env, test_name)?;
}
("deploy", Some(args)) => {
eprintln!("Warning: capsule deploy is deprecated in favor of ckb-cli deploy");

let ckb_cli_bin = args.value_of("ckb-cli").expect("ckb-cli");
Checker::build(ckb_cli_bin).check_ckb_cli()?;
let address = {
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct Config {
pub version: String,
#[serde(default)]
pub contracts: Vec<Contract>,
pub deployment: PathBuf, // path of deployment config file
pub deployment: Option<PathBuf>, // path of deployment config file
#[serde(default)]
pub rust: RustConfig,
}
Expand Down
1 change: 0 additions & 1 deletion src/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fn gen_project_layout<P: AsRef<Path>>(name: String, project_path: P) -> Result<(
})?;
for (f, template_name) in &[
("capsule.toml", None),
("deployment.toml", None),
("README.md", None),
("rust-toolchain", None),
("Cross.toml", None),
Expand Down
7 changes: 6 additions & 1 deletion src/project_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ impl Context {

pub fn load_deployment(&self) -> Result<Deployment> {
let mut path = self.project_path.clone();
path.push(&self.config.deployment);
path.push(
self.config
.deployment
.as_deref()
.unwrap_or_else(|| Path::new("deployment.toml")),
);
match toml_edit::de::from_str(&fs::read_to_string(&path)?) {
Ok(deployment) => Ok(deployment),
Err(err) => {
Expand Down
2 changes: 0 additions & 2 deletions templates/capsule.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@

# capsule version
version = "{{ version }}"
# path of deployment config file
deployment = "deployment.toml"
27 changes: 0 additions & 27 deletions templates/deployment.toml

This file was deleted.

0 comments on commit 7e8f907

Please sign in to comment.