ruwebframe 0.1.1

A brief description of your crate.
Documentation
#![allow(non_snake_case)]
//use std::net::ToSocketAddrs;
use serde::Deserialize;
use spicex::{ConfigValue, Spice};
use yimi_rutool::core::StrUtil;
use ruwebframe::rubase::{BaseEntity, BaseEntitySingle};
use ruwebframe::rubase::rudto::cfgdto::softdto;
use ruwebframe::rucfg;
use ruwebframe::rucfg::{parsecfg};
use ruwebframe::rulog::{loginfo, rulog};

 
 

// 需要 Derive Debug 才能打印
#[derive(Debug, Deserialize, Clone)]
struct AppConfig {
    software: softdto::SoftDto,
}
#[test]
fn test_001_log() {
    let mut spice = Spice::new();
    spice
        .set_config_file("./config/ichub-dev.yml")
        .unwrap();
    //
    let env = spice.get_string("software.env").unwrap();
    // spice.read_in_config().unwrap();
    //
    // let config: AppConfig =(&mut spice).unmarshal().unwrap();
    // //rulog::info( env.unwrap().as_str());
    rulog::info(env.unwrap().as_str());
}

#[test]
fn test_002_log() {

        println!("cfg:\n{:#?}", rucfg::find_bean_ruconfig().unwrap().config);

        println!("{:#?}", rucfg::find_bean_ruconfig().unwrap().config.lock().unwrap().redis)


}

#[test]
fn test_003_log() {
    use redis::Commands;

    fn fetch_an_integer() -> redis::RedisResult<()> {
        // 1. 创建客户端并获取连接
        let client = redis::Client::open("redis://huawei.akunlong.top/")?;
        let mut con = client.get_connection()?;

        // 2. 执行 SET 和 GET 命令
        let _: () = con.set("my_key", 42)?;
        let result: isize = con.get("my_key")?;
        println!("从 Redis 读取的值: {}", result);
        rulog::info(result.to_string().as_str());

        Ok(())
    }
    fetch_an_integer().unwrap();
}

#[test]
fn test_004_log() {
    let s = loginfo::LogInfo::new_msg("1111");
    //s.extend("222222");
    rulog::info(s.to_string_lossy().as_str());
}

#[test]
fn test_005_parse_env2file() {
    let s = parsecfg::parse_env2file();
    rulog::info(s.as_str())
}

#[test]
fn test_006_parse_cfg2file() {
    let fileName = parsecfg::parse_env2file();
    let ret = parsecfg::parse_cfg2file(fileName);
    rulog::info(ret.as_str())
}


#[test]
fn test_007_parse_cfg2file() {
    let v = String::from("${SOFTWARE_ENV:test}");

    for part in v.splitn(1, ':') {
        let w= v.replace(part, "").replace("}","");
        rulog::info(w.to_string().as_str());
        return;
    }
    rulog::info(v.to_string().as_str());
}
#[test]
fn test_008_parse_cfg2file() {
    let v = String::from("${SOFTWARE_ENV:test}");
    let words=StrUtil::split(v.as_str(),":");
    if words.len()>1 {
        for part in words {
            let mut vv=part;
            vv.push_str(":");
            let w = v.replace(vv.as_str(), "").replace("}", "");
            rulog::info(w.to_string().as_str());
            return;
        }
    }
    rulog::info(v.to_string().as_str());
}
#[test]
fn test_009_parse_cfg2file() {
    let v = String::from("${SOFTWARE_ENV:test}");
    let w= parsecfg::parse_env_var(v);
    rulog::info(w.to_string().as_str());
}
#[test]
fn test_010_parse_cfg2file() {
    let fileName = parsecfg::parse_env2file();
    let ret = parsecfg::parse_cfg2file(fileName);
    rulog::info(ret.as_str())
}
 
#[test]
fn test_012_log() {
    let mut spice = Spice::new();
    spice
        .set_config_file("./Cargo.toml")
        .unwrap();
    //
    let env = spice.get_string("package.name").unwrap();

    rulog::info(env.unwrap().as_str());
}

#[test]
fn test_013_log(){
    use std::fs;

    let dirs=fs::read_dir(".");             // 读取目录

    rulog::info("1");
    //rustlog::info(dirs.unwrap().all())
}
#[test]
fn test_014_log(){
    rulog::info("2");
    let cfg = rucfg::find_bean_ruconfig().unwrap().read();
    rulog::info2( "cfg:", cfg.to_json().as_str());
}