refactor: use python instead of javascript
This commit is contained in:
@@ -31,22 +31,17 @@ git config user.email "user@workshop.local" | Out-Null
|
||||
|
||||
# Create initial project files
|
||||
$app = @"
|
||||
class Application {
|
||||
constructor() {
|
||||
this.name = 'TeamProject';
|
||||
this.version = '1.0.0';
|
||||
}
|
||||
class Application:
|
||||
def __init__(self):
|
||||
self.name = 'TeamProject'
|
||||
self.version = '1.0.0'
|
||||
|
||||
start() {
|
||||
console.log('Application started');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Application;
|
||||
def start(self):
|
||||
print('Application started')
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value $app
|
||||
git add app.js
|
||||
Set-Content -Path "app.py" -Value $app
|
||||
git add app.py
|
||||
git commit -m "Initial application" | Out-Null
|
||||
|
||||
$readme = @"
|
||||
@@ -63,17 +58,19 @@ git add README.md
|
||||
git commit -m "Add README" | Out-Null
|
||||
|
||||
$package = @"
|
||||
{
|
||||
"name": "team-project",
|
||||
"version": "1.0.0",
|
||||
"description": "Learning Git remotes",
|
||||
"main": "app.js"
|
||||
}
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='team-project',
|
||||
version='1.0.0',
|
||||
description='Learning Git remotes',
|
||||
py_modules=['app'],
|
||||
)
|
||||
"@
|
||||
|
||||
Set-Content -Path "package.json" -Value $package
|
||||
git add package.json
|
||||
git commit -m "Add package.json" | Out-Null
|
||||
Set-Content -Path "setup.py" -Value $package
|
||||
git add setup.py
|
||||
git commit -m "Add setup.py" | Out-Null
|
||||
|
||||
# Create the "remote" repository (bare repository)
|
||||
Set-Location ..
|
||||
@@ -102,18 +99,17 @@ git config user.name "Teammate" 2>>`$null | Out-Null
|
||||
git config user.email "teammate@workshop.local" 2>>`$null | Out-Null
|
||||
|
||||
# Make changes to main branch
|
||||
`$appContent = Get-Content "app.js" -Raw
|
||||
`$updatedApp = `$appContent -replace "start\(\) {", @"
|
||||
start() {
|
||||
console.log('Starting application...');
|
||||
this.initialize();
|
||||
}
|
||||
`$appContent = Get-Content "app.py" -Raw
|
||||
`$updatedApp = `$appContent -replace "def start\(self\):", @"
|
||||
def start(self):
|
||||
print('Starting application...')
|
||||
self.initialize()
|
||||
|
||||
initialize() {
|
||||
def initialize(self):
|
||||
"@
|
||||
|
||||
Set-Content -Path "app.js" -Value `$updatedApp
|
||||
git add app.js 2>>`$null
|
||||
Set-Content -Path "app.py" -Value `$updatedApp
|
||||
git add app.py 2>>`$null
|
||||
git commit -m "Add initialization method" 2>>`$null | Out-Null
|
||||
git push origin main 2>>`$null | Out-Null
|
||||
|
||||
@@ -140,7 +136,7 @@ Write-Host "1. Navigate to the challenge directory: cd challenge" -ForegroundCol
|
||||
Write-Host "2. Clone the remote: git clone remote-repo local-repo" -ForegroundColor White
|
||||
Write-Host "3. Navigate to your clone: cd local-repo" -ForegroundColor White
|
||||
Write-Host "4. Create a feature branch: git checkout -b add-feature" -ForegroundColor White
|
||||
Write-Host "5. Add a new method to app.js (e.g., stop method)" -ForegroundColor White
|
||||
Write-Host "5. Add a new method to app.py (e.g., stop method)" -ForegroundColor White
|
||||
Write-Host "6. Commit your changes" -ForegroundColor White
|
||||
Write-Host "7. Push your branch: git push -u origin add-feature" -ForegroundColor White
|
||||
Write-Host "8. Go back to challenge directory: cd .." -ForegroundColor White
|
||||
|
||||
Reference in New Issue
Block a user