Skip to content

Commit 5e85a62

Browse files
authored
Merge pull request #430 from joebonrichie/boulder-new-ruby
boulder/draft: Add initial ruby support to boulder new
2 parents 39fb5ff + 32b6dd2 commit 5e85a62

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

boulder/src/draft/build.rs

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod cargo;
1313
mod cmake;
1414
mod meson;
1515
mod python;
16+
mod ruby;
1617

1718
pub type Error = Box<dyn std::error::Error>;
1819

@@ -26,6 +27,8 @@ pub enum System {
2627
Meson,
2728
PythonPep517,
2829
PythonSetupTools,
30+
RubyGem,
31+
RubyTarball,
2932
}
3033

3134
impl System {
@@ -36,6 +39,8 @@ impl System {
3639
Self::Meson,
3740
Self::PythonPep517,
3841
Self::PythonSetupTools,
42+
Self::RubyGem,
43+
Self::RubyTarball,
3944
];
4045

4146
pub fn environment(&self) -> Option<&'static str> {
@@ -46,6 +51,8 @@ impl System {
4651
System::Meson => None,
4752
System::PythonPep517 => None,
4853
System::PythonSetupTools => None,
54+
System::RubyGem => None,
55+
System::RubyTarball => None,
4956
}
5057
}
5158

@@ -57,6 +64,8 @@ impl System {
5764
System::Meson => meson::phases(),
5865
System::PythonPep517 => python::pep517::phases(),
5966
System::PythonSetupTools => python::setup_tools::phases(),
67+
System::RubyGem => ruby::gemfile::phases(),
68+
System::RubyTarball => ruby::tarball::phases(),
6069
}
6170
}
6271

@@ -76,6 +85,8 @@ impl System {
7685
System::Meson => meson::process(state, file),
7786
System::PythonPep517 => python::pep517::process(state, file),
7887
System::PythonSetupTools => python::setup_tools::process(state, file),
88+
System::RubyGem => ruby::gemfile::process(state, file),
89+
System::RubyTarball => ruby::tarball::process(state, file),
7990
}
8091
}
8192
}

boulder/src/draft/build/ruby.rs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// SPDX-FileCopyrightText: Copyright © 2020-2025 Serpent OS Developers
2+
//
3+
// SPDX-License-Identifier: MPL-2.0
4+
5+
// filename.gem
6+
pub mod gemfile {
7+
use crate::draft::build::{Error, Phases, State};
8+
use crate::draft::File;
9+
10+
pub fn phases() -> Phases {
11+
Phases {
12+
setup: None,
13+
build: None,
14+
install: Some("%gem_install"),
15+
check: None,
16+
}
17+
}
18+
19+
pub fn process(state: &mut State<'_>, file: &File<'_>) -> Result<(), Error> {
20+
match file.file_name() {
21+
"checksums.yaml.gz" if file.depth() == 0 => state.increment_confidence(50),
22+
"data.tar.gz" if file.depth() == 0 => state.increment_confidence(80),
23+
"metadata.gz" if file.depth() == 0 => state.increment_confidence(100),
24+
_ => {}
25+
}
26+
27+
Ok(())
28+
}
29+
}
30+
31+
// A normal tarball
32+
pub mod tarball {
33+
use crate::draft::build::{Error, Phases, State};
34+
use crate::draft::File;
35+
36+
pub fn phases() -> Phases {
37+
Phases {
38+
setup: None,
39+
build: Some("%gem_build"),
40+
install: Some("%gem_install"),
41+
check: None,
42+
}
43+
}
44+
45+
pub fn process(state: &mut State<'_>, file: &File<'_>) -> Result<(), Error> {
46+
match file.file_name() {
47+
_ if file.depth() == 0 && file.file_name().ends_with(".gemspec") => {
48+
state.increment_confidence(100);
49+
}
50+
_ => {}
51+
}
52+
53+
Ok(())
54+
}
55+
}

0 commit comments

Comments
 (0)