Skip to content

Commit

Permalink
V2
Browse files Browse the repository at this point in the history
  • Loading branch information
uttamrabadiya committed May 1, 2024
1 parent d3697c4 commit b46d323
Show file tree
Hide file tree
Showing 133 changed files with 4,638 additions and 7,321 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ psysh
Gemfile
Gemfile.lock
_site/
.idea
.idea
/.php-cs-fixer.cache
5 changes: 0 additions & 5 deletions .styleci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) <Divyank Munjapara, Uttam Rabadiya>
Copyright (c) <Uttam Rabadiya, Divyank Munjapara>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
1. Finish refactoring classes in Valet directory -- Done
2. Fix facade.php -- Done
3. Move config directory from ~/.valet to ~/.config/valet
3.1 Copy directory from ~/.valet to ~/.config
3.2 Replace /home/uttam/.valet path with /home/uttam/.config/valet for Nginx directory files (Logs & Certificate, .sock files)
3.3 Replace .sock file paths in valet.conf file.
3.4 Regenerate symbolic links in Sites directory
4. Add relevant test cases
5. Enable Phpstan & CodeSniffer -- Done
6. Enable unit coverage report
7. Add Infection
8. Ngrok remove binary file and install it via `valet install` command
9. self-signed certificate verification issues in Firefox & PHP's curl requests
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

Binary file removed bin/ngrok
Binary file not shown.
40 changes: 0 additions & 40 deletions cli/Valet/CliPrompt.php

This file was deleted.

43 changes: 8 additions & 35 deletions cli/Valet/CommandLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,78 +8,51 @@ class CommandLine
{
/**
* Simple global function to run commands.
*
* @param string $command
*
* @return void
*/
public function quietly($command)
public function quietly(string $command): void
{
$this->runCommand($command.' > /dev/null 2>&1');
}

/**
* Simple global function to run commands.
*
* @param string $command
*
* @return void
*/
public function quietlyAsUser($command)
public function quietlyAsUser(string $command): void
{
$this->quietly('sudo -u '.user().' '.$command.' > /dev/null 2>&1');
}

/**
* Pass the command to the command line and display the output.
*
* @param string $command
*
* @return void
*/
public function passthru($command)
public function passthru(string $command): void
{
passthru($command);
}

/**
* Run the given command as the non-root user.
*
* @param string $command
* @param callable $onError
*
* @return string
*/
public function run($command, callable $onError = null)
public function run(string $command, callable $onError = null): string
{
return $this->runCommand($command, $onError);
}

/**
* Run the given command.
*
* @param string $command
* @param callable $onError
*
* @return string
*/
public function runAsUser(string $command, callable $onError = null)
public function runAsUser(string $command, callable $onError = null): string
{
return $this->runCommand('sudo -u '.user().' '.$command, $onError);
}

/**
* Run the given command.
*
* @param string $command
* @param callable $onError
*
* @return string
* TODO: Refactor new Process instance, we might not need if statement there.
*/
protected function runCommand($command, callable $onError = null)
private function runCommand(string $command, callable $onError = null): string
{
$onError = $onError ?: function () {
};
$onError = $onError ?: function () {};

// Symfony's 4.x Process component has deprecated passing a command string
// to the constructor, but older versions (which Valet's Composer
Expand Down
Loading

0 comments on commit b46d323

Please sign in to comment.