Skip to content

Commit c6c056b

Browse files
authored
Merge pull request #32 from sdttttt/develop
Upgrade to 0.9.1
2 parents 88af12b + 1c19213 commit c6c056b

File tree

16 files changed

+139
-82
lines changed

16 files changed

+139
-82
lines changed

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ master, develop ]
88

99
env:
1010
CARGO_TERM_COLOR: always

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ master, develop ]
88

99
env:
1010
CARGO_TERM_COLOR: always

.github/workflows/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ master, develop ]
88

99
env:
1010
CARGO_TERM_COLOR: always
@@ -26,7 +26,7 @@ jobs:
2626
path: |
2727
target
2828
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
29-
29+
3030

3131
- uses: actions-rs/toolchain@v1
3232
with:

CONTRIBUTORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Thanks to [@KlausDevWalker](https://github.com/KlausDevWalker) for point out the description errors in the docs.
2+
3+
Thanks to [@laggardkernel](https://github.com/laggardkernel) for point out the signature generation problem.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grc"
3-
version = "0.9.0-rc.1"
3+
version = "0.9.1"
44
authors = ["sdttttt <[email protected]>"]
55
description = "Similar to git-cz, gcr will help you to provide a better Git experience."
66
readme = "README.md"

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# GRC
22

3-
![](https://img.shields.io/crates/v/grc.svg)
3+
![GRC](https://img.shields.io/crates/v/grc.svg)
44
![Rust](https://github.com/sdttttt/gcr/workflows/Rust/badge.svg)
55
![Release](https://github.com/sdttttt/gcr/workflows/Release/badge.svg)
66
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6501c2d5bc19413dbbd297c6ee39e060)](https://app.codacy.com/gh/sdttttt/gcr?utm_source=github.com&utm_medium=referral&utm_content=sdttttt/gcr&utm_campaign=Badge_Grade)
77
[![codecov](https://codecov.io/gh/sdttttt/gcr/branch/master/graph/badge.svg)](https://codecov.io/gh/sdttttt/gcr)
88

9-
Standardized Git submission tool. “Grc” is a temporary name.
9+
Semantic git commits tool.
1010

11-
Similar to git-cz, grc will help you to provide a better Git experience.
11+
Similar to `git-cz`, grc will help you to provide a better Git experience.
1212

1313
## Install
1414

1515
You can install **grc** in the following ways:
1616

17-
### From Cargo
17+
### From crates.io
1818

1919
Please Run:
2020

@@ -31,15 +31,9 @@ Go to [RELEASE](https://github.com/sdttttt/gcr/releases), download one you like.
3131
Please Run:
3232

3333
```sh
34-
git clone --depth=1 https://github.com/sdttttt/gcr.git
35-
36-
cd gcr
37-
38-
cargo build --release
34+
cargo install --git https://github.com/sdttttt/gcr.git
3935
```
4036

41-
grc under `target/release/`.
42-
4337
## Using
4438

4539
after the tools install, run command in your repository:
@@ -72,14 +66,10 @@ type = [
7266
]
7367
```
7468

75-
## Contributor
76-
77-
Thanks to [@KlausDevWalker](https://github.com/KlausDevWalker) for helping the docs get better.
69+
Starting with **0.9.1**, grc using `~/.config/grc/grc.toml` as the default configuration file.
7870

7971
## IDEA
8072

8173
If you have any new ideas, you are welcome to talk to me.
8274

83-
`grc` has taken over all git submissions from @sdttttt
84-
85-
75+
`grc` has taken over all git submissions from @sdttttt.

TODO

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Please check these before the version is released.
2+
3+
1. Modify the constant in metadata.rs.
4+
2. Modify the properties in cargo.toml.
5+
3. Update your documents. (README)
6+
4. Figure out the type of version you released.

makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ publish: fmt
2626
$(c) publish -v
2727

2828
.PHONY: commit
29-
commit: fmt test
30-
$(g) -a .
29+
commit: fmt test run

src/extensions.rs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use std::env;
12
use std::fs;
23
use std::io::{Error, ErrorKind};
34

45
use serde::Deserialize;
56

6-
use crate::metadata::GRC_CONFIG_FILE_NAME;
7+
use crate::metadata::{GLOBAL_CONFIG_PATH, GRC_CONFIG_FILE_NAME};
78

89
/// Extensions is GRC future config.
910
#[derive(Deserialize)]
@@ -13,25 +14,42 @@ pub struct Extensions {
1314
}
1415

1516
impl Extensions {
16-
17-
/// Read Extension from the configuration file in the convention name.
18-
pub fn from_agreement() -> Result<Self, Error> {
17+
/// Read Extension from the configuration file in the convention name.
18+
pub fn from_agreement() -> Result<Self, Error> {
1919
let file_str = Self::read_config_file(GRC_CONFIG_FILE_NAME)?;
20-
Ok(Self::deserialize(file_str)?)
20+
if file_str.len() == 0 {
21+
Self::from_global()
22+
} else {
23+
Ok(Self::deserialize(file_str)?)
24+
}
25+
}
26+
27+
#[cfg(not(target_os = "windows"))]
28+
pub fn from_global() -> Result<Self, Error> {
29+
let home_dir = env::var("HOME").unwrap_or(String::new());
30+
let file_path = format!("{}/{}", home_dir.as_str(), GLOBAL_CONFIG_PATH);
31+
Self::from(file_path.as_str())
32+
}
33+
34+
#[cfg(target_os = "windows")]
35+
pub fn from_global() -> Result<Self, Error> {
36+
let home_dir = env::var("USERPROFILE").unwrap_or(String::new());
37+
let file_path = format!("{}\\{}", home_dir.as_str(), GLOBAL_CONFIG_PATH);
38+
Self::from(file_path.as_str())
2139
}
2240

23-
/// Read Extension from the configuration file in the Specified name.
41+
/// Read Extension from the configuration file in the Specified name.
2442
pub fn from(filename: &str) -> Result<Self, Error> {
2543
let file_str = Self::read_config_file(filename)?;
2644
Ok(Self::deserialize(file_str)?)
2745
}
2846

29-
/// got All Types in configuration file.
47+
/// got All Types in configuration file.
3048
pub fn types(&self) -> &Vec<String> {
3149
&self.typ
3250
}
3351

34-
/// deserialize toml configuration file to struct.
52+
/// deserialize toml configuration file to struct.
3553
fn deserialize(file_str: String) -> Result<Self, Error> {
3654
if file_str.len() == 0 || file_str == "" {
3755
return Ok(Self { typ: vec![] });
@@ -41,7 +59,7 @@ impl Extensions {
4159
Ok(config)
4260
}
4361

44-
/// read config file convert std::string::String
62+
/// read config file convert std::string::String
4563
fn read_config_file(filename: &str) -> Result<String, Error> {
4664
match fs::read_to_string(filename) {
4765
Ok(content) => Ok(content),

0 commit comments

Comments
 (0)