feat: add db recreation target and update Laravel setup docs
This commit is contained in:
@@ -9,10 +9,13 @@ if [ ! -f "artisan" ]; then
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
if [ ! -f .composer-hash ] || ! sha1sum -c .composer-hash > /dev/null 2>&1; then
|
||||
gosu www mkdir -p .hashes
|
||||
|
||||
if [ ! -f .hashes/.composer-hash ] || ! sha1sum -c .hashes/.composer-hash; then
|
||||
echo ">> composer.json or composer.lock changed, installing dependencies..."
|
||||
gosu www composer install --optimize-autoloader --no-interaction
|
||||
sha1sum composer.json composer.lock > .composer-hash
|
||||
gosu www sha1sum composer.json composer.lock > .hashes/.composer-hash
|
||||
chown www: .hashes/.composer-hash
|
||||
else
|
||||
echo ">> Composer dependencies up to date (hash match), skipping install."
|
||||
fi
|
||||
@@ -36,17 +39,19 @@ fi
|
||||
echo ">> Running seeders..."
|
||||
gosu www php artisan db:seed --force
|
||||
|
||||
if composer show knuckleswtf/scribe > /dev/null 2>&1; then
|
||||
if composer show knuckleswtf/scribe >/dev/null 2>&1; then
|
||||
# Define all directories/files Scribe cares about
|
||||
SCRIBE_SOURCES="config/scribe.php routes/ app/Http/Controllers/ app/Http/Requests/ app/Models/"
|
||||
|
||||
# Create combined hash of all .php files in those paths
|
||||
CURRENT_HASH=$(find $SCRIBE_SOURCES -type f -name "*.php" -exec sha1sum {} + | sha1sum)
|
||||
|
||||
if [ ! -f .scribe-hash ] || [ "$CURRENT_HASH" != "$(cat .scribe-hash)" ]; then
|
||||
if [ ! -f .hashes/.scribe-hash ] || [ "$CURRENT_HASH" != "$(cat .hashes/.scribe-hash)" ]; then
|
||||
echo ">> Generating API documentation..."
|
||||
gosu www php artisan scribe:generate --no-interaction || true
|
||||
echo "$CURRENT_HASH" > .scribe-hash
|
||||
gosu www php artisan scribe:generate --no-interaction \
|
||||
|| echo ">> Warning: Scribe generation failed, continuing..."
|
||||
echo "$CURRENT_HASH" > .hashes/.scribe-hash
|
||||
chown www: .hashes/.scribe-hash
|
||||
else
|
||||
echo ">> API docs up to date, skipping Scribe generation."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user