Skip to content

Commit

Permalink
Default to META.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Nov 28, 2011
1 parent 52e13e4 commit 8e009dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -3,6 +3,8 @@ Revision history for Perl extension PGXN-Meta-Validator.
0.15.0
- Added `version_string` class method and made use of it in the
`validate_pgxn_meta` script.
- The command-line app now defaults to a file named `META.json` in the
current directory if no file name is passed.

0.14.0 2011-08-31T03:44:57Z
- Added tests to protect against autovivication of keys.
Expand Down
14 changes: 10 additions & 4 deletions bin/validate_pgxn_meta
Expand Up @@ -23,7 +23,7 @@ if ($version) {
exit;
}

my $file = shift or _pod2usage();
my $file = shift || -e 'META.json' ? 'META.json' : _pod2usage();
die "$file is not a valid, readable filename\n" unless -r $file;

my $pmv = PGXN::Meta::Validator->load_file($file);
Expand All @@ -38,13 +38,12 @@ print "$file is invalid. Errors:\n ",
"\n";
exit 1;


sub _pod2usage {
require Pod::Usage;

my $sections = 'Usage|Options';
if ($0 =~ /pgxn-validate-meta/) {
print "Usage:\n pgxn validate-meta META.json\n\n";
print "Usage:\n pgxn validate-meta\n pgxn validate-meta mumble.json\n\n";
$sections = 'Options';
}
Pod::Usage::pod2usage(
Expand All @@ -65,14 +64,21 @@ validate_pgxn_meta - Validate the structure of a PGXN F<META.json> file
=head1 Usage
validate_pgxn_meta META.json
validate_pgxn_meta
validate_pgxn_meta mumble.json
=head1 Options
-h --help Print a usage statement and exit.
-M --man Print the complete documentation and exit.
-v --version Print the version number and exit.
=head1 Description
Validates a PGXN F<META.json> file against the PGXN meta specification. If a
file name is passed, that file will be validated. Otherwise, if a file named
F<META.json> exists in the current directory, it will be validated.
=head1 Output
If F<META.json> valid, the output will be:
Expand Down

0 comments on commit 8e009dd

Please sign in to comment.