Files
lego-instructions-manager/fresh_git_upload.bat

233 lines
5.9 KiB
Batchfile

@echo off
echo ===============================================
echo LEGO Instructions Manager - Fresh Git Upload
echo ===============================================
echo.
REM Check if we're in the right directory
if not exist "run.py" (
echo ERROR: run.py not found!
echo Please run this script from E:\LIM directory
pause
exit /b 1
)
echo Cleaning up any existing git...
if exist ".git" (
rmdir /s /q .git
echo Old .git folder removed
)
echo.
echo ===============================================
echo Step 1: Creating .gitignore
echo ===============================================
(
echo # Python
echo __pycache__/
echo *.py[cod]
echo *.pyo
echo *.pyd
echo .Python
echo env/
echo venv/
echo ENV/
echo build/
echo dist/
echo *.egg-info/
echo.
echo # Flask
echo instance/
echo .webassets-cache
echo.
echo # Environment
echo .env
echo .venv
echo.
echo # Database
echo *.db
echo *.sqlite
echo *.sqlite3
echo.
echo # Uploads - user data
echo app/static/uploads/
echo.
echo # IDE
echo .vscode/
echo .idea/
echo *.swp
echo *.swo
echo *~
echo.
echo # OS
echo .DS_Store
echo Thumbs.db
echo.
echo # Logs
echo *.log
) > .gitignore
echo .gitignore created
echo.
echo ===============================================
echo Step 2: Initializing Git repository
echo ===============================================
git init
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Git initialization failed!
echo Make sure Git is installed: https://git-scm.com/download/win
pause
exit /b 1
)
echo Git initialized successfully
echo.
echo ===============================================
echo Step 3: Configuring Git user
echo ===============================================
git config user.name "jessikitty"
git config user.email "jess.rogerson.29@outlook.com"
echo Git user configured
echo.
echo ===============================================
echo Step 4: Adding all files
echo ===============================================
git add .
echo Files staged
echo.
echo ===============================================
echo Step 5: Creating initial commit
echo ===============================================
git commit -m "Initial commit - LEGO Instructions Manager v1.5.0
Complete web application for managing LEGO instruction manuals.
Features:
- User authentication and multi-user support
- Set management (official sets and MOCs)
- PDF and image instruction upload
- PDF viewer with thumbnails
- Cover image upload and display
- Extra files storage (40+ file types)
- Bulk import from Brickset API
- Admin panel with user management
- Search and filtering
- Responsive Bootstrap 5 UI
Version: v1.5.0
Built with Flask, SQLAlchemy, and love for LEGO!"
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Git commit failed!
pause
exit /b 1
)
echo Commit created
echo.
echo ===============================================
echo Step 6: Setting up main branch
echo ===============================================
git branch -M main
echo Main branch set
echo.
echo ===============================================
echo Step 7: Adding Gitea remote
echo ===============================================
git remote add origin https://gitea.hideawaygaming.com.au/jessikitty/lego-instructions-manager.git
if %ERRORLEVEL% NEQ 0 (
echo Note: Remote might already exist, removing and re-adding...
git remote remove origin
git remote add origin https://gitea.hideawaygaming.com.au/jessikitty/lego-instructions-manager.git
)
echo Remote added
echo.
echo ===============================================
echo Step 8: Pushing to Gitea
echo ===============================================
echo.
echo You will be prompted for your Gitea credentials:
echo.
echo Username: jessikitty
echo Password: (your Gitea password or access token)
echo.
echo For better security, use an access token:
echo https://gitea.hideawaygaming.com.au/user/settings/applications
echo.
pause
echo.
echo Pushing to Gitea...
git push -u origin main --force
echo.
if %ERRORLEVEL% EQU 0 (
echo ===============================================
echo SUCCESS! Project uploaded to Gitea!
echo ===============================================
echo.
echo Your repository is now live at:
echo https://gitea.hideawaygaming.com.au/jessikitty/lego-instructions-manager
echo.
echo What was uploaded:
echo - All Python code (app/, *.py)
echo - Templates and static files
echo - Configuration files
echo - Migration scripts
echo - Documentation
echo.
echo What was excluded (by .gitignore):
echo - Database files (instance/, *.db)
echo - Environment variables (.env)
echo - Uploads folder (user data)
echo - Virtual environment (venv/)
echo - Python cache (__pycache__/)
echo.
echo ===============================================
echo Next steps:
echo ===============================================
echo 1. View your repo in browser
echo 2. Clone it on other machines
echo 3. Start collaborating!
echo.
) else (
echo ===============================================
echo ERROR: Failed to push to Gitea!
echo ===============================================
echo.
echo Common issues and fixes:
echo.
echo 1. Authentication failed:
echo - Check your username: jessikitty
echo - Verify your password
echo - Try using an access token instead
echo.
echo 2. Network error:
echo - Check internet connection
echo - Verify Gitea server is running
echo - Try: https://gitea.hideawaygaming.com.au
echo.
echo 3. Repository issues:
echo - Make sure repository exists on Gitea
echo - Check repository permissions
echo.
echo To retry, just run this script again!
echo.
)
echo ===============================================
echo Git Information
echo ===============================================
echo.
echo Repository: https://gitea.hideawaygaming.com.au/jessikitty/lego-instructions-manager
echo Remote:
git remote -v
echo.
echo Recent commits:
git log --oneline -5
echo.
pause