Skip to content

Commit

Permalink
test git removal addition
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcirre committed Nov 12, 2024
1 parent d4a8132 commit 7a0caa5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions app/Console/Commands/FissionInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function handle()

info('Starting Fission installation...');

// Handle Git repository
$this->handleGitRepository();

$this->copyAuthJson();

// Run npm install
Expand Down Expand Up @@ -60,6 +63,46 @@ public function handle()
info('Keep creating. 🫡');
}

private function handleGitRepository()
{
info('Managing Git repository...');

// Check if .git directory exists
if (File::isDirectory(base_path('.git'))) {
// Remove existing Git repository
File::deleteDirectory(base_path('.git'));
info('Removed existing Git repository.');

// Ask if user wants to initialize a new repository
if (confirm('Do you want to initialize a fresh Git repository?', true)) {
exec('git init');
info('Initialized fresh Git repository.');

// Create initial commit
if (confirm('Create initial commit?', true)) {
exec('git add .');
exec('git commit -m "Initial commit"');
info('Created initial commit.');
}
}
} else {
warning('No existing Git repository found.');

// Still offer to initialize a new one
if (confirm('Do you want to initialize a new Git repository?', true)) {
exec('git init');
info('Initialized new Git repository.');

// Create initial commit
if (confirm('Create initial commit?', true)) {
exec('git add .');
exec('git commit -m "Initial commit"');
info('Created initial commit.');
}
}
}
}

private function setupEnvFile()
{
info('Setting up .env file...');
Expand Down

0 comments on commit 7a0caa5

Please sign in to comment.