Skip to content

Commit 6ef82fc

Browse files
committed
Rename package to 'jab' because conflicting crate package name
1 parent 80e7b0f commit 6ef82fc

File tree

8 files changed

+76
-76
lines changed

8 files changed

+76
-76
lines changed

.github/workflows/build_artifacts.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
include:
2121
- os: macos-latest
2222
target: x86_64-apple-darwin
23-
release_bin_name: cid.macos
23+
release_bin_name: jab.macos
2424
- os: ubuntu-latest
2525
target: x86_64-unknown-linux-gnu
26-
release_bin_name: cid.linux
26+
release_bin_name: jab.linux
2727
steps:
2828
- uses: actions/checkout@v2
2929

@@ -40,12 +40,12 @@ jobs:
4040

4141
- name: Zip build result
4242
run: |
43-
zip --junk-paths ./target/${{ matrix.target }}/release/cid-${{ matrix.target }}.zip ./target/${{ matrix.target }}/release/cid
43+
zip --junk-paths ./target/${{ matrix.target }}/release/jab-${{ matrix.target }}.zip ./target/${{ matrix.target }}/release/jab
4444
4545
- name: Create Release
4646
uses: softprops/action-gh-release@v1
4747
with:
48-
files: ./target/${{ matrix.target }}/release/cid-${{ matrix.target }}.zip
48+
files: ./target/${{ matrix.target }}/release/jab-${{ matrix.target }}.zip
4949
env:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151

@@ -55,7 +55,7 @@ jobs:
5555
# env:
5656
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5757
# with:
58-
# files: ./target/${{ matrix.target }}/release/cid.zip
58+
# files: ./target/${{ matrix.target }}/release/jab.zip
5959
# release_name: Release ${{ github.ref }}
6060
# draft: false
6161
# prerelease: false
@@ -71,6 +71,6 @@ jobs:
7171
# # See below blog post for more info:
7272
# # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
7373
# upload_url: ${{ steps.create_release.outputs.upload_url }}
74-
# asset_path: ./target/${{ matrix.target }}/release/cid.zip
74+
# asset_path: ./target/${{ matrix.target }}/release/jab.zip
7575
# asset_name: ${{ matrix.release_bin_name }}
7676
# asset_content_type: application/zip

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[package]
2-
name = "cid"
2+
name = "jab"
33
version = "0.1.0"
44
authors = ["Sendy Halim <sendyhalim93@gmail.com>"]
55
edition = "2018"
66
description = """\
7-
CID is a database state management tool, think of it as git but for \
7+
JAB is a database state management tool, think of it as git but for \
88
database. You can commit your current db state and checkout to \
99
your previous db state.\
1010
"""
1111
readme = "readme.md"
12-
homepage = "https://github.com/sendyhalim/cid"
13-
repository = "https://github.com/sendyhalim/cid"
12+
homepage = "https://github.com/sendyhalim/jab"
13+
repository = "https://github.com/sendyhalim/jab"
1414
keywords = ["cli", "database", "developer-tools"]
1515
categories = ["command-line-utilities"]
1616

@@ -39,5 +39,5 @@ name = "lib"
3939
path = "src/lib/lib.rs"
4040

4141
[[bin]]
42-
name = "cid"
43-
path = "src/bin/cid.rs"
42+
name = "jab"
43+
path = "src/bin/jab.rs"

readme.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Cid
2-
CID is a database state management tool, think of it as git but for database. You can commit your current db state and checkout to your previous db state.
1+
# Jab
2+
`jab` is a database state management tool, think of it as git but for database. You can commit your current db state and checkout to your previous db state.
33

4-
[![Crates.io](https://img.shields.io/crates/v/cid)](https://crates.io/crates/cid)
5-
[![Crates.io](https://img.shields.io/crates/l/cid)](LICENSE)
4+
[![Crates.io](https://img.shields.io/crates/v/jab)](https://crates.io/crates/jab)
5+
[![Crates.io](https://img.shields.io/crates/l/jab)](LICENSE)
66

77
## 📠 Notes
88
* Currently only supports postgres.
@@ -11,39 +11,39 @@ CID is a database state management tool, think of it as git but for database. Yo
1111
## 🔩 Installation
1212
### Manual (requires rust)
1313
```bash
14-
git clone git@github.com:sendyhalim/cid.git
14+
git clone git@github.com:sendyhalim/jab.git
1515

1616
make install
1717
```
1818

1919
### Download
20-
Dynamically linked binaries are only available for macos and linux. Go [here](https://github.com/sendyhalim/cid/releases/latest).
20+
Dynamically linked binaries are only available for macos and linux. Go [here](https://github.com/sendyhalim/jab/releases/latest).
2121

2222
## 🎮 Usage
2323
```bash
2424
# First create project.
2525
# Currently only supports postgres.
2626
# ------------------------------------------
27-
cid project create awesomestuff --database-uri="username:password@localhost:5433"
27+
jab project create awesomestuff --database-uri="username:password@localhost:5433"
2828

2929
# Start commiting your db
3030
# ------------------------------------------
31-
cid project commit awesomestuff --message "my first commit"
31+
jab project commit awesomestuff --message "my first commit"
3232

3333
# See log
3434
# ------------------------------------------
35-
cid project log awesomestuff
35+
jab project log awesomestuff
3636

3737
# Restore your db to the latest commit
3838
# ------------------------------------------
39-
cid project restore awesomestuff
39+
jab project restore awesomestuff
4040

4141
# Restore your db to a specific commit
4242
# ------------------------------------------
43-
cid project restore awesomestuff [optional-hash]
43+
jab project restore awesomestuff [optional-hash]
4444

4545

4646
# List of available projects
4747
# ------------------------------------------
48-
cid project list
48+
jab project list
4949
```

src/bin/cid.rs renamed to src/bin/jab.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use log;
88

99
use env_logger;
1010
use lib::config;
11-
use lib::config::CidConfig;
11+
use lib::config::JabConfig;
1212
use lib::config::ProjectConfig;
1313
use lib::db::postgresql::client as pg;
1414
use lib::project;
@@ -25,10 +25,10 @@ pub mod built_info {
2525
fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
env_logger::init();
2727

28-
log::debug!("Preparing cid..");
28+
log::debug!("Preparing jab..");
2929
MainProjectManager::bootstrap()?;
3030

31-
let cli = Cli::new("CID")
31+
let cli = Cli::new("jab")
3232
.version(built_info::PKG_VERSION)
3333
.author(built_info::PKG_AUTHORS)
3434
.setting(clap::AppSettings::ArgRequiredElseHelp)
@@ -102,10 +102,10 @@ fn project_cmd<'a, 'b>() -> Cli<'a, 'b> {
102102
}
103103

104104
fn handle_project_cli(cli: &ArgMatches) -> ResultDynError<()> {
105-
log::debug!("Reading cid config");
105+
log::debug!("Reading jab config");
106106

107-
let cid_config = CidConfig::read()?;
108-
let mut project_manager: MainProjectManager = MainProjectManager::new(cid_config);
107+
let jab_config = JabConfig::read()?;
108+
let mut project_manager: MainProjectManager = MainProjectManager::new(jab_config);
109109

110110
if let Some(create_cli) = cli.subcommand_matches("create") {
111111
log::debug!("Creating project...");
@@ -114,7 +114,7 @@ fn handle_project_cli(cli: &ArgMatches) -> ResultDynError<()> {
114114
let db_uri = create_cli.value_of("database-uri").unwrap();
115115

116116
let project = project_manager.create_project(&CreateProjectInput {
117-
project_dir: config::get_cid_dir().as_ref(),
117+
project_dir: config::get_jab_dir().as_ref(),
118118
project_name,
119119
db_uri,
120120
})?;
@@ -194,16 +194,16 @@ fn handle_project_cli(cli: &ArgMatches) -> ResultDynError<()> {
194194
}
195195

196196
struct MainProjectManager {
197-
cid_config: CidConfig,
197+
jab_config: JabConfig,
198198
}
199199

200200
impl MainProjectManager {
201201
fn open_project_from_args(&self, matches: &ArgMatches) -> ResultDynError<Project> {
202202
let project_name = matches.value_of("project").unwrap();
203-
let project_config = self.cid_config.project_config(project_name)?;
203+
let project_config = self.jab_config.project_config(project_name)?;
204204

205205
return self.open_project(&OpenProjectInput {
206-
project_dir: config::get_cid_dir().as_ref(),
206+
project_dir: config::get_jab_dir().as_ref(),
207207
project_name,
208208
db_uri: &project_config.db_uri,
209209
});
@@ -212,23 +212,23 @@ impl MainProjectManager {
212212

213213
impl ProjectManager for MainProjectManager {
214214
fn bootstrap() -> ResultDynError<()> {
215-
let cid_dir = config::get_cid_dir();
215+
let jab_dir = config::get_jab_dir();
216216

217-
if !cid_dir.exists() {
218-
fs::create_dir(cid_dir)?;
217+
if !jab_dir.exists() {
218+
fs::create_dir(jab_dir)?;
219219
}
220220

221-
let config_path = CidConfig::get_path();
221+
let config_path = JabConfig::get_path();
222222

223223
if !config_path.exists() {
224-
fs::write(config_path, CidConfig::empty_config_str())?;
224+
fs::write(config_path, JabConfig::empty_config_str())?;
225225
}
226226

227227
return Ok(());
228228
}
229229

230-
fn new(cid_config: CidConfig) -> MainProjectManager {
231-
return MainProjectManager { cid_config };
230+
fn new(jab_config: JabConfig) -> MainProjectManager {
231+
return MainProjectManager { jab_config };
232232
}
233233

234234
fn create_project(&mut self, input: &CreateProjectInput) -> ResultDynError<Project> {
@@ -238,12 +238,12 @@ impl ProjectManager for MainProjectManager {
238238
db_uri: input.db_uri,
239239
})?;
240240

241-
self.cid_config.register_project_config(ProjectConfig {
241+
self.jab_config.register_project_config(ProjectConfig {
242242
name: String::from(project.name()),
243243
db_uri: String::from(project.db_uri()),
244244
});
245245

246-
CidConfig::persist(&self.cid_config)?;
246+
JabConfig::persist(&self.jab_config)?;
247247

248248
return Ok(project);
249249
}
@@ -258,7 +258,7 @@ impl ProjectManager for MainProjectManager {
258258

259259
fn get_project_names(&self) -> ResultDynError<Vec<&str>> {
260260
let project_names: Vec<&str> = self
261-
.cid_config
261+
.jab_config
262262
.projects
263263
.values()
264264
.map(|config| config.name.as_ref())

src/lib/config.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ pub struct ProjectConfig {
2525
}
2626

2727
#[derive(Serialize, Deserialize)]
28-
pub struct CidConfig {
28+
pub struct JabConfig {
2929
pub projects: HashMap<String, ProjectConfig>,
3030
}
3131

32-
impl CidConfig {
33-
pub fn read() -> ResultDynError<CidConfig> {
34-
let config_path = CidConfig::get_path();
32+
impl JabConfig {
33+
pub fn read() -> ResultDynError<JabConfig> {
34+
let config_path = JabConfig::get_path();
3535
let config_str = String::from(fs::read_to_string(config_path)?);
36-
let config: CidConfig = serde_json::from_str(&config_str)?;
36+
let config: JabConfig = serde_json::from_str(&config_str)?;
3737

3838
return Ok(config);
3939
}
4040

41-
pub fn persist(config: &CidConfig) -> ResultDynError<()> {
42-
let config_path = CidConfig::get_path();
41+
pub fn persist(config: &JabConfig) -> ResultDynError<()> {
42+
let config_path = JabConfig::get_path();
4343

4444
let config_str = serde_json::to_string_pretty(&config)?;
4545
fs::write(config_path, config_str)?;
@@ -48,19 +48,19 @@ impl CidConfig {
4848
}
4949

5050
pub fn get_path() -> PathBuf {
51-
return get_cid_dir().join("config");
51+
return get_jab_dir().join("config");
5252
}
5353

5454
pub fn empty_config_str() -> String {
55-
let config = CidConfig {
55+
let config = JabConfig {
5656
projects: HashMap::new(),
5757
};
5858

5959
return serde_json::to_string_pretty(&config).unwrap();
6060
}
6161
}
6262

63-
impl CidConfig {
63+
impl JabConfig {
6464
pub fn register_project_config(&mut self, project_config: ProjectConfig) {
6565
self
6666
.projects
@@ -77,8 +77,8 @@ impl CidConfig {
7777
}
7878
}
7979

80-
pub fn get_cid_dir() -> PathBuf {
80+
pub fn get_jab_dir() -> PathBuf {
8181
let project_dir = dirs::home_dir().unwrap();
8282

83-
return project_dir.join(".cid");
83+
return project_dir.join(".jab");
8484
}

src/lib/db/postgresql/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl DbConnectionConfig {
164164
pub fn restore(input: RestoreInput) -> ResultDynError<String> {
165165
let db_uri = input.db_uri;
166166
let db_connection_config = DbConnectionConfig::from(db_uri)?;
167-
let temp_file_path = "/tmp/cid.sql";
167+
let temp_file_path = "/tmp/jab.sql";
168168

169169
log::debug!("Parsed config {:?}", db_connection_config);
170170
log::debug!("Writing dump to a temp file");

src/lib/project_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::Path;
22

3-
use crate::config::CidConfig;
3+
use crate::config::JabConfig;
44
use crate::project::Project;
55
use crate::types::ResultDynError;
66

@@ -18,7 +18,7 @@ pub struct OpenProjectInput<'a> {
1818

1919
pub trait ProjectManager {
2020
fn bootstrap() -> ResultDynError<()>;
21-
fn new(cid_config: CidConfig) -> Self;
21+
fn new(jab_config: JabConfig) -> Self;
2222
fn create_project(&mut self, input: &CreateProjectInput) -> ResultDynError<Project>;
2323
fn open_project(&self, input: &OpenProjectInput) -> ResultDynError<Project>;
2424
fn get_project_names(&self) -> ResultDynError<Vec<&str>>;

0 commit comments

Comments
 (0)