feat: read local dockerbuild.json first

This commit is contained in:
2020-11-22 00:11:26 +08:00
parent 47fb8fef66
commit 3d7cbb0d65
6 changed files with 7 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -77,7 +77,7 @@ dependencies = [
[[package]]
name = "dockerbuild"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"rust_util",
"serde",

View File

@@ -1,6 +1,6 @@
[package]
name = "dockerbuild"
version = "0.1.2"
version = "0.1.3"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
license = "MIT"

View File

@@ -12,6 +12,7 @@ $ cargo install --git https://git.hatter.ink/hatter/dockerbuild.git
```
Config file:
* `dockerbuild.json`
* `~/.dockerbuild.json`
* `/etc/dockerbuild.json`

View File

@@ -33,7 +33,7 @@ pub fn load_docker_build_config() -> Option<DockerBuildConfig> {
fn find_docker_build_config_file() -> Option<PathBuf> {
util_file::read_config(None, &vec![
// "dockerbuild.json".into(),
"dockerbuild.json".into(),
"~/.dockerbuild.json".into(),
"/etc/dockerbuild.json".into(),
])

View File

@@ -1,7 +1,6 @@
use std::fs;
use std::process::Command;
use rust_util::XResult;
use rust_util::util_cmd;
use rust_util::{XResult, util_cmd};
use crate::build_util;
use crate::build_util::Builder;
@@ -22,6 +21,7 @@ pub struct DockerCmd {
mirror: Option<String>,
}
#[allow(dead_code)]
impl DockerCmd {
pub fn new(docker_name: &str) -> Self {
success!("Docker image: {}", docker_name);

View File

@@ -9,7 +9,7 @@ use std::fs;
use std::env;
use std::path::{Path, PathBuf};
use rust_util::util_file;
pub use docker_util::DockerCmd;
use docker_util::DockerCmd;
fn main() {
information!("{} v{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));