1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

correcting a few script problems

This commit is contained in:
Taylor Otwell
2016-05-10 13:26:39 -05:00
parent 97f7ae2342
commit f0556ce554
5 changed files with 67 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ function isDir($path)
*/
function mkdir($path, $owner = null, $mode = 0755)
{
mkdir($path, $mode);
mkdir($path, $mode, true);
if ($owner) {
$this->chown($path, $owner);

View File

@@ -39,6 +39,8 @@ function install()
$this->brew->ensureInstalled('php70', $this->taps);
}
$this->files->ensureDirExists('/usr/local/var/log', user());
$this->updateConfiguration();
$this->restart();

38
install.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Install Homebrew for dependency management
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget > /dev/null 2>&1
# Install PHP 7.0
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56 > /dev/null 2>&1
brew install php70
# Install Composer to /usr/local/bin
/usr/local/bin/php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
/usr/local/bin/php -r "if (hash_file('SHA384', 'composer-setup.php') === '92102166af5abdb03f49ce52a40591073a7b859a86e8ff13338cf7db58a19f7844fbc0bb79b2773bf30791e935dbd938') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
/usr/local/bin/php composer-setup.php
/usr/local/bin/php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
# Download and unpack the latest Valet release
rm -rf $HOME/.valet-cli
mkdir $HOME/.valet-cli
wget https://github.com/laravel/valet/archive/v1.1.3.tar.gz -O $HOME/.valet-cli/valet.tar.gz
tar xvzf $HOME/.valet-cli/valet.tar.gz -C $HOME/.valet-cli --strip 1 > /dev/null 2>&1
ln -s $HOME/.valet-cli/valet /usr/local/bin/valet
chmod +x /usr/local/bin/valet
# Install Valet's Composer dependencies
/usr/local/bin/php composer install -d $HOME/.valet-cli
# Run the Valet installation process
$HOME/.valet-cli/valet install

15
update.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Remove existing Valet directory
rm -rf $HOME/.valet-cli
# Download and unpack the latest Valet release
mkdir $HOME/.valet-cli
wget https://github.com/laravel/valet/archive/v1.1.3.tar.gz -O $HOME/.valet-cli/valet.tar.gz
tar xvzf $HOME/.valet-cli/valet.tar.gz -C $HOME/.valet-cli --strip 1 > /dev/null 2>&1
# Install Valet's Composer dependencies
/usr/local/bin/php composer install -d $HOME/.valet-cli
# Run the Valet installation process
$HOME/.valet-cli/valet --version

12
valet
View File

@@ -1,7 +1,17 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SOURCE="${BASH_SOURCE[0]}"
# Resolve possible symbolic link (http://stackoverflow.com/a/246128/416354)
while [ -h "$SOURCE" ]; do # Resolve until we are no longer a symbolic link
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # Resolve relative symbolic link
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# Correct path if we are globally installed via Composer
if [ ! -f "$DIR/cli/valet.php" ]
then
OLDPWD="$PWD"