knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.75k stars 314 forks source link

2.7.4 causing problems with scribe:generate #223

Closed mirzazeyrek closed 3 years ago

mirzazeyrek commented 3 years ago

I have updated to 2.7.4 today and noticed a problem with php artisan scribe:generate --force

I'm using php 8.0.6 and laravel 8.42.1

ErrorException

  rename(public/docs/,/home/forge/xxxx/releases/20210527155728/public/vendor/scribe/): Directory not empty

  at vendor/knuckleswtf/scribe/src/Writing/Writer.php:274
    270▕
    271▕         // Move assets from public/docs to $publicDirectory/vendor/scribe
    272▕         // We need to do this delete first, otherwise move won't work if folder exists
    273▕         Utils::deleteDirectoryAndContents("$publicDirectory/vendor/scribe/");
  ➜ 274▕         rename("{$this->staticTypeOutputPath}/", "$publicDirectory/vendor/scribe/");
    275▕
    276▕         $contents = file_get_contents("$this->laravelTypeOutputPath/index.blade.php");
    277▕
    278▕         // Rewrite links to go through Laravel
shalvah commented 3 years ago

Updated to 2.7.5.

(Always try updating before opening an issue. It's in the troubleshooting guidelines.)

mirzazeyrek commented 3 years ago

2.7.5 also has the same issue:

    "knuckleswtf/scribe": "^2.7.5",
  rename(public/docs/,/Users/mirzazeyrek/Desktop/xxx/public/vendor/scribe/): Directory not empty

  at vendor/knuckleswtf/scribe/src/Writing/Writer.php:274
    270▕ 
    271▕         // Move assets from public/docs to $publicDirectory/vendor/scribe
    272▕         // We need to do this delete first, otherwise move won't work if folder exists
    273▕         Utils::deleteDirectoryAndContents("$publicDirectory/vendor/scribe/");
  ➜ 274▕         rename("{$this->staticTypeOutputPath}/", "$publicDirectory/vendor/scribe/");

FYI @shalvah

Also sorry for using this version at the time I noticed the problem 2.7.4 was the latest today.

shalvah commented 3 years ago

Hmmm.... Are you sure you did a composer update? Because the problem is the previous line not deleting the folder first, which shouldn't happen anymore.

Check your vendor folder. What are the contents of that deleteDirectory... method?

mirzazeyrek commented 3 years ago

yes I have deleted the entire vendor folder and composer.lock and did a fresh install but still the command is failing after and saying :

Directory not empty

  at vendor/knuckleswtf/scribe/src/Writing/Writer.php:274
    270▕ 
mirzazeyrek commented 3 years ago

Are you mentioning deleting the public/vendor folder manually ? Then it works but to reproduce the issue perhaps you need to try this 2 times. 1st one works 2nd one fails:

"php artisan scribe:generate --force"

shalvah commented 3 years ago

Hmm... Alright, will look into it.

shalvah commented 3 years ago

Oh, I think I know what the problem is...🤔

shalvah commented 3 years ago

Try 2.7.6. Should be fixed now.

mirzazeyrek commented 3 years ago

Yeap now it works ! Thank you for the quick fix.