ソースを参照

Move spec file to share/

George S. Baugh 5 年 前
コミット
2319c7b2f7
7 ファイル変更10 行追加15 行削除
  1. 2 0
      MANIFEST.SKIP
  2. 2 2
      arg_order.js
  3. 1 1
      bin/playwright_server
  4. 1 8
      dist.ini
  5. 2 2
      lib/Playwright.pm
  6. 0 0
      share/api.json
  7. 2 2
      t/Playwright.t

+ 2 - 0
MANIFEST.SKIP

@@ -8,3 +8,5 @@ test.jpg
 test2.jpg
 package-lock.json
 node_modules/*
+example.pl
+arg_order.js

+ 2 - 2
arg_order.js

@@ -5,7 +5,7 @@
 const fs = require('fs');
 
 // Defines our interface
-let rawdata = fs.readFileSync('api.json');
+let rawdata = fs.readFileSync('share/api.json');
 let spec = JSON.parse(rawdata);
 
 for (var classname of Object.keys(spec)) {
@@ -17,4 +17,4 @@ for (var classname of Object.keys(spec)) {
     }
 }
 
-fs.writeFileSync('api.json',JSON.stringify(spec));
+fs.writeFileSync('share/api.json',JSON.stringify(spec));

+ 1 - 1
bin/playwright_server

@@ -10,7 +10,7 @@ const { chromium, firefox, webkit, devices } = require('playwright');
 const fs = require('fs');
 
 // Defines our interface
-let rawdata = fs.readFileSync('api.json');
+let rawdata = fs.readFileSync('share/api.json');
 let spec = JSON.parse(rawdata);
 
 const argv = yargs

+ 1 - 8
dist.ini

@@ -17,6 +17,7 @@ except = \.travis.yml
 [MetaYAML]
 [MetaJSON]
 [Readme]
+[InstallGuide]
 [ExtraTests]
 [ExecDir]
 [ShareDir]
@@ -28,14 +29,6 @@ except = \.travis.yml
 [MetaProvides::Package]
 
 [PodWeaver]
-finder = :NotTestSRD
-
-; skip the Test::SRD modules, their attribution is non-standard
-[FileFinder::ByName / :NotTestSRD]
-dir = lib
-match = \.pm$
-skip = Test
-
 [Git::Contributors]
 
 ; XXX can't tidy this mess yet

+ 2 - 2
lib/Playwright.pm

@@ -41,7 +41,7 @@ use feature qw{signatures state};
 Perl interface to a lightweight node.js webserver that proxies commands runnable by Playwright.
 Checks and automatically installs a copy of the node dependencies in the local folder if needed.
 
-Currently understands commands you can send to all the playwright classes defined in api.json.
+Currently understands commands you can send to all the playwright classes defined in api.json (installed wherever your OS puts shared files for CPAN distributions).
 
 See L<https://playwright.dev/#version=master&path=docs%2Fapi.md&q=>
 for what the classes do, and their usage.
@@ -142,7 +142,7 @@ sub _check_node($path2here, $decoder) {
 
 sub _check_and_build_spec {
     my $path2here = File::Basename::dirname(Cwd::abs_path($INC{'Playwright.pm'}));
-    my $specfile = "$path2here/../api.json";
+    my $specfile = "$path2here/../share/api.json";
     confess("Can't locate Playwright specification in '$specfile'!") unless -f $specfile;
 
     my $spec_raw = File::Slurper::read_text($specfile);

+ 0 - 0
api.json → share/api.json


+ 2 - 2
t/Playwright.t

@@ -18,11 +18,11 @@ my $path2here = File::Basename::dirname(Cwd::abs_path($INC{'Playwright.pm'}));
 
 subtest "_check_and_build_spec" => sub {
     #Simulate file not existing
-    my $json = Test::MockFile->file("$path2here/../api.json");
+    my $json = Test::MockFile->file("$path2here/../share/api.json");
     like( dies { Playwright::_check_and_build_spec() }, qr/specification/i, "Nonexistant api.json throws");
 
     undef $json;
-    $json = Test::MockFile->file("$path2here/../api.json", '{"a":"b"}');
+    $json = Test::MockFile->file("$path2here/../share/api.json", '{"a":"b"}');
     my ($path) = Playwright::_check_and_build_spec();
     is($Playwright::spec, { a => 'b'}, "Spec parsed correctly");
     is($path,$path2here, "Path to module built correctly");