cleanup makefile a bit
This commit is contained in:
15
Makefile
15
Makefile
@@ -11,17 +11,26 @@ all: build
|
|||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
@composer install --no-interaction
|
@composer install --no-interaction
|
||||||
@php artisan config:cache
|
@php artisan route:clear
|
||||||
|
@php artisan config:clear
|
||||||
|
@composer dump-autoload
|
||||||
|
|
||||||
.PHONY: db
|
.PHONY: db
|
||||||
db:
|
db:
|
||||||
@php artisan database:create --reset
|
@php artisan database:create
|
||||||
@php artisan migrate:refresh --seed
|
@php artisan migrate:refresh --seed
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: build db
|
install: build db
|
||||||
@echo "Done!"
|
@echo "Done!"
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
update: db
|
||||||
|
|
||||||
|
@php artisan route:clear
|
||||||
|
@php artisan config:clear
|
||||||
|
@echo "Done!"
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@find bootstrap/cache -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
@find bootstrap/cache -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
||||||
@@ -31,12 +40,12 @@ clean:
|
|||||||
@find storage/framework/sessions -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
@find storage/framework/sessions -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
||||||
@find storage/framework/views -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
@find storage/framework/views -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
||||||
@find storage/logs -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
@find storage/logs -type f -not -name '.gitignore' -print0 | xargs -0 rm --
|
||||||
@composer dump-autoload
|
|
||||||
@php artisan route:clear
|
@php artisan route:clear
|
||||||
@php artisan config:clear
|
@php artisan config:clear
|
||||||
|
|
||||||
.PHONY: reset
|
.PHONY: reset
|
||||||
reset: clean
|
reset: clean
|
||||||
|
@php artisan database:create --reset
|
||||||
@make install
|
@make install
|
||||||
|
|
||||||
.PHONY: unittest-db
|
.PHONY: unittest-db
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class CreateDatabase extends Command
|
|||||||
protected function create_mysql($dbkey)
|
protected function create_mysql($dbkey)
|
||||||
{
|
{
|
||||||
$exec = 'mysql';
|
$exec = 'mysql';
|
||||||
if($this->os->isWindowsLike()) {
|
if ($this->os->isWindowsLike()) {
|
||||||
$exec .= '.exe';
|
$exec .= '.exe';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,14 +55,14 @@ class CreateDatabase extends Command
|
|||||||
|
|
||||||
# only supply password if it's set
|
# only supply password if it's set
|
||||||
$password = config($dbkey . 'password');
|
$password = config($dbkey . 'password');
|
||||||
if($password !== '') {
|
if ($password !== '') {
|
||||||
$mysql_cmd[] = '-p' . $password;
|
$mysql_cmd[] = '-p' . $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->option('reset')) {
|
if ($this->option('reset')) {
|
||||||
$cmd = array_merge(
|
$cmd = array_merge(
|
||||||
$mysql_cmd,
|
$mysql_cmd,
|
||||||
["-e 'DROP DATABASE ".config($dbkey . 'database')."'"]
|
["-e 'DROP DATABASE " . config($dbkey . 'database') . "'"]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->runCommand($cmd);
|
$this->runCommand($cmd);
|
||||||
@@ -92,13 +92,15 @@ class CreateDatabase extends Command
|
|||||||
$this->runCommand($cmd);
|
$this->runCommand($cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = [
|
if (!file_exists(config($dbkey . 'database'))) {
|
||||||
$exec,
|
$cmd = [
|
||||||
config($dbkey . 'database'),
|
$exec,
|
||||||
'""',
|
config($dbkey . 'database'),
|
||||||
];
|
'""',
|
||||||
|
];
|
||||||
|
|
||||||
$this->runCommand($cmd);
|
$this->runCommand($cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,16 +116,14 @@ class CreateDatabase extends Command
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$this->info('Using connection "'.config('database.default').'"');
|
$this->info('Using connection "' . config('database.default') . '"');
|
||||||
|
|
||||||
$conn = config('database.default');
|
$conn = config('database.default');
|
||||||
$dbkey = 'database.connections.'.$conn.'.';
|
$dbkey = 'database.connections.' . $conn . '.';
|
||||||
|
|
||||||
if(config($dbkey.'driver') === 'mysql') {
|
if (config($dbkey . 'driver') === 'mysql') {
|
||||||
$this->create_mysql($dbkey);
|
$this->create_mysql($dbkey);
|
||||||
}
|
} elseif (config($dbkey . 'driver') === 'sqlite') {
|
||||||
|
|
||||||
elseif (config($dbkey . 'driver') === 'sqlite') {
|
|
||||||
$this->create_sqlite($dbkey);
|
$this->create_sqlite($dbkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user