Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitAuto: [FEATURE] Installation script for this template (PowerShell and Bash) #45

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Param(
[string]$ProjectName,
[string]$Namespace,
[string]$SonarCloudUrl,
[string]$HealthChecksId
)

Write-Host "Setting up project: $ProjectName"

# Update .wakatime and README.md
(Get-Content .wakatime-project) -replace 'TemplateProject', $ProjectName | Set-Content .wakatime-project
(Get-Content README.md) -replace 'TemplateProject', $ProjectName | Set-Content README.md

# Update composer.json
(Get-Content composer.json) -replace 'TemplateNamespace', $Namespace | Set-Content composer.json

# Update Healthchecks.io badge
Write-Host "Please create a HealthChecks.io account if needed."
(Get-Content README.md) -replace 'HealthChecksId', $HealthChecksId | Set-Content README.md

# Update SonarCloud URL
(Get-Content README.md) -replace 'SonarCloudUrl', $SonarCloudUrl | Set-Content README.md

# Run composer install
Write-Host "Running composer install..."
composer install

Write-Host "Project setup complete."

# Additional PHP setup tasks
Write-Host "Performing additional PHP setup tasks..."
# Add any additional setup commands here

Write-Host "Setup finished successfully."
41 changes: 41 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

echo "Enter the project name:"
read project_name

Check notice on line 4 in install.sh

View check run for this annotation

codefactor.io / CodeFactor

install.sh#L4

read without -r will mangle backslashes. (SC2162)

echo "Enter the default namespace:"
read namespace

Check notice on line 7 in install.sh

View check run for this annotation

codefactor.io / CodeFactor

install.sh#L7

read without -r will mangle backslashes. (SC2162)

echo "Enter the SonarCloud URL:"
read sonarcloud_url

Check notice on line 10 in install.sh

View check run for this annotation

codefactor.io / CodeFactor

install.sh#L10

read without -r will mangle backslashes. (SC2162)

echo "Enter the HealthChecks.io ID:"
read healthchecks_id

Check notice on line 13 in install.sh

View check run for this annotation

codefactor.io / CodeFactor

install.sh#L13

read without -r will mangle backslashes. (SC2162)

echo "Setting up project: $project_name"

# Update .wakatime and README.md
sed -i "s/TemplateProject/$project_name/g" .wakatime-project
sed -i "s/TemplateProject/$project_name/g" README.md

# Update composer.json
sed -i "s/TemplateNamespace/$namespace/g" composer.json

# Update Healthchecks.io badge
echo "Please create a HealthChecks.io account if needed."
sed -i "s/HealthChecksId/$healthchecks_id/g" README.md

# Update SonarCloud URL
sed -i "s|SonarCloudUrl|$sonarcloud_url|g" README.md

# Run composer install
echo "Running composer install..."
composer install

echo "Project setup complete."

# Additional PHP setup tasks
echo "Performing additional PHP setup tasks..."
# Add any additional setup commands here

echo "Setup finished successfully."