Skip to content

Commit d698b97

Browse files
committed
obm born.
1 parent c559ef1 commit d698b97

File tree

18 files changed

+856
-2
lines changed

18 files changed

+856
-2
lines changed

Cargo.lock

Lines changed: 426 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "obm"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
structopt = "0.3.21"
10+
thiserror = "1.0.34"
11+
handlebars = "4.3.4"

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
1-
# docker-opencurve
2-
Docker tooling for opencurve
1+
OBM - OpenCurve Project Build Manager
2+
---
3+
### `THE PROJECT NOT READY YET!`
4+
5+
Usage
6+
---
7+
8+
curve
9+
===
10+
11+
```
12+
$ git clone https://github.com/opencurve/curve
13+
$ cd curve
14+
$ obm build
15+
```
16+
17+
curveadm
18+
===
19+
20+
```
21+
$ git clone https://github.com/opencurve/curveadm
22+
$ cd curveadm
23+
$ obm build
24+
```
25+
26+
polarfs
27+
===
28+
29+
30+
```
31+
$ git clone https://github.com/opencurve/PolarDB-FileSystem
32+
$ cd PolarDB-FileSystem
33+
$ obm build
34+
```

docker/curve/1.2/centos7/Dockerfile

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Dockerfile - Debian 10 Buster - DEB version
2+
3+
FROM golang:1.19-buster
4+
5+
LABEL maintainer="Wine93 <[email protected]>"
6+
7+
RUN DEBIAN_FRONTEND=noninteractive apt-get clean \
8+
&& DEBIAN_FRONTEND=noninteractive apt-get update \
9+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
10+
musl \
11+
musl-dev \
12+
musl-tools \
13+
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove -y
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: build
2+
3+
build:
4+
docker build --tag opencurvedocker/curveadm-build:latest-buster $(PWD)

src/app.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (C) 2022 Jingli Chen (Wine93), NetEase Inc.
2+
3+
pub(crate) struct OBM {
4+
pub n: f64,
5+
}
6+
7+
impl OBM {
8+
pub(crate) fn new() -> Self {
9+
Self { n: 123.123 }
10+
}
11+
}

src/cli.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright (C) 2022 Jingli Chen (Wine93), NetEase Inc.
2+
3+
use structopt::{clap::AppSettings, StructOpt};
4+
use crate::app::OBM;
5+
use crate::error::Result;
6+
use crate::command::list::{ListCmd, ListOptions};
7+
use crate::command::run::{RunCmd, RunOptions};
8+
use crate::command::enter::{EnterCmd, EnterOptions};
9+
use crate::command::remove::{RemoveCmd, RemoveOptions};
10+
11+
#[derive(Debug, StructOpt)]
12+
#[structopt(
13+
name = "obm",
14+
about = "OpenCurve Project Build Manager",
15+
setting(AppSettings::ColoredHelp),
16+
setting(AppSettings::NextLineHelp),
17+
setting(AppSettings::UnifiedHelpMessage)
18+
)]
19+
pub(crate) enum Command {
20+
#[structopt(name = "run")]
21+
RunOptions(RunOptions),
22+
23+
#[structopt(name = "ls")]
24+
ListOptions(ListOptions),
25+
26+
#[structopt(name = "cd")]
27+
EnterOptions(EnterOptions),
28+
29+
#[structopt(name = "rm")]
30+
RemoveOptions(RemoveOptions),
31+
}
32+
33+
pub(crate) struct Cli {
34+
obm: OBM,
35+
}
36+
37+
impl Cli {
38+
pub fn new(obm: OBM) -> Self {
39+
Self{ obm }
40+
}
41+
42+
pub fn execute(self) -> Result<()> {
43+
let args = Command::from_args();
44+
45+
match args {
46+
Command::RunOptions(options) => {
47+
RunCmd::new(self.obm, options).run()
48+
},
49+
Command::ListOptions(options) => {
50+
ListCmd::new(self.obm, options).run()
51+
},
52+
Command::EnterOptions(options) => {
53+
EnterCmd::new(self.obm, options).run()
54+
},
55+
Command::RemoveOptions(options) => {
56+
RemoveCmd::new(self.obm, options).run()
57+
},
58+
_ => Ok(()),
59+
}
60+
}
61+
}

src/command/enter.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (C) 2022 Jingli Chen (Wine93), NetEase Inc.
2+
3+
use structopt::{clap::AppSettings, StructOpt};
4+
use crate::app::OBM;
5+
use crate::error::{Error, Result};
6+
7+
#[derive(Debug, StructOpt)]
8+
#[structopt(
9+
name = "enter",
10+
about = "Enter build container",
11+
setting(AppSettings::ColoredHelp),
12+
setting(AppSettings::NextLineHelp),
13+
setting(AppSettings::UnifiedHelpMessage)
14+
)]
15+
pub(crate) struct EnterOptions {
16+
/// Specify build container
17+
pub name: String,
18+
}
19+
20+
pub(crate) struct EnterCmd {
21+
obm: OBM,
22+
options: EnterOptions,
23+
}
24+
25+
impl EnterCmd {
26+
pub(crate) fn new(obm: OBM, options: EnterOptions) -> Self {
27+
Self{
28+
obm,
29+
options,
30+
}
31+
}
32+
33+
pub(crate) fn run(self) -> Result<()> {
34+
Ok(())
35+
}
36+
}

src/command/list.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (C) 2022 Jingli Chen (Wine93), NetEase Inc.
2+
3+
use structopt::{clap::AppSettings, StructOpt};
4+
use handlebars::Handlebars;
5+
use crate::app::OBM;
6+
use crate::error::Result;
7+
8+
#[derive(Debug, StructOpt)]
9+
#[structopt(
10+
name = "list",
11+
about = "List build containers",
12+
setting(AppSettings::ColoredHelp),
13+
setting(AppSettings::NextLineHelp),
14+
setting(AppSettings::UnifiedHelpMessage)
15+
)]
16+
pub(crate) struct ListOptions {
17+
#[structopt(short = "v", long = "verbose")]
18+
/// Verbose output for list
19+
pub verbose: bool,
20+
}
21+
22+
pub(crate) struct ListCmd {
23+
obm: OBM,
24+
options: ListOptions,
25+
}
26+
27+
impl ListCmd {
28+
pub(crate) fn new(obm: OBM, options: ListOptions) -> Self {
29+
Self{
30+
obm,
31+
options,
32+
}
33+
}
34+
35+
pub(crate) fn run(self) -> Result<()> {
36+
Ok(())
37+
}
38+
}
39+

0 commit comments

Comments
 (0)