Skip to content

Commit 9294068

Browse files
feat: unflag Ruby gem support and add e2e bundler tests (#41)
* feat: unflag Ruby gem support and add e2e bundler tests Remove the `gem` feature flag so Ruby gem support is always compiled in, matching npm and PyPI which are already default-on. This ensures gem support ships in every release binary built with `cargo build --release`. - Remove `gem = []` from both Cargo.toml feature sections - Remove all `#[cfg(feature = "gem")]` gates from crawler module, Ecosystem enum, PURL functions, and ecosystem dispatch - Rewrite e2e_gem.rs with full bundler lifecycle tests targeting activestorage@5.2.0 (CVE-2022-21831) with 3-file hash verification - Add Ruby 3.2 setup step in CI for e2e_gem suite - Update READMEs to reflect gem as default, not feature-flagged Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: split clippy into own CI job and fix broken update.rs tests - Move clippy into a dedicated `clippy` job so it runs independently from tests and is separately visible in PR checks - Remove `components: clippy` from the test job (no longer needed) - Fix 2 pre-existing test failures in package_json::update::tests: assertions checked for "socket patch apply" (space) but the SOCKET_PATCH_COMMAND writes "socket-patch apply" (hyphen) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: pin ruby/setup-ruby action to full commit SHA GitHub org policy requires all actions to be pinned to full-length commit SHAs. Pin ruby/setup-ruby@v1 to its current SHA. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use dynamic hash verification in gem e2e tests Instead of hardcoded before/after hashes (which were incorrect placeholders), read expected hashes from the manifest after `get` and record original hashes dynamically after install. This matches the pattern used by the pypi e2e tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 90c5fb6 commit 9294068

File tree

12 files changed

+393
-57
lines changed

12 files changed

+393
-57
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@ permissions:
99
contents: read
1010

1111
jobs:
12+
clippy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17+
18+
- name: Install Rust
19+
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable
20+
with:
21+
toolchain: stable
22+
components: clippy
23+
24+
- name: Cache cargo
25+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
26+
with:
27+
path: |
28+
~/.cargo/registry
29+
~/.cargo/git
30+
target
31+
key: ubuntu-latest-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
32+
restore-keys: ubuntu-latest-cargo-clippy-
33+
34+
- name: Run clippy
35+
run: cargo clippy --workspace --all-features -- -D warnings
36+
1237
test:
1338
strategy:
1439
matrix:
@@ -22,7 +47,6 @@ jobs:
2247
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable
2348
with:
2449
toolchain: stable
25-
components: clippy
2650

2751
- name: Cache cargo
2852
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
@@ -34,9 +58,6 @@ jobs:
3458
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3559
restore-keys: ${{ matrix.os }}-cargo-
3660

37-
- name: Run clippy
38-
run: cargo clippy --workspace --all-features -- -D warnings
39-
4061
- name: Run tests
4162
run: cargo test --workspace --all-features
4263

@@ -120,5 +141,12 @@ jobs:
120141
with:
121142
python-version: "3.12"
122143

144+
- name: Setup Ruby
145+
if: matrix.suite == 'e2e_gem'
146+
uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
147+
with:
148+
ruby-version: '3.2'
149+
bundler-cache: false
150+
123151
- name: Run e2e tests
124152
run: cargo test -p socket-patch-cli --all-features --test ${{ matrix.suite }} -- --ignored

Cargo.lock

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cargo install socket-patch-cli
6666
By default this builds with npm and PyPI support. For additional ecosystems:
6767

6868
```bash
69-
cargo install socket-patch-cli --features cargo,golang,maven,gem,composer,nuget
69+
cargo install socket-patch-cli --features cargo,golang,maven,composer,nuget
7070
```
7171

7272
## Quick Start

crates/socket-patch-cli/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ tempfile = { workspace = true }
2626
[features]
2727
default = []
2828
cargo = ["socket-patch-core/cargo"]
29-
gem = ["socket-patch-core/gem"]
3029
golang = ["socket-patch-core/golang"]
3130
maven = ["socket-patch-core/maven"]
3231
composer = ["socket-patch-core/composer"]

crates/socket-patch-cli/src/ecosystem_dispatch.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::path::PathBuf;
77

88
#[cfg(feature = "cargo")]
99
use socket_patch_core::crawlers::CargoCrawler;
10-
#[cfg(feature = "gem")]
1110
use socket_patch_core::crawlers::RubyCrawler;
1211
#[cfg(feature = "golang")]
1312
use socket_patch_core::crawlers::GoCrawler;
@@ -141,7 +140,6 @@ pub async fn find_packages_for_purls(
141140
}
142141

143142
// gem
144-
#[cfg(feature = "gem")]
145143
if let Some(gem_purls) = partitioned.get(&Ecosystem::Gem) {
146144
if !gem_purls.is_empty() {
147145
let ruby_crawler = RubyCrawler;
@@ -323,7 +321,6 @@ pub async fn crawl_all_ecosystems(
323321
all_packages.extend(cargo_packages);
324322
}
325323

326-
#[cfg(feature = "gem")]
327324
{
328325
let ruby_crawler = RubyCrawler;
329326
let gem_packages = ruby_crawler.crawl_all(options).await;
@@ -468,7 +465,6 @@ pub async fn find_packages_for_rollback(
468465
}
469466

470467
// gem
471-
#[cfg(feature = "gem")]
472468
if let Some(gem_purls) = partitioned.get(&Ecosystem::Gem) {
473469
if !gem_purls.is_empty() {
474470
let ruby_crawler = RubyCrawler;

0 commit comments

Comments
 (0)