mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 00:20:08 +01:00
Merge pull request #449 from eberkund/master
Move ~/.valet to ~/.config/valet
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
error.log
|
||||
.idea
|
||||
|
||||
@@ -9,7 +9,7 @@ class Configuration
|
||||
/**
|
||||
* Create a new Valet configuration class instance.
|
||||
*
|
||||
* @param Filesystem $filesystem
|
||||
* @param Filesystem $files
|
||||
*/
|
||||
function __construct(Filesystem $files)
|
||||
{
|
||||
@@ -42,6 +42,13 @@ function install()
|
||||
function createConfigurationDirectory()
|
||||
{
|
||||
$this->files->ensureDirExists(VALET_HOME_PATH, user());
|
||||
|
||||
$oldPath = posix_getpwuid(fileowner(__FILE__))['dir'].'/.valet';
|
||||
|
||||
if ($this->files->isDir($oldPath)) {
|
||||
$this->prependPath(VALET_HOME_PATH.'/Sites');
|
||||
rename($oldPath, VALET_HOME_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,6 +89,9 @@ function copyExampleConfig()
|
||||
*/
|
||||
function appendCustomConfigImport($customConfigPath)
|
||||
{
|
||||
$contents = preg_replace('/^conf-file=.*\/\.valet\/.*$/m', '', $this->files->get($this->configPath));
|
||||
$this->files->putAsUser($this->configPath, $contents);
|
||||
|
||||
if (! $this->customConfigIsBeingImported($customConfigPath)) {
|
||||
$this->files->appendAsUser(
|
||||
$this->configPath,
|
||||
@@ -142,6 +145,6 @@ function updateTld($oldTld, $newTld)
|
||||
*/
|
||||
function customConfigPath()
|
||||
{
|
||||
return $_SERVER['HOME'].'/.valet/dnsmasq.conf';
|
||||
return $_SERVER['HOME'].'/.config/valet/dnsmasq.conf';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ function installServer()
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the Nginx configuration directory to the ~/.valet directory.
|
||||
* Install the Nginx configuration directory to the ~/.config/valet directory.
|
||||
*
|
||||
* This directory contains all site-specific Nginx servers.
|
||||
*
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Valet;
|
||||
|
||||
use DomainException;
|
||||
|
||||
class Site
|
||||
{
|
||||
var $config, $cli, $files;
|
||||
@@ -72,7 +70,7 @@ function links()
|
||||
|
||||
$certs = $this->getCertificates($certsPath);
|
||||
|
||||
return $this->getLinks(VALET_HOME_PATH.'/Sites', $certs);
|
||||
return $this->getLinks($this->sitesPath(), $certs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Valet;
|
||||
|
||||
use Httpful\Request;
|
||||
|
||||
class Valet
|
||||
{
|
||||
var $cli, $files;
|
||||
@@ -58,10 +60,11 @@ function extensions()
|
||||
*
|
||||
* @param string $currentVersion
|
||||
* @return bool
|
||||
* @throws \Httpful\Exception\ConnectionErrorException
|
||||
*/
|
||||
function onLatestVersion($currentVersion)
|
||||
{
|
||||
$response = \Httpful\Request::get('https://api.github.com/repos/laravel/valet/releases/latest')->send();
|
||||
$response = Request::get('https://api.github.com/repos/laravel/valet/releases/latest')->send();
|
||||
|
||||
return version_compare($currentVersion, trim($response->body->tag_name, 'v'), '>=');
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
|
||||
/**
|
||||
* Define the ~/.valet path as a constant.
|
||||
* Define the ~/.config/valet path as a constant.
|
||||
*/
|
||||
define('VALET_HOME_PATH', $_SERVER['HOME'].'/.valet');
|
||||
define('VALET_HOME_PATH', $_SERVER['HOME'].'/.config/valet');
|
||||
define('VALET_SERVER_PATH', realpath(__DIR__ . '/../../server.php'));
|
||||
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Define the user's "~/.valet" path.
|
||||
* Define the user's "~/.config/valet" path.
|
||||
*/
|
||||
|
||||
define('VALET_HOME_PATH', posix_getpwuid(fileowner(__FILE__))['dir'].'/.valet');
|
||||
define('VALET_HOME_PATH', posix_getpwuid(fileowner(__FILE__))['dir'].'/.config/valet');
|
||||
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,9 @@ public function tearDown()
|
||||
|
||||
public function test_configuration_directory_is_created_if_it_doesnt_exist()
|
||||
{
|
||||
$files = Mockery::mock(Filesystem::class);
|
||||
$files = Mockery::mock(Filesystem::class.'[ensureDirExists,isDir]');
|
||||
$files->shouldReceive('ensureDirExists')->once()->with(VALET_HOME_PATH, user());
|
||||
$files->shouldReceive('isDir')->once();
|
||||
swap(Filesystem::class, $files);
|
||||
resolve(Configuration::class)->createConfigurationDirectory();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user