-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from maxmind/horgh/man-pages
Build man pages
- Loading branch information
Showing
7 changed files
with
109 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use warnings; | ||
|
||
sub main { | ||
_make_man( | ||
'geoipupdate', | ||
1, | ||
'build/geoipupdate.md', | ||
'build/geoipupdate.1', | ||
); | ||
_make_man( | ||
'GeoIP.conf', | ||
5, | ||
'build/GeoIP.conf.md', | ||
'build/GeoIP.conf.5', | ||
); | ||
return 1; | ||
} | ||
|
||
sub _make_man { | ||
my ($name, $section, $input, $output) = @_; | ||
|
||
my $tmp = 'build/tmp'; | ||
open my $fh, '>', $tmp or die $!; | ||
binmode $fh or die $!; | ||
print { $fh } "% $name($section)\n\n" or die $!; | ||
my $contents = _read($input); | ||
print { $fh } $contents or die $!; | ||
close $fh or die $!; | ||
|
||
system( | ||
'pandoc', | ||
'-s', | ||
'-f', 'markdown', | ||
'-t', 'man', | ||
$tmp, | ||
'-o', $output, | ||
) == 0 or die 'pandoc failed'; | ||
|
||
unlink $tmp or die $!; | ||
|
||
return; | ||
} | ||
|
||
sub _read { | ||
my ($file) = @_; | ||
open my $fh, '<', $file or die $!; | ||
binmode $fh or die $!; | ||
my $contents = ''; | ||
while (!eof($fh)) { | ||
my $line = <$fh>; | ||
die 'error reading' unless defined $line; | ||
$contents .= $line; | ||
} | ||
close $fh or die $!; | ||
return $contents; | ||
} | ||
|
||
exit(main() ? 0 : 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,9 @@ open. | |
* `-d`, `--database-directory` - Install databases to a custom directory. | ||
This is optional. If provided, it overrides any `DatabaseDirectory` set | ||
in the configuration file. | ||
* `-f`, `--config-file` - The configuration file to use. See | ||
[GeoIP.conf](GeoIP.conf.md) for more information. This is optional. It | ||
defaults to CONFFILE. | ||
* `-f`, `--config-file` - The configuration file to use. See GeoIP.conf and | ||
its documentation for more information. This is optional. It defaults to | ||
CONFFILE. | ||
* `-h`, `--help` - Display help and exit. | ||
* `--stack-trace` - Show a stack trace on any error message. This is | ||
primarily useful for debugging. | ||
|
@@ -63,7 +63,7 @@ variable. | |
## FILES | ||
|
||
* `GeoIP.conf` - Configuration file for GeoIP Update. See the | ||
[`GeoIP.conf` documentation](GeoIP.conf.md) for more information. | ||
`GeoIP.conf` documentation for more information. | ||
|
||
## AUTHOR | ||
|
||
|
@@ -75,11 +75,10 @@ Report bugs to [[email protected]](mailto:[email protected]). | |
|
||
## COPYRIGHT | ||
|
||
This software is Copyright (c) 2018 by MaxMind, Inc. | ||
This software is Copyright (c) 2018-2019 by MaxMind, Inc. | ||
|
||
This is free software, licensed under the [Apache License, Version | ||
2.0](../LICENSE-APACHE) or the [MIT License](../LICENSE-MIT), at your | ||
option. | ||
This is free software, licensed under the Apache License, Version 2.0 or | ||
the MIT License, at your option. | ||
|
||
## MORE INFORMATION | ||
|
||
|
@@ -89,4 +88,4 @@ for a subscription. | |
|
||
## SEE ALSO | ||
|
||
[`GeoIP.conf`](GeoIP.conf.md) | ||
`GeoIP.conf`(5) |