Skip to content

Commit

Permalink
Move the code to the standalone nqp script, keep test.pir to test it on
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed Mar 1, 2011
1 parent dc8384c commit c51a804
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

24 changes: 19 additions & 5 deletions Deprecations.pm → checker
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
class Deprecations;
#!/usr/bin/env parrot-nqp

INIT {
pir::load_bytecode("YAML/Tiny.pbc");
}

=begin method
=begin sub
method check($file_to_check, $deprecations_file)
sub check($file_to_check, $deprecations_file)
Scans $file_to_check for deprecations listen in $deprecations_file,
probably Parrot's C<api.yaml>. Returns a list of warnings (strings).
=end method
=end sub

method check_file($file, $yaml) {
sub check_file($file, $yaml) {
my $parser := YAML::Tiny.new;
my $api := $parser.read_string(slurp($yaml));
my @deprs;
Expand Down Expand Up @@ -48,4 +48,18 @@ method check_file($file, $yaml) {
return @deprecations;
}

MAIN(pir::getinterp()[2]);
sub MAIN(@ARGS) {
my $name := @ARGS.shift;
if pir::elements(@ARGS) {
for @ARGS -> $f {
say($f);
say(check_file($f, 'api.yaml').join("\n"));
}
} else {
say("Usage:");
print($name); say(" <file to check>");
}
}

# vim: ft=perl6

0 comments on commit c51a804

Please sign in to comment.