Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

hc: Update to 2018 edition #2011

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ homepage = "https://github.com/holochain/holochain-rust"
documentation = "https://github.com/holochain/holochain-rust"
version = "0.0.42-alpha5"
authors = ["Holochain Core Dev Team <[email protected]>"]
edition = "2018"

[dependencies]
holochain_core_types = { version = "=0.0.42-alpha5", path = "../core_types" }
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/cli/chain_log.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::error::DefaultResult;
use colored::*;
use failure::format_err;
use holochain_core::{
agent::{
chain_store::ChainStore,
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/cli/generate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::error::DefaultResult;
use failure::format_err;
use flate2::read::GzDecoder;
use glob::glob;
use std::{
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/cli/hash_dna.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use error::DefaultResult;
use crate::error::DefaultResult;
use failure::err_msg;
use holochain_conductor_lib::conductor::Conductor;
use holochain_persistence_api::cas::content::{Address, AddressableContent};
Expand Down
5 changes: 3 additions & 2 deletions crates/cli/src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
util::DIST_DIR_NAME,
};
use colored::*;
use failure::bail;
use serde_json;
use std::{
collections::HashMap,
Expand Down Expand Up @@ -138,9 +139,9 @@ pub fn init(path: &PathBuf) -> DefaultResult<()> {

#[cfg(test)]
pub mod tests {
use super::*;
extern crate tempfile;
use self::tempfile::{Builder, TempDir};
use super::*;
use tempfile;

const HOLOCHAIN_TEST_PREFIX: &str = "org_holochain_test";

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/cli/keygen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use error::DefaultResult;
use crate::error::DefaultResult;
use holochain_common::paths::keys_directory;
use holochain_conductor_lib::{key_loaders::mock_passphrase_manager, keystore::Keystore};
use rpassword;
Expand Down
3 changes: 2 additions & 1 deletion crates/cli/src/cli/package.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use crate::{config_files::Build, error::DefaultResult, util};
use base64;
use colored::*;
use failure::format_err;
use holochain_core::nucleus::ribosome::{run_dna, WasmCallData};
use holochain_core_types::dna::Dna;
use holochain_json_api::json::JsonString;
use holochain_persistence_api::cas::content::AddressableContent;
use ignore::WalkBuilder;
use json_patch::merge;
use serde_json::{self, Map, Value};
use serde_json::{self, json, Map, Value};
use std::{
convert::TryFrom,
fs::{self, File},
Expand Down
8 changes: 4 additions & 4 deletions crates/cli/src/cli/run.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::NetworkingType;
use cli;
use crate::{cli, error::DefaultResult, NetworkingType};
use colored::*;
use error::DefaultResult;
use failure::format_err;
use holochain_common::env_vars::EnvVar;
use holochain_conductor_lib::{
conductor::{mount_conductor_from_config, Conductor, CONDUCTOR},
Expand All @@ -14,6 +13,7 @@ use holochain_conductor_lib::{
use holochain_core_types::agent::AgentId;
use holochain_net::sim2h_worker::Sim2hConfig;
use holochain_persistence_api::cas::content::AddressableContent;
use serde_json::json;
use std::{fs, path::PathBuf};

pub enum Networking {
Expand Down Expand Up @@ -284,7 +284,7 @@ impl Networking {

#[cfg(test)]
mod tests {
extern crate tempfile;
use tempfile;
// use crate::cli::init::{init, tests::gen_dir};
// use assert_cmd::prelude::*;
// use std::{env, process::Command, path::PathBuf};
Expand Down
3 changes: 2 additions & 1 deletion crates/cli/src/cli/test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{cli::package, error::DefaultResult, util};
use colored::*;
use failure::Error;
use failure::{ensure, Error};
use serde_json::json;
use std::{
io::ErrorKind,
path::PathBuf,
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/config_files/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::config_files::Dht;
use semver::Version;
use serde_derive::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Serialize, Deserialize, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions crates/cli/src/config_files/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::{error::DefaultResult, util};
use base64;
use failure::bail;
use serde_derive::{Deserialize, Serialize};
use serde_json;
use std::{
fs::File,
Expand Down
2 changes: 2 additions & 0 deletions crates/cli/src/config_files/dht.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
use serde_derive::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone)]
pub struct Dht {}
2 changes: 1 addition & 1 deletion crates/cli/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use failure::Error;
use failure::{format_err, Error, Fail};

#[derive(Debug, Fail)]
pub enum HolochainError {
Expand Down
48 changes: 8 additions & 40 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,17 @@
#![warn(unused_extern_crates)]
extern crate holochain_common;
extern crate holochain_conductor_lib;
extern crate holochain_core;
extern crate holochain_core_types;
extern crate holochain_json_api;
extern crate holochain_locksmith;
extern crate holochain_net;
extern crate holochain_persistence_api;
extern crate holochain_persistence_file;
extern crate json_patch;
extern crate lib3h_crypto_api;
extern crate lib3h_protocol;
extern crate lib3h_sodium;
extern crate sim2h;
extern crate structopt;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate serde_derive;
extern crate base64;
extern crate colored;
extern crate semver;
#[macro_use]
extern crate serde_json;
extern crate dns_lookup;
extern crate flate2;
extern crate glob;
extern crate ignore;
extern crate in_stream;
extern crate rpassword;
extern crate tar;
extern crate tempfile;
extern crate tera;
extern crate url2;
use crate::error::{HolochainError, HolochainResult};
use failure::format_err;
use holochain_common;
use holochain_conductor_lib::happ_bundle::HappBundle;
use lib3h_sodium;
use serde_json::json;
use std::{fs::File, io::Read, path::PathBuf, str::FromStr};
use structopt::{clap::arg_enum, StructOpt};

mod cli;
mod config_files;
mod error;
mod util;

use crate::error::{HolochainError, HolochainResult};
use holochain_conductor_lib::happ_bundle::HappBundle;
use std::{fs::File, io::Read, path::PathBuf, str::FromStr};
use structopt::{clap::arg_enum, StructOpt};

#[derive(StructOpt)]
/// A command line for Holochain
enum Cli {
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::error::DefaultResult;
use colored::*;
use failure::{ensure, format_err};
pub use holochain_common::paths::DNA_EXTENSION;
use std::{
fs,
Expand Down