From 4a5d2a3c22096c563608ce2e3603ea40810f030b Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 30 Jan 2022 02:34:51 +0000 Subject: moved everything to bash again --- src/XibUtil.pm | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/XibUtil.pm (limited to 'src/XibUtil.pm') diff --git a/src/XibUtil.pm b/src/XibUtil.pm deleted file mode 100644 index 1aa02a8..0000000 --- a/src/XibUtil.pm +++ /dev/null @@ -1,52 +0,0 @@ -package XibUtil; - -use v5.12; - -use strict; -use warnings; - -use File::Basename; - -sub md5_sum{ - my ($file) = @_; - - open(my $fh, "<", $file) or die "Cannot open $file: $!"; - binmode($fh); - - return Digest::MD5->new->addfile($fh)->hexdigest; -} - -sub extract_from_file{ - my ($file, $regex) = @_; - open (my $fh, "<", $file) or warn "Cannot open $file"; - while (my $line = <$fh>) { - if ($line =~ $regex) { - return $1; - } - } -} - -sub is_git_repo{ - return system("git ls-remote -q @_"); -} - -sub extract{ - my ($file) = @_; - my $ext = (fileparse($file, qr/\.[^.]*/))[2]; - print("$ext\n"); - - my $cmd = ""; - given($ext) { - $cmd = "tar -zxf $file" when ".gz"; - $cmd = "tar -xf $file" when ".xz"; - $cmd = "unzip $file" when ".zip"; - $cmd = "tar --lzip -xf $file" when ".lz"; - default { - $cmd = "tar -xf $file"; - } - } - - system($cmd); -} - -1; -- cgit v1.2.1