XAS-Spooler
view release on metacpan or search on metacpan
my ($name, $path, $ext) = fileparse($file, qr/\.[^.]*/);
my $new = catfile($path, $name);
move($file, $new);
}
}
}
# remove debian stuff when installing to redhat
sub ACTION_redhat {
my $self = shift;
# cleanup the init.d directory
my $destdir = $self->destdir;
my @files = ('xas-spooler', 'xas-collector');
my @names = map { catfile($destdir, 'etc', 'init.d', $_ . '.debian') } @files;
foreach my $file (@names) {
unlink $file if (-e $file);
}
@names = map { catfile($destdir, 'etc', 'init.d', $_ . '.rhel') } @files;
foreach my $file (@names) {
if ( -e $file) {
my ($name, $path, $ext) = fileparse($file, qr/\.[^.]*/);
my $new = catfile($path, $name);
move($file, $new);
}
}
}
# correctly process additional directories
sub process_etc_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'etc');
my $files = $self->find_etc_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to);
}
return $self;
}
sub process_sbin_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'sbin');
my $files = $self->find_sbin_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to) or next;
$self->fix_shebang_line($result) unless $self->is_vmsish;
$self->make_executable($result);
}
$self->manify_sbin_pods();
return $self;
}
sub process_initd_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'init.d');
my $files = $self->find_initd_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to) or next;
$self->make_executable($result);
}
return $self;
}
sub process_sysconf_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'sysconfig');
my $files = $self->find_sysconf_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to);
}
return $self;
}
sub process_profiled_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'profile.d');
my $files = $self->find_profiled_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to) or next;
$self->make_executable($result);
}
return $self;
}
sub process_logrotated_files {
my $self = shift;
my $result;
my $dir = catfile('blib', 'logrotate.d');
my $files = $self->find_logrotated_files;
mkdir $dir unless (-e $dir);
while (my ($from, $to) = each %$files) {
$to = catfile('blib', $to);
$result = $self->copy_if_modified(from => $from, to => $to);
}
return $self;
}
sub find_etc_files { shift->find_all_files_no_scm('etc'); }
sub find_sbin_files { shift->find_all_files_no_scm('sbin'); }
sub find_initd_files { shift->find_all_files_no_scm('init.d'); }
sub find_sysconf_files { shift->find_all_files_no_scm('sysconfig'); }
sub find_profiled_files { shift->find_all_files_no_scm('profile.d'); }
sub find_logrotated_files { shift->find_all_files_no_scm('logrotate.d'); }
sub find_all_files_no_scm {
my ($self, $dir) = @_;
my $sub = sub {
return ((($File::Find::name !~ /SVN/i) and
($File::Find::name !~ /GIT/i)) and
( -f $File::Find::name));
};
return { map {$_, $_} @{ $self->rscan_dir($dir, $sub) } };
}
# fix for scm files in the script directory
sub _files_in {
my ($self, $dir) = @_;
return unless -d $dir;
local *DH;
opendir DH, $dir or die "Can't read directory $dir: $!";
my @files;
while (defined (my $file = readdir DH)) {
my $full_path = File::Spec->catfile($dir, $file);
next if -d $full_path;
next if (($file =~ /SVN/i) or ($file =~ /GIT/i));
push @files, $full_path;
}
return @files;
}
EOC
my $builder = $class->new(
module_name => 'XAS::Spooler',
license => 'artistic_2',
dist_author => q{Kevin L. Esteb <kevin@kesteb.us>},
dist_version_from => 'lib/XAS/Spooler.pm',
release_status => 'stable',
configure_requires => {
'Module::Build' => 0,
},
build_requires => {
'Test::More' => 0,
},
meta_add => {
( run in 2.188 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )