Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: CI

on:
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Check
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Release

on:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
publish:
name: Publish to crates.io
Expand Down
17 changes: 7 additions & 10 deletions benches/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,13 @@ fn bench_signal_structured_config(c: &mut Criterion) {
for repo in harness::REPOS {
let path = harness::ensure_repo(repo);

c.bench_function(
&format!("signal/structured_config/{}", repo.name),
|b| {
b.iter(|| {
let signals = vec![launch::signals::structured_config_signal()];
let result = launch::discover(&path, signals, &fs).unwrap();
std::hint::black_box(result);
});
},
);
c.bench_function(&format!("signal/structured_config/{}", repo.name), |b| {
b.iter(|| {
let signals = vec![launch::signals::structured_config_signal()];
let result = launch::discover(&path, signals, &fs).unwrap();
std::hint::black_box(result);
});
});
}
}

Expand Down
16 changes: 12 additions & 4 deletions src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn walk_local(root: &Path, signals: &mut [Box<dyn Signal>]) -> Result<(), La
.git_global(false)
.git_exclude(false)
.filter_entry(|e| {
if e.file_type().map_or(false, |ft| ft.is_dir()) {
if e.file_type().is_some_and(|ft| ft.is_dir()) {
if let Some(name) = e.file_name().to_str() {
return !EXCLUDED.contains(name);
}
Expand All @@ -103,7 +103,7 @@ pub fn walk_local(root: &Path, signals: &mut [Box<dyn Signal>]) -> Result<(), La
}

let path = entry.path().to_path_buf();
let is_dir = entry.file_type().map_or(false, |ft| ft.is_dir());
let is_dir = entry.file_type().is_some_and(|ft| ft.is_dir());
let name = entry.file_name().to_string_lossy().into_owned();

let rel = path.strip_prefix(&root).unwrap_or(&path);
Expand Down Expand Up @@ -231,7 +231,11 @@ fn merge_service(base: &mut Service, other: &Service) {
if other.$field.is_some() {
eprintln!(
"[merge] {}/{}: dropping {} from {:?}, keeping {:?}",
base.dir, base.name, stringify!($field), other.detected_by, base.detected_by,
base.dir,
base.name,
stringify!($field),
other.detected_by,
base.detected_by,
);
}
}
Expand All @@ -244,7 +248,11 @@ fn merge_service(base: &mut Service, other: &Service) {
if other.$field.is_some() {
eprintln!(
"[merge] {}/{}: dropping {} from {:?}, keeping {:?}",
base.dir, base.name, stringify!($field), other.detected_by, base.detected_by,
base.dir,
base.name,
stringify!($field),
other.detected_by,
base.detected_by,
);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/signals/dotenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ impl Signal for DotEnvSignal {
if let Some(files) = self.dirs.get_mut(dir) {
files.push(name.to_string());
} else {
self.dirs
.insert(dir.to_path_buf(), vec![name.to_string()]);
self.dirs.insert(dir.to_path_buf(), vec![name.to_string()]);
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/signals/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,7 @@ mod tests {
let svc = &disc.services[0];
assert_eq!(svc.framework.as_deref(), Some("pelican"));
assert_eq!(svc.commands.build.as_deref(), Some("pelican content"));
assert_eq!(
svc.commands.start.as_deref(),
Some("pelican --listen")
);
assert_eq!(svc.commands.start.as_deref(), Some("pelican --listen"));
assert_eq!(
svc.commands.dev.as_deref(),
Some("pelican --listen --autoreload")
Expand Down
3 changes: 1 addition & 2 deletions src/signals/monorepo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ fn expand_packages(
} else {
format!("{search_dir}/{}", entry.name)
};
if let Some(pkg) =
try_read_package(fs, &dir, package_file, &workspace.ws_type)
if let Some(pkg) = try_read_package(fs, &dir, package_file, &workspace.ws_type)
{
packages.insert(dir_key(&dir), pkg);
}
Expand Down
3 changes: 1 addition & 2 deletions src/signals/package/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ mod tests {

#[test]
fn test_parse_mise_toml_inline_table() {
let content =
"[tools]\nrust = { version = \"1.92\", components = \"rustfmt,clippy\" }\nnode = \"22.0.0\"\n";
let content = "[tools]\nrust = { version = \"1.92\", components = \"rustfmt,clippy\" }\nnode = \"22.0.0\"\n";
assert_eq!(parse_mise_toml(content, "rust"), Some("1.92".into()));
assert_eq!(parse_mise_toml(content, "node"), Some("22.0.0".into()));
}
Expand Down
23 changes: 4 additions & 19 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ fn multi_dockerfile() {
assert_eq!(disc.services.len(), 2);

let api = disc.services.iter().find(|s| s.name == "api").unwrap();
let worker = disc
.services
.iter()
.find(|s| s.name == "worker")
.unwrap();
let worker = disc.services.iter().find(|s| s.name == "worker").unwrap();

// Both have Python language from Dockerfile base image
assert_eq!(api.language, Some(Language::Python));
Expand Down Expand Up @@ -175,20 +171,13 @@ services:
"#,
),
("Dockerfile", "FROM node:20\nCOPY . .\nEXPOSE 3000"),
(
"package.json",
r#"{ "scripts": { "build": "tsc" } }"#,
),
("package.json", r#"{ "scripts": { "build": "tsc" } }"#),
]);

assert_eq!(disc.services.len(), 2);

let api = disc.services.iter().find(|s| s.name == "api").unwrap();
let worker = disc
.services
.iter()
.find(|s| s.name == "worker")
.unwrap();
let worker = disc.services.iter().find(|s| s.name == "worker").unwrap();

// api: public (has ports), start from compose command
assert_eq!(api.network, Some(Network::Public));
Expand Down Expand Up @@ -346,11 +335,7 @@ fn heroku_multi_process() {
assert_eq!(disc.services.len(), 2);

let web = disc.services.iter().find(|s| s.name == "web").unwrap();
let worker = disc
.services
.iter()
.find(|s| s.name == "worker")
.unwrap();
let worker = disc.services.iter().find(|s| s.name == "worker").unwrap();

// Both: Ruby language, version 3.2.0, framework rails
assert_eq!(web.language, Some(Language::Ruby));
Expand Down