diff --git a/.gitignore b/.gitignore index 90bc197..04816ec 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ test/Generated* test/InputFiles3* test/test1/* newdir2/ -/companion + /releases src/docto.exe *.rsm diff --git a/companion/app/Services/FileGatherService.php b/companion/app/Services/FileGatherService.php new file mode 100644 index 0000000..285e2da --- /dev/null +++ b/companion/app/Services/FileGatherService.php @@ -0,0 +1,26 @@ +each(function ($dir) use ($tempDirName, $tempDirPath){ + $inputfilesdir = \Illuminate\Support\Facades\Storage::path('inputfiles\\' . $dir ); + $cmd = "xcopy \"$inputfilesdir\" \"$tempDirPath\\\" "; + $result = \Illuminate\Support\Facades\Process::run( $cmd ); + echo "\n" . $result->output() . "\n"; + }); + return collect(Storage::listContents($tempDirName)); + } + } diff --git a/companion/config/services.php b/companion/config/services.php index 0ace530..d7fcf9a 100644 --- a/companion/config/services.php +++ b/companion/config/services.php @@ -14,6 +14,10 @@ | */ + 'docto' => [ + 'path' => env('DOCTO_PATH','..\\exe\\32\\docto.exe'), + ], + 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), diff --git a/companion/tests/Feature/Remove/RemoveInputFilePestTest.php b/companion/tests/Feature/Remove/RemoveInputFilePestTest.php index 8dd20b3..58d9bee 100644 --- a/companion/tests/Feature/Remove/RemoveInputFilePestTest.php +++ b/companion/tests/Feature/Remove/RemoveInputFilePestTest.php @@ -2,10 +2,7 @@ it('test deletes files from directory', function (){ // setup - if (\Illuminate\Support\Facades\Storage::exists('inputfilestemp')){ - \Illuminate\Support\Facades\Storage::deleteDirectory('inputfilestemp'); - } - $testinputfilesdir = \Illuminate\Support\Facades\Storage::path('inputfiles\\plain'); + // $testinputfilesdir = \Illuminate\Support\Facades\Storage::path('inputfiles\\plain'); $testinputfilesdir_temp = \Illuminate\Support\Facades\Storage::path('inputfilestemp'); @@ -13,12 +10,13 @@ $testoutputdir_temp = \Illuminate\Support\Facades\Storage::path('outputtemp2'); // echo "\n". $testoutputdir_temp; \Illuminate\Support\Facades\Storage::createDirectory('outputtemp2'); - $cmd = "xcopy \"$testinputfilesdir\" \"$testinputfilesdir_temp\\\" "; + // $cmd = "xcopy \"$testinputfilesdir\" \"$testinputfilesdir_temp\\\" "; // echo "\n". $cmd; - $result = \Illuminate\Support\Facades\Process::run( $cmd ); + // $result = \Illuminate\Support\Facades\Process::run( $cmd ); //echo "\n" . $result->output() . "\n"; - $dirfiles = collect(\Illuminate\Support\Facades\Storage::listContents('inputfilestemp')); + // $dirfiles = collect(\Illuminate\Support\Facades\Storage::listContents('inputfilestemp')); + $dirfiles = \App\Services\FileGatherService::GatherFiles(collect(['plain']),'inputfilestemp'); $docfiles = $dirfiles->filter(function ($item){ return str($item->path())->endsWith('.doc'); }); @@ -28,9 +26,8 @@ $dirfilescount = $dirfiles->count(); // do conversion - $doctocmd = <<output(); diff --git a/companion/tests/Feature/output/OutputDirCreationPestTest.php b/companion/tests/Feature/output/OutputDirCreationPestTest.php new file mode 100644 index 0000000..53b9066 --- /dev/null +++ b/companion/tests/Feature/output/OutputDirCreationPestTest.php @@ -0,0 +1,17 @@ +toBeTrue(); + +});