Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polkadot-sdk-docs: Use command_macro! #6624

Merged
merged 40 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5cde862
First try
ndkazu Nov 23, 2024
0220768
Update generate_chain_spec_builder_path()
ndkazu Nov 24, 2024
683c7ab
using cmd_lib
ndkazu Nov 26, 2024
ce8e506
using cmd_lib
ndkazu Nov 26, 2024
2432a09
Tracking output
ndkazu Nov 26, 2024
b2e4e18
Merge branch 'master' into commandMacro
ndkazu Nov 26, 2024
39709b7
Applied suggested corrections
ndkazu Nov 26, 2024
6702a0d
correction
ndkazu Nov 26, 2024
888e375
Merge branch 'master' into commandMacro
ndkazu Nov 26, 2024
aefaf7f
removed process::Command from chain_spec_builder_tests.rs
ndkazu Nov 27, 2024
b204240
Removed unused import
ndkazu Nov 27, 2024
5138c27
Added newm macro
ndkazu Nov 28, 2024
af8c282
prdoc
ndkazu Nov 28, 2024
fe6deeb
Merge branch 'master' into commandMacro
ndkazu Nov 28, 2024
b90d36f
prdoc crates
ndkazu Nov 28, 2024
b29fce3
prdoc crates
ndkazu Nov 28, 2024
7ffc46b
prdoc crates
ndkazu Nov 28, 2024
848e69e
Fix wrong variable name
ndkazu Nov 28, 2024
78979ce
cargo fmt
ndkazu Nov 28, 2024
a96f5f8
Re-factored code according to review/comment
ndkazu Nov 28, 2024
d19ef82
cargo fmt
ndkazu Nov 28, 2024
b5deedb
Merge branch 'master' into commandMacro
ndkazu Nov 28, 2024
c0cff49
Update chain_spec_genesis
ndkazu Nov 28, 2024
a198802
Remove unneeded mut
ndkazu Nov 28, 2024
5dec756
Merge branch 'master' into commandMacro
ndkazu Nov 28, 2024
968a976
Code refactoring based on latest reviews
ndkazu Nov 28, 2024
2010b5f
Merge branch 'master' into commandMacro
ndkazu Nov 28, 2024
45f13bd
use #[docify::export_content]
ndkazu Nov 28, 2024
e641369
Merge branch 'master' into commandMacro
ndkazu Nov 29, 2024
5322d97
Merge branch 'master' into commandMacro
ndkazu Nov 29, 2024
d37c68e
Prdoc & variable name correction
ndkazu Nov 29, 2024
7bf9544
Merge branch 'master' into commandMacro
ndkazu Nov 29, 2024
18f87be
variable name
ndkazu Nov 29, 2024
262529c
Merge branch 'master' into commandMacro
ndkazu Nov 29, 2024
68ed1b6
Merge branch 'master' into commandMacro
ndkazu Nov 30, 2024
7f1a4eb
Merge branch 'master' into commandMacro
ndkazu Dec 2, 2024
9a6c956
Merge branch 'master' into commandMacro
iulianbarbu Dec 4, 2024
ee088d4
removed quotes
ndkazu Dec 7, 2024
3fc927c
Merge branch 'commandMacro' of github.com:ndkazu/polkadot-sdk into co…
ndkazu Dec 7, 2024
4ce23e2
Merge branch 'master' into commandMacro
ndkazu Dec 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions docs/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@ first-pallet = { workspace = true, default-features = true }

[dev-dependencies]
assert_cmd = "2.0.14"
cmd_lib = { workspace = true }
rand = "0.8"
24 changes: 9 additions & 15 deletions docs/sdk/src/guides/your_first_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
#[cfg(test)]
mod tests {
use assert_cmd::Command;
use cmd_lib::*;
use rand::Rng;
use sc_chain_spec::{DEV_RUNTIME_PRESET, LOCAL_TESTNET_RUNTIME_PRESET};
use sp_genesis_builder::PresetId;
Expand Down Expand Up @@ -173,13 +174,10 @@ mod tests {
println!("Building polkadot-sdk-docs-first-runtime...");
#[docify::export_content]
fn build_runtime() {
Command::new("cargo")
.arg("build")
.arg("--release")
.arg("-p")
.arg(FIRST_RUNTIME)
.assert()
.success();
run_cmd!(
cargo build --release -p $FIRST_RUNTIME
)
.expect("Failed to run command");
}
build_runtime()
}
Expand Down Expand Up @@ -274,14 +272,10 @@ mod tests {
let chain_spec_builder = find_release_binary(&CHAIN_SPEC_BUILDER).unwrap();
let runtime_path = find_wasm(PARA_RUNTIME).unwrap();
let output = "/tmp/demo-chain-spec.json";
Command::new(chain_spec_builder)
.args(["-c", output])
.arg("create")
.args(["--para-id", "1000", "--relay-chain", "dontcare"])
.args(["-r", runtime_path.to_str().unwrap()])
.args(["named-preset", "development"])
.assert()
.success();
let runtime_str = runtime_path.to_str().unwrap();
run_cmd!(
$chain_spec_builder -c $output create --para-id 1000 --relay-chain dontcare -r $runtime_str named-preset development
).expect("Failed to run command");
std::fs::remove_file(output).unwrap();
}
build_para_chain_spec_works();
Expand Down
8 changes: 4 additions & 4 deletions docs/sdk/src/reference_docs/chain_spec_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@
//! ```
//! Here are some examples in the form of rust tests:
//! ## Listing available preset names:
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", list_presets)]
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", cmd_list_presets)]
//! ## Displaying preset with given name
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", get_preset)]
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", cmd_get_preset)]
//! ## Building a solo chain-spec (the default) using given preset
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", generate_chain_spec)]
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", cmd_generate_chain_spec)]
//! ## Building a parachain chain-spec using given preset
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", generate_para_chain_spec)]
#![doc = docify::embed!("./src/reference_docs/chain_spec_runtime/tests/chain_spec_builder_tests.rs", cmd_generate_para_chain_spec)]
//!
//! [`RuntimeGenesisConfig`]:
//! chain_spec_guide_runtime::runtime::RuntimeGenesisConfig
Expand Down
1 change: 1 addition & 0 deletions docs/sdk/src/reference_docs/chain_spec_runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ substrate-wasm-builder = { optional = true, workspace = true, default-features =

[dev-dependencies]
chain-spec-builder = { workspace = true, default-features = true }
cmd_lib = { workspace = true }
sc-chain-spec = { workspace = true, default-features = true }

[features]
Expand Down
Loading
Loading