File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Scraper
2
+
3
+ This is a scraper for automatically generating ` Api.php ` and ` Params.php ` files for the Rackspace provider.
4
+
5
+ It is run like so:
6
+
7
+ ``` bash
8
+ ./bin/generate ~ /projects/rst-files ~ /projects/rackspace/src/LoadBalancer/v1 Rackspace\\ LoadBalancer\\ v1
9
+ ```
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env php
2
+ <?php
3
+
4
+ function includeIfExists ($ file ) {
5
+ if (file_exists ($ file )) {
6
+ return include $ file ;
7
+ }
8
+ }
9
+
10
+ if ((!$ loader = includeIfExists (__DIR__ .'/../vendor/autoload.php ' )) && (!$ loader = includeIfExists (__DIR__ .'/../../../autoload.php ' ))) {
11
+ fwrite (STDERR ,
12
+ 'You must set up the project dependencies, run the following commands: ' .PHP_EOL .
13
+ 'curl -s http://getcomposer.org/installer | php ' .PHP_EOL .
14
+ 'php composer.phar install ' .PHP_EOL
15
+ );
16
+ exit (1 );
17
+ }
18
+
19
+ foreach (['inputDir ' , 'outputDir ' , 'namespace ' ] as $ key => $ name ) {
20
+ if (!isset ($ argv [$ key +1 ])) {
21
+ fwrite (STDERR ,
22
+ sprintf ("ERROR: You did not provide `%s'. Correct usage is ./bin/generate <inputDir> <outputDir> <namespace> \n" ,
23
+ $ name
24
+ ));
25
+ exit (1 );
26
+ }
27
+ }
28
+
29
+ $ finder = new \Scraper \Finder ($ argv [1 ], $ argv [2 ], $ argv [3 ]);
30
+ $ finder ->execute ();
You can’t perform that action at this time.
0 commit comments