-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This PR implements the previously agreed-upon command: ``` dfx sns deploy ``` The implementation covers only the core use case and does not cover enhancements such as specifying the location of the config file. # Changes - Implemented `dfx sns deploy` - Fixed doc lints; requiring documentation was not previously enforced so there were quite a few functions with missing documentation. I have filled them in, somewhat minimally but hopefully sufficiently to be useful.
- Loading branch information
Showing
21 changed files
with
194 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//! Code for the command line `dfx sns deploy`. | ||
use crate::lib::error::DfxResult; | ||
use crate::Environment; | ||
|
||
use crate::lib::sns; | ||
use crate::lib::sns::deploy::deploy_sns; | ||
use clap::Parser; | ||
|
||
/// Creates an SNS on a network. | ||
/// | ||
/// # Arguments | ||
/// - `env` - The execution environment, including the network to deploy to and connection credentials. | ||
/// - `opts` - Deployment options. | ||
#[derive(Parser)] | ||
pub struct DeployOpts {} | ||
|
||
/// Executes the command line `dfx sns deploy`. | ||
pub fn exec(env: &dyn Environment, _opts: DeployOpts) -> DfxResult { | ||
let config = env.get_config_or_anyhow()?; | ||
let path = config.get_project_root().join(sns::CONFIG_FILE_NAME); | ||
|
||
deploy_sns(env, &path)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
//! Code for managing the network nervous system. | ||
#![warn(clippy::missing_docs_in_private_items)] | ||
pub mod install_nns; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! Code for creating an SNS. | ||
use fn_error_context::context; | ||
use std::ffi::OsString; | ||
use std::path::Path; | ||
|
||
use crate::lib::error::DfxResult; | ||
use crate::lib::sns::sns_cli::call_sns_cli; | ||
use crate::Environment; | ||
|
||
/// Creates an SNS. This requires funds but no proposal. | ||
#[context("Failed to deploy SNS with config: {}", path.display())] | ||
pub fn deploy_sns(env: &dyn Environment, path: &Path) -> DfxResult<String> { | ||
let args = vec![ | ||
OsString::from("deploy"), | ||
OsString::from("--init-config-file"), | ||
OsString::from(path), | ||
]; | ||
call_sns_cli(env, &args).map(|stdout| format!("Deployed SNS: {}\n{}", path.display(), stdout)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
//! Code for decentralizing dapps | ||
#![warn(clippy::missing_docs_in_private_items)] | ||
pub mod create_config; | ||
pub mod deploy; | ||
pub mod sns_cli; | ||
pub mod validate_config; | ||
|
||
/// The default location of an SNS configuration file. | ||
pub const CONFIG_FILE_NAME: &str = "sns.yml"; |
Oops, something went wrong.