Skip to content

Commit 0839ecc

Browse files
authored
Add package generation manual (#26)
* Add package generation manual * Linter issues fix
1 parent f3e7bbe commit 0839ecc

File tree

4 files changed

+52
-23
lines changed

4 files changed

+52
-23
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ edition = "2021"
55
description = """
66
`zxc` is a directory-oriented command runner.
77
This means it is able to run commands defined by YAML files."""
8+
repository = "https://github.com/arkjedrz/zxc"
9+
license = "MIT"
810
authors = ["Arkadiusz Jędrzejewski"]
911

1012
[dependencies]
@@ -18,3 +20,8 @@ run_script = "0.11"
1820
tempfile = "3.16"
1921
fsio = "0.4"
2022
serial_test = "3.2"
23+
24+
[package.metadata.generate-rpm]
25+
assets = [
26+
{ source = "target/release/zxc", dest = "/usr/bin/zxc", mode = "755" },
27+
]

README.md

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@
33
`zxc` is a directory-oriented command runner.
44
This means it is able to run commands defined by YAML files.
55

6-
## Pre-commit setup
7-
8-
[pre-commit](https://pre-commit.com/) tool is used.
9-
10-
To install pre-commit hooks:
11-
12-
```bash
13-
pre-commit install
14-
```
15-
16-
To run pre-commit hooks:
17-
18-
```bash
19-
pre-commit run -a
20-
```
21-
226
## Basics of operation
237

248
### Definition files location
@@ -94,3 +78,44 @@ Use following command to print `Hello John!`:
9478
```bash
9579
zxc greet --name John
9680
```
81+
82+
## Development
83+
84+
```bash
85+
pip install pre-commit
86+
cargo install cargo-deb cargo-generate-rpm cargo-aur
87+
```
88+
89+
### Pre-commit setup
90+
91+
Install and run hooks:
92+
93+
```bash
94+
pre-commit install
95+
pre-commit run -a
96+
```
97+
98+
## Build and install
99+
100+
```bash
101+
cargo build --release
102+
cargo install --path .
103+
cargo test
104+
```
105+
106+
### Create packages
107+
108+
Application must be built and stripped:
109+
110+
```bash
111+
cargo build --release
112+
strip -s target/release/zxc
113+
```
114+
115+
Create packages:
116+
117+
```bash
118+
cargo deb
119+
cargo generate-rpm
120+
cargo aur
121+
```

src/command_runner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use run_script::types::ScriptError::{Description, FsIOError, IOError};
22
use run_script::{spawn, IoOptions, ScriptError, ScriptOptions};
3-
use std::io::{Error, ErrorKind};
3+
use std::io::Error;
44
use std::process::ExitStatus;
55

66
/// Convert all errors to `std::io::Error`.
77
fn match_error(script_error: ScriptError) -> Error {
88
match script_error {
99
IOError(io_error) => io_error,
10-
FsIOError(fsio_error) => Error::new(ErrorKind::Other, fsio_error.to_string()),
11-
Description(description) => Error::new(ErrorKind::Other, description),
10+
FsIOError(fsio_error) => Error::other(fsio_error.to_string()),
11+
Description(description) => Error::other(description),
1212
}
1313
}
1414

src/def_file_finder.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ fn find_def_file(directory_path: &Path) -> Result<Option<PathBuf>, Error> {
2626

2727
// Disallow multiple found.
2828
if found_files.len() > 1 {
29-
return Err(Error::new(
30-
ErrorKind::Other,
31-
"Multiple definition files found",
32-
));
29+
return Err(Error::other("Multiple definition files found"));
3330
}
3431

3532
// Check if any found.

0 commit comments

Comments
 (0)