aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-12 03:24:55 +0900
committernsfisis <nsfisis@gmail.com>2026-05-12 03:24:55 +0900
commitab445c44c84925bbcb265ceea6d8d8eddac17768 (patch)
tree5b883ea5352f72666854ca70452cda6992740586
parent2161c564c7e627d44f4eb98f64b7a577f6623722 (diff)
downloadphp-shirabe-ab445c44c84925bbcb265ceea6d8d8eddac17768.tar.gz
php-shirabe-ab445c44c84925bbcb265ceea6d8d8eddac17768.tar.zst
php-shirabe-ab445c44c84925bbcb265ceea6d8d8eddac17768.zip
feat(port): port TarDownloader.php
-rw-r--r--crates/shirabe-php-shim/src/lib.rs15
-rw-r--r--crates/shirabe/src/downloader/tar_downloader.rs20
2 files changed, 35 insertions, 0 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index 2d662d6..0533c0a 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -34,3 +34,18 @@ pub struct InvalidArgumentException {
pub message: String,
pub code: i64,
}
+
+#[derive(Debug)]
+pub struct PharData {
+ path: String,
+}
+
+impl PharData {
+ pub fn new(a: String) -> Self {
+ todo!()
+ }
+
+ pub fn extract_to(&self, a: &str, b: Option<()>, c: bool) {
+ todo!()
+ }
+}
diff --git a/crates/shirabe/src/downloader/tar_downloader.rs b/crates/shirabe/src/downloader/tar_downloader.rs
index 0a1fe5c..4b13f3b 100644
--- a/crates/shirabe/src/downloader/tar_downloader.rs
+++ b/crates/shirabe/src/downloader/tar_downloader.rs
@@ -1 +1,21 @@
//! ref: composer/src/Composer/Downloader/TarDownloader.php
+
+use anyhow::Result;
+use shirabe_php_shim::PharData;
+use shirabe_external_packages::react::promise::promise_interface::PromiseInterface;
+use crate::downloader::archive_downloader::ArchiveDownloader;
+use crate::package::package_interface::PackageInterface;
+
+#[derive(Debug)]
+pub struct TarDownloader {
+ inner: ArchiveDownloader,
+}
+
+impl TarDownloader {
+ pub(crate) fn extract(&self, package: &dyn PackageInterface, file: &str, path: &str) -> Result<Box<dyn PromiseInterface>> {
+ let archive = PharData::new(file.to_string());
+ archive.extract_to(path, None, true);
+
+ Ok(shirabe_external_packages::react::promise::resolve(None))
+ }
+}