mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-02 01:21:14 +00:00
Use built in mechanism to generate scripts with docs rather than home-brew routine
This commit is contained in:
parent
671c231992
commit
5b71abdcce
10 changed files with 90 additions and 45 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ MYMETA.json
|
||||||
MYMETA.yml
|
MYMETA.yml
|
||||||
Makefile
|
Makefile
|
||||||
_build/
|
_build/
|
||||||
|
bin
|
||||||
blib/
|
blib/
|
||||||
cover_db/
|
cover_db/
|
||||||
pm_to_blib
|
pm_to_blib
|
||||||
|
|
83
Build.PL
83
Build.PL
|
@ -45,46 +45,46 @@ EOF
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub ACTION_build {
|
#%# sub ACTION_build {
|
||||||
my ($self, @args) = @_;
|
#%# my ($self, @args) = @_;
|
||||||
|
#%#
|
||||||
print "Building pod files",$/;
|
#%# print "Building pod files",$/;
|
||||||
|
#%#
|
||||||
# my $common_file = File::Slurp::read_file('pod_data/common_file');
|
#%## my $common_file = File::Slurp::read_file('pod_data/common_file');
|
||||||
# die "Failed to read 'pod_data/common_file'" unless($common_file);
|
#%## die "Failed to read 'pod_data/common_file'" unless($common_file);
|
||||||
|
#%#
|
||||||
# Each file in bin/ should have a file within pod_data.
|
#%# # Each file in bin/ should have a file within pod_data.
|
||||||
# If not, there is a problem.
|
#%# # If not, there is a problem.
|
||||||
my @files=glob('bin/*');
|
#%# my @files=glob('bin/*');
|
||||||
foreach my $binfile (@files) {
|
#%# foreach my $binfile (@files) {
|
||||||
# ignore any dirs or such in the bin directory
|
#%# # ignore any dirs or such in the bin directory
|
||||||
next unless(-f $binfile && -x $binfile);
|
#%# next unless(-f $binfile && -x $binfile);
|
||||||
|
#%#
|
||||||
# (my $podfile = $binfile) =~ s!bin!pod_data!;
|
#%## (my $podfile = $binfile) =~ s!bin!pod_data!;
|
||||||
# warn "checking $podfile",$/;
|
#%## warn "checking $podfile",$/;
|
||||||
#
|
#%##
|
||||||
# if(!-f $podfile) {
|
#%## if(!-f $podfile) {
|
||||||
# warn "$podfile does not exist",$/;
|
#%## warn "$podfile does not exist",$/;
|
||||||
# next;
|
#%## next;
|
||||||
# }
|
#%## }
|
||||||
# my $pod = read_file( $podfile );
|
#%## my $pod = read_file( $podfile );
|
||||||
# warn "Unable to read '$podfile'" unless ($pod);
|
##%# warn "Unable to read '$podfile'" unless ($pod);
|
||||||
#
|
#%##
|
||||||
# $pod =~ s/%FILES%/$common_file/;
|
#%## $pod =~ s/%FILES%/$common_file/;
|
||||||
#
|
#%##
|
||||||
# my $options = qx{ $binfile -h 2>&1 };
|
#%## my $options = qx{ $binfile -h 2>&1 };
|
||||||
# warn "Unable to run '$binfile -h'" unless ($options);
|
#%## warn "Unable to run '$binfile -h'" unless ($options);
|
||||||
|
#%#
|
||||||
my $cmd="$binfile --generate-pod 2>&1";
|
#%# my $cmd="$binfile --generate-pod 2>&1";
|
||||||
warn "Running: $cmd",$/;
|
#%# warn "Running: $cmd",$/;
|
||||||
my $pod = qx { $cmd };
|
#%# my $pod = qx { $cmd };
|
||||||
die "Failed to generate POD" if($?);
|
#%# die "Failed to generate POD" if($?);
|
||||||
write_file("${binfile}.pod", $pod);
|
#%# write_file("${binfile}.pod", $pod);
|
||||||
|
#%#
|
||||||
}
|
#%# }
|
||||||
|
#%#
|
||||||
$self->SUPER::ACTION_build;
|
#%# $self->SUPER::ACTION_build;
|
||||||
}
|
#%# }
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -128,6 +128,9 @@ my $build = $class->new(
|
||||||
create_makefile_pl => 'traditional',
|
create_makefile_pl => 'traditional',
|
||||||
script_files => 'bin',
|
script_files => 'bin',
|
||||||
get_options => { changes => { type => '=s' }, },
|
get_options => { changes => { type => '=s' }, },
|
||||||
|
PL_files => {
|
||||||
|
'bin_PL/_build_docs' => [],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
$build->create_build_script;
|
$build->create_build_script;
|
||||||
|
|
10
MANIFEST
10
MANIFEST
|
@ -1,9 +1,9 @@
|
||||||
AUTHORS
|
AUTHORS
|
||||||
bin/ccon
|
bin_PL/ccon
|
||||||
bin/crsh
|
bin_PL/crsh
|
||||||
bin/cscp.x
|
bin_PL/cscp.x
|
||||||
bin/cssh
|
bin_PL/cssh
|
||||||
bin/ctel
|
bin_PL/ctel
|
||||||
Build.PL
|
Build.PL
|
||||||
Changes
|
Changes
|
||||||
lib/App/ClusterSSH.pm
|
lib/App/ClusterSSH.pm
|
||||||
|
|
|
@ -14,3 +14,4 @@ pm_to_blib
|
||||||
.*\.swp$
|
.*\.swp$
|
||||||
^TOAD$
|
^TOAD$
|
||||||
^WIP_TASKS$
|
^WIP_TASKS$
|
||||||
|
^bin/
|
||||||
|
|
40
bin_PL/_build_docs
Executable file
40
bin_PL/_build_docs
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use FindBin qw($Bin $Script);
|
||||||
|
|
||||||
|
chdir $Bin || die "Unable to chdir into $Bin: $!";
|
||||||
|
|
||||||
|
my $bindir="$Bin/../bin";
|
||||||
|
|
||||||
|
if(! -d $bindir) {
|
||||||
|
mkdir $bindir || die "Could not mkdir $bindir: $!";
|
||||||
|
}
|
||||||
|
|
||||||
|
for my $source (glob("*")) {
|
||||||
|
my $dest="$bindir/$source";
|
||||||
|
|
||||||
|
next if($source =~ m/$Script/);
|
||||||
|
next if($source =~ m/\.x$/);
|
||||||
|
|
||||||
|
print "Generating: $source",$/;
|
||||||
|
|
||||||
|
if($dest) {
|
||||||
|
chmod(0777, $dest) || die "Could not chmod $dest for removing: $!";
|
||||||
|
}
|
||||||
|
|
||||||
|
open(my $sfh, '<', $source) || die "Could not open $source for reading: $!";
|
||||||
|
open(my $dfh, '>', $dest ) || die "Could not open $dest for writing: $!";
|
||||||
|
print $dfh $_ while(<$sfh>);
|
||||||
|
close($sfh);
|
||||||
|
|
||||||
|
print $dfh "\n\n__END__\n\n";
|
||||||
|
|
||||||
|
my $pod= qx{ ./$source --generate-pod };
|
||||||
|
print $dfh $pod;
|
||||||
|
close($dfh);
|
||||||
|
|
||||||
|
chmod(0555, $dest) || die "Could not chmod $dest: $!";
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue