Merge pull request #45 from Thepathakarpit/main

Crossplatform automated setup using bash and batch filed
This commit is contained in:
Federico 2024-08-15 21:35:58 +01:00 committed by GitHub
commit 342c2cfef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 92 additions and 0 deletions

49
setup.bat Normal file
View File

@ -0,0 +1,49 @@
@echo off
setlocal
REM Define paths and URLs
set REPO_URL=https://github.com/feder-cr/LinkedIn_AIHawk_automatic_job_application
set REPO_DIR=LinkedIn_AIHawk_automatic_job_application
set PYTHON_EXE=python
set CONFIG_EXAMPLE=data_folder_example
REM Check if Python is installed
where %PYTHON_EXE% >nul 2>&1
if %errorlevel% neq 0 (
echo Python is not installed. Downloading and installing Python...
start https://www.python.org/downloads/
echo Please install Python manually and run this script again.
exit /b 1
)
REM Clone the repository
if exist %REPO_DIR% (
echo Repository already exists. Pulling latest changes...
cd %REPO_DIR%
git pull
cd ..
) else (
echo Cloning the repository...
git clone %REPO_URL%
cd %REPO_DIR%
)
REM Install Python packages and ChromeDriver
echo Installing required Python packages and ChromeDriver...
%PYTHON_EXE% -m pip install -r requirements.txt
%PYTHON_EXE% -m pip install webdriver-manager
REM Copy example configuration files
echo Setting up configuration files...
if not exist data_folder (
mkdir data_folder
)
xcopy /E /I %CONFIG_EXAMPLE% data_folder\
echo Please update data_folder\secrets.yaml and data_folder\config.yaml with your credentials and preferences.
REM Run the application with ChromeDriver managed automatically
echo Running the application...
%PYTHON_EXE% -c "from webdriver_manager.chrome import ChromeDriverManager; from selenium import webdriver; driver = webdriver.Chrome(ChromeDriverManager().install()); driver.get('https://www.google.com');"
endlocal
pause

43
setup.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# Define paths and URLs
REPO_URL="https://github.com/feder-cr/LinkedIn_AIHawk_automatic_job_application"
REPO_DIR="LinkedIn_AIHawk_automatic_job_application"
PYTHON_EXE="python3"
CONFIG_EXAMPLE="data_folder_example"
# Check if Python is installed
if ! command -v $PYTHON_EXE &> /dev/null
then
echo "Python is not installed. Please install Python and rerun the script."
exit 1
fi
# Clone the repository
if [ -d "$REPO_DIR" ]; then
echo "Repository already exists. Pulling latest changes..."
cd $REPO_DIR
git pull
cd ..
else
echo "Cloning the repository..."
git clone $REPO_URL
cd $REPO_DIR
fi
# Install Python packages and ChromeDriver
echo "Installing required Python packages and ChromeDriver..."
$PYTHON_EXE -m pip install -r requirements.txt
$PYTHON_EXE -m pip install webdriver-manager
# Copy example configuration files
echo "Setting up configuration files..."
mkdir -p data_folder
cp -r $CONFIG_EXAMPLE/* data_folder/
echo "Please update data_folder/secrets.yaml and data_folder/config.yaml with your credentials and preferences."
# Run the application with ChromeDriver managed automatically
echo "Running the application..."
$PYTHON_EXE -c "from webdriver_manager.chrome import ChromeDriverManager; from selenium import webdriver; driver = webdriver.Chrome(ChromeDriverManager().install()); driver.get('https://www.google.com');"
exit 0