Skip to content

Commit

Permalink
Move cli in its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Feb 3, 2025
1 parent 06629c2 commit a656612
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 49 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ jobs:
matrix:
toolchain:
- "1.81"
package:
- "zipsign"
folder:
- "cli"
include:
- toolchain: "1.73"
package: zipsign-api
folder: api
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo check --package ${{ matrix.package }} --all-targets
- run: cargo check --all-targets
working-directory: ${{ matrix.folder }}

test:
strategy:
Expand Down Expand Up @@ -149,7 +150,7 @@ jobs:

- name: Execute example
run: |
cargo install --path .
cargo install --path cli
zipsign gen-key priv.key pub.key
tar czf Cargo.lock.tgz Cargo.lock
Expand Down
68 changes: 42 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
[package]
name = "zipsign"
description = "Sign and verify `.zip` and `.tar.gz` files with an ed25519 signing key"
version = "0.1.3"
edition = "2021"
authors = ["René Kijewski <crates.io@k6i.de>"]
repository = "/~https://github.com/Kijewski/zipsign"
license = "MIT OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception"
rust-version = "1.81"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition", "--cfg=docsrs"]

[dependencies]
clap.workspace = true
ed25519-dalek = { workspace = true, features = ["rand_core"] }
normalize-path.workspace = true
pretty-error-debug.workspace = true
rand_core.workspace = true
tempfile.workspace = true
thiserror.workspace = true
zipsign-api.workspace = true

[workspace]
resolver = "2"
members = [".", "api"]
default-members = [".", "api"]
members = ["api", "cli"]
default-members = ["api", "cli"]

[workspace.dependencies]
base64 = "0.22.0"
Expand All @@ -45,3 +21,43 @@ version = "0.1.3"
path = "api"
default-features = false
features = ["tar", "zip"]

[workspace.lints.rust]
unknown_lints = { level = "allow", priority = -1 }
unsafe_code = { level = "forbid", priority = -1 }

absolute_paths_not_starting_with_crate = "warn"
elided_lifetimes_in_paths = "warn"
explicit_outlives_requirements = "warn"
meta_variable_misuse = "warn"
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
missing_docs = "warn"
non_ascii_idents = "warn"
noop_method_call = "warn"
rust_2024_compatibility = "warn"
single_use_lifetimes = "warn"
trivial_casts = "warn"
unreachable_pub = "warn"
unused_crate_dependencies = "warn"
unused_extern_crates = "warn"
unused_lifetimes = "warn"
unused_results = "warn"
warnings = "warn"

[workspace.lints.clippy]
collapsible_match = "warn"
expect_used = "warn"
match_bool = "warn"
match_ref_pats = "warn"
match_same_arms = "warn"
match_single_binding = "warn"
needless_bool = "deny"
needless_late_init = "warn"
needless_match = "warn"
redundant_guards = "warn"
redundant_pattern = "warn"
redundant_pattern_matching = "warn"
single_match = "warn"
single_match_else = "warn"
unwrap_used = "warn"
1 change: 1 addition & 0 deletions api/_typos.toml
File renamed without changes.
2 changes: 1 addition & 1 deletion api/src/sign/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ where
while padding_to_write > 0 {
const PADDING: &[u8; 512] = &[0; 512];
let result = if padding_to_write > PADDING.len() {
let num_slices = ((padding_to_write + PADDING.len() - 1) / PADDING.len()).min(128);
let num_slices = padding_to_write.div_ceil(PADDING.len()).min(128);
let mut slices = vec![IoSlice::new(PADDING); num_slices];
slices[num_slices - 1] = IoSlice::new(&PADDING[..padding_to_write % PADDING.len()]);
output.write_vectored(&slices)
Expand Down
23 changes: 23 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "zipsign"
description = "Sign and verify `.zip` and `.tar.gz` files with an ed25519 signing key"
version = "0.1.3"
edition = "2021"
authors = ["René Kijewski <crates.io@k6i.de>"]
repository = "/~https://github.com/Kijewski/zipsign"
license = "MIT OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception"
rust-version = "1.81"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition", "--cfg=docsrs"]

[dependencies]
clap.workspace = true
ed25519-dalek = { workspace = true, features = ["rand_core"] }
normalize-path.workspace = true
pretty-error-debug.workspace = true
rand_core.workspace = true
tempfile.workspace = true
thiserror.workspace = true
zipsign-api.workspace = true
1 change: 1 addition & 0 deletions cli/LICENSE-APACHE
1 change: 1 addition & 0 deletions cli/LICENSE-MIT
1 change: 1 addition & 0 deletions cli/README.md
1 change: 1 addition & 0 deletions cli/_typos.toml
1 change: 1 addition & 0 deletions cli/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.81.0"
1 change: 1 addition & 0 deletions cli/rustfmt.toml
File renamed without changes.
17 changes: 0 additions & 17 deletions src/main.rs → cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![forbid(unsafe_code)]
#![allow(unknown_lints)]
#![warn(absolute_paths_not_starting_with_crate)]
#![warn(elided_lifetimes_in_paths)]
#![warn(explicit_outlives_requirements)]
#![warn(meta_variable_misuse)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![warn(non_ascii_idents)]
#![warn(noop_method_call)]
#![warn(rust_2021_idioms)]
#![warn(single_use_lifetimes)]
#![warn(trivial_casts)]
#![warn(unreachable_pub)]
#![warn(unused_crate_dependencies)]
#![warn(unused_extern_crates)]
#![warn(unused_lifetimes)]
#![warn(unused_results)]
#![doc = include_str!("../README.md")]

mod generate;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions cli/tomlfmt.toml

0 comments on commit a656612

Please sign in to comment.