Compare commits
3 commits
81119ec2d5
...
6fecb2bcaa
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fecb2bcaa | |||
| 97267f8709 | |||
| 9c83c0efff |
2 changed files with 52 additions and 27 deletions
|
|
@ -2,6 +2,9 @@ yapfaq 1.0.0 (unreleased)
|
||||||
* Complete rewrite.
|
* Complete rewrite.
|
||||||
* Add POD.
|
* Add POD.
|
||||||
* Fix file handling (UTF8 mode).
|
* Fix file handling (UTF8 mode).
|
||||||
|
* Show next posting date if posting is not due.
|
||||||
|
* Add --simulation mode.
|
||||||
|
* Update examples in POD.
|
||||||
|
|
||||||
yapfaq 0.10 (unreleased)
|
yapfaq 0.10 (unreleased)
|
||||||
* Add: Charset definition.
|
* Add: Charset definition.
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,13 @@ $Config{'nntp-server'} = $ENV{'NNTPSERVER'} if ($ENV{'NNTPSERVER'});
|
||||||
$Config{'nntp-port'} = $ENV{'NNTPPORT'} if ($ENV{'NNTPPORT'});
|
$Config{'nntp-port'} = $ENV{'NNTPPORT'} if ($ENV{'NNTPPORT'});
|
||||||
|
|
||||||
### read commandline options
|
### read commandline options
|
||||||
my ($OptProject,$OptForce,$OptTest,$OptNewsgroup,$OptOutput);
|
my ($OptProject,$OptForce,$OptTest,$OptNewsgroup,$OptOutput,$OptSimulation);
|
||||||
GetOptions ('p|project=s' => \$OptProject,
|
GetOptions ('p|project=s' => \$OptProject,
|
||||||
'f|force' => \$OptForce,
|
'f|force' => \$OptForce,
|
||||||
't|test' => \$OptTest,
|
't|test' => \$OptTest,
|
||||||
'n|newsgroup=s' => \$OptNewsgroup,
|
'n|newsgroup=s' => \$OptNewsgroup,
|
||||||
'o|output' => \$OptOutput,
|
'o|output' => \$OptOutput,
|
||||||
|
's|simulation' => \$OptSimulation,
|
||||||
'datadir=s' => \$Config{'datadir'},
|
'datadir=s' => \$Config{'datadir'},
|
||||||
'nntp-server=s' => \$Config{'nntp-server'},
|
'nntp-server=s' => \$Config{'nntp-server'},
|
||||||
'nntp-port=s' => \$Config{'nntp-port'},
|
'nntp-port=s' => \$Config{'nntp-port'},
|
||||||
|
|
@ -107,6 +108,12 @@ GetOptions ('p|project=s' => \$OptProject,
|
||||||
'h|help' => \&ShowPOD,
|
'h|help' => \&ShowPOD,
|
||||||
'V|version' => \&ShowVersion) or &ShowUsage;
|
'V|version' => \&ShowVersion) or &ShowUsage;
|
||||||
|
|
||||||
|
# -s implies -t and -v
|
||||||
|
if ($OptSimulation) {
|
||||||
|
$OptTest = 1;
|
||||||
|
$Config{'verbose'} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
### create list of @Projects from $Config{'datadir'} unless -p is set
|
### create list of @Projects from $Config{'datadir'} unless -p is set
|
||||||
my @Projects;
|
my @Projects;
|
||||||
if (!$OptProject) {
|
if (!$OptProject) {
|
||||||
|
|
@ -135,6 +142,7 @@ foreach (@Projects) {
|
||||||
# @Posting will be empty ('') if not due
|
# @Posting will be empty ('') if not due
|
||||||
my @Posting = &BuildPosting($_);
|
my @Posting = &BuildPosting($_);
|
||||||
next if !$#Posting;
|
next if !$#Posting;
|
||||||
|
next if $OptSimulation;
|
||||||
|
|
||||||
# save Message-ID
|
# save Message-ID
|
||||||
my $LastMID;
|
my $LastMID;
|
||||||
|
|
@ -493,7 +501,7 @@ sub BuildPosting {
|
||||||
$_ =~ s/^Posting-Frequency:\s+//i;
|
$_ =~ s/^Posting-Frequency:\s+//i;
|
||||||
$PostingFrequency = $_;
|
$PostingFrequency = $_;
|
||||||
$_ = '';
|
$_ = '';
|
||||||
print "- Posting-Frequency set to $PostingFrequency.\n" if $Config{'debug'};
|
print "- Posting-Frequency set to $PostingFrequency from header.\n" if $Config{'debug'};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -505,13 +513,15 @@ sub BuildPosting {
|
||||||
|
|
||||||
# default to 1 month if no (valid) Posting-Frequency is set
|
# default to 1 month if no (valid) Posting-Frequency is set
|
||||||
$PostingFrequency = '1m' if $PostingFrequency !~ /^\d+[dwmy]$/;
|
$PostingFrequency = '1m' if $PostingFrequency !~ /^\d+[dwmy]$/;
|
||||||
|
my $NextPosted = &AddDuration(&ParseDate($LastPosted),$PostingFrequency) if $LastPosted;
|
||||||
|
|
||||||
# check if posting is due
|
# check if posting is due
|
||||||
print "- Posting has been forced.\n" if $Config{'debug'} && $OptForce;
|
print "- Posting has been forced.\n" if $Config{'debug'} && $OptForce;
|
||||||
if ($OptForce or (!$LastPosted) or ($LastPosted && &AddDuration(&ParseDate($LastPosted),$PostingFrequency) <= DateTime->now)) {
|
if ($OptForce or (!$LastPosted) or ($LastPosted && $NextPosted <= DateTime->now)) {
|
||||||
print "... is due and will be posted.\n" if $Config{'verbose'} or $Config{'debug'};
|
print "... is due and will be posted.\n" if $Config{'verbose'} or $Config{'debug'};
|
||||||
} else {
|
} else {
|
||||||
print "... is not due.\n" if $Config{'verbose'} or $Config{'debug'};
|
printf ("... is not due (next post at %s).\n", $NextPosted->strftime('%Y-%m-%d'))
|
||||||
|
if $Config{'verbose'} or $Config{'debug'};
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -578,7 +588,7 @@ yapfaq - Post FAQs to Usenet I<(yet another postfaq)>
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
B<yapfaq> [B<-Vhcfto>] [B<-p> I<project name>[B<-n> I<newsgroup>] [OPTIONS]
|
B<yapfaq> [B<-cfhotsV>] [B<-p> I<project name>[B<-n> I<newsgroup>] [OPTIONS]
|
||||||
|
|
||||||
=head1 REQUIREMENTS
|
=head1 REQUIREMENTS
|
||||||
|
|
||||||
|
|
@ -840,6 +850,11 @@ projects.
|
||||||
|
|
||||||
Display this man page and exit.
|
Display this man page and exit.
|
||||||
|
|
||||||
|
=item B<-s>, B<--simulation>
|
||||||
|
|
||||||
|
Simulation mode. Don't post, just show which projects would be due.
|
||||||
|
Implies B<--test> and B<--verbose>.
|
||||||
|
|
||||||
=item B<-t>, B<--test>
|
=item B<-t>, B<--test>
|
||||||
|
|
||||||
Test mode. Don't update project status (time and Message-ID of last
|
Test mode. Don't update project status (time and Message-ID of last
|
||||||
|
|
@ -868,34 +883,41 @@ Post all FAQs that are due for posting:
|
||||||
|
|
||||||
yapfaq.pl
|
yapfaq.pl
|
||||||
|
|
||||||
You may run this command daily from B<cron>.
|
You may run this command daily from B<cron>. If you add "-v", you'll
|
||||||
|
get a report mailed which FAQs have been posted and which were not
|
||||||
|
due.
|
||||||
|
|
||||||
Do a dry run, showing which FAQs would be posted and print them on
|
Pipe all FAQs that are due for posting to I<inews> from INN instead:
|
||||||
STDOUT:
|
|
||||||
|
|
||||||
yapfaq.pl -t -v -o
|
|
||||||
(or yapfaq.pl -tvo)
|
|
||||||
|
|
||||||
The same, with debugging output:
|
|
||||||
|
|
||||||
yapfaq.pl -tdo
|
|
||||||
|
|
||||||
Force a test post of your I<example> text to I<alt.test>, even if
|
|
||||||
the text is not due to be posted:
|
|
||||||
|
|
||||||
yapfaq.pl -t -f -n alt.test
|
|
||||||
|
|
||||||
The same, with debugging output:
|
|
||||||
|
|
||||||
yapfaq.pl -tfdn alt.test
|
|
||||||
|
|
||||||
|
|
||||||
Pipe all FAQs (that are due for posting) to I<inews> from INN:
|
|
||||||
|
|
||||||
yapfaq.pl -o | inews
|
yapfaq.pl -o | inews
|
||||||
|
|
||||||
You may run this command daily from B<cron>, too.
|
You may run this command daily from B<cron>, too.
|
||||||
|
|
||||||
|
Show which FAQs are due for posting and the next due dates for those
|
||||||
|
that are not:
|
||||||
|
|
||||||
|
yapfaq.pl -s
|
||||||
|
|
||||||
|
Do a test run of your I<example> text and and print it on STDOUT
|
||||||
|
(whether ist is due or not):
|
||||||
|
|
||||||
|
yapfaq.pl -t -f -o -p example
|
||||||
|
(or yapfaq.pl -tvop example)
|
||||||
|
|
||||||
|
The same, with debugging output:
|
||||||
|
|
||||||
|
yapfaq.pl -tdop example
|
||||||
|
|
||||||
|
Force a test post of your I<example> text to I<alt.test>, even if
|
||||||
|
the text is not due to be posted (same as before, just replace "-o"
|
||||||
|
by "-n alt-test"):
|
||||||
|
|
||||||
|
yapfaq.pl -t -f -p example -n alt.test
|
||||||
|
|
||||||
|
The same, with debugging output:
|
||||||
|
|
||||||
|
yapfaq.pl -tfdp example -n alt.test
|
||||||
|
|
||||||
=head1 ENVIRONMENT
|
=head1 ENVIRONMENT
|
||||||
|
|
||||||
=over 2
|
=over 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue