Skip to content

Commit

Permalink
Add writing gitignore to configured dump folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasDeWinter committed Feb 18, 2015
1 parent bb0c16d commit 07b8a46
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/DatabaseBackupServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public function boot()
$this->publishes([
__DIR__.'/Assets/config/laravel-backup.php' => config_path('laravel-backup.php'),
]);

$backupConfig = config('laravel-backup');

$this->writeIgnoreFile($backupConfig['path']);
}

/**
Expand Down Expand Up @@ -51,4 +55,19 @@ public function provides()
{
return ['command.db:backup'];
}

/**
* Copy the gitignore stub to the given directory
*
* @param $directory
*/
public function writeIgnoreFile($directory)
{
$destinationFile = $directory.'/.gitignore';

if(!file_exists($destinationFile))
{
$this->app['files']->copy(__DIR__.'/../stubs/gitignore.txt', $destinationFile);
}
}
}
2 changes: 2 additions & 0 deletions stubs/gitignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 07b8a46

Please sign in to comment.