/**
  * Map additional routes.
  *
  * @param Filesystem  $files
  * @param Application $application
  */
 public function map(Filesystem $files, Application $application)
 {
     // Include public routes.
     if ($files->exists($routes = $application->getStoragePath('posts/routes.php'))) {
         $files->requireOnce($routes);
     } else {
         $files->requireOnce(__DIR__ . '/../resources/routes.php');
     }
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     \DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) {
         $this->filesystem->requireOnce($file);
         $migrationClass = $this->classFinder->findClass($file);
         $migration = new $migrationClass();
         $migration->down();
         $migration->up();
     }
     $this->info("Merx tables migrated.");
     \DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
 /**
  * run package database migrations
  *
  * @return void
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . "/migrations") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
     foreach ($fileSystem->files(__DIR__ . "/seeds") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->run();
     }
 }
 /**
  * Pull in composer and register service provider
  */
 public function setUp()
 {
     $filesystem = new Filesystem();
     $filesystem->requireOnce(__DIR__ . "/vendor/autoload.php");
     $list = new ProviderList(\Core::getFacadeApplication());
     $list->registerProvider("\\Concrete\\DocumentationGenerator\\ServiceProvider");
 }
 /**
  * Require composer's autoload file the packages.
  *
  * @return void
  **/
 protected function loadAutoloader($path)
 {
     $finder = new Finder();
     $files = new Filesystem();
     $autoloads = $finder->in($path)->files()->name('autoload.php')->depth('<= 3')->followLinks();
     foreach ($autoloads as $file) {
         $files->requireOnce($file->getRealPath());
     }
 }
 public function register()
 {
     $vendorPath = base_path('packages/*/vendor');
     $autoloads = static::findAutoloadFiles($vendorPath);
     $files = new Filesystem();
     foreach ($autoloads as $file) {
         /** @var SplFileInfo $file */
         $files->requireOnce($file->getRealPath());
     }
 }
Example #7
0
 /**
  * run package database migrations
  *
  * @return void
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . "/../src/Commands") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->fire();
     }
 }
Example #8
0
 /**
  * Run all database migrations from the specified path
  * 
  * @param  string $path
  * @return void
  */
 protected function migrateDatabaseFromPath($path)
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files($path) as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
 }
 /**
  * run package database migrations.
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . '/../../../../tests/NilPortugues/App/Migrations') as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->down();
         (new $migrationClass())->up();
     }
 }
Example #10
0
 protected function getMigrations()
 {
     $migrations = [];
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . '/../migrations') as $file) {
         $fileSystem->requireOnce($file);
         $migrations[] = $classFinder->findClass($file);
     }
     return $migrations;
 }
 /**
  * Run package database migrations.
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . '/App/database/migrations') as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->down();
         (new $migrationClass())->up();
     }
 }
Example #12
0
 /**
  * Bootstrap any application services.
  *
  * @param Filesystem $filesystem
  */
 public function boot(Filesystem $filesystem)
 {
     foreach ($filesystem->files(app_path('Libraries/Macros')) as $file) {
         $filesystem->requireOnce($file);
     }
     if ($this->app->environment(['local'])) {
         $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
         $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
         $this->app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class);
     }
 }
Example #13
0
 /**
  *
  */
 protected function requireBootstrap()
 {
     if (!$this->filesystem->isDirectory($this->bootstrapDirectory)) {
         return;
     }
     $files = $this->finder->create()->files()->name('/^[^_].+\\.php$/')->in($this->bootstrapDirectory);
     $files->sort(function ($a) {
         return $a->getFilename() !== static::BOOTSRAP_FILE;
     });
     foreach ($files as $file) {
         $this->filesystem->requireOnce($file);
     }
 }
Example #14
0
 /**
  * Run package database migrations.
  * Thanks http://stackoverflow.com/questions/27759301/setting-up-integration-tests-in-a-laravel-package
  *
  * @return void
  */
 public function migrate()
 {
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     $packageMigrations = $fileSystem->files(__DIR__ . "/../../src/Migrations");
     $laravelMigrations = $fileSystem->files(__DIR__ . "/../../vendor/laravel/laravel/database/migrations");
     $migrationFiles = array_merge($laravelMigrations, $packageMigrations);
     foreach ($migrationFiles as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
 }
Example #15
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->disableForeignKeyChecks();
     $migrationCount = 0;
     foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) {
         $this->filesystem->requireOnce($file);
         $migrationClass = $this->classFinder->findClass($file);
         $migration = new $migrationClass();
         if ($this->option("refresh")) {
             $migration->down();
         }
         try {
             $migration->up();
             $migrationCount++;
         } catch (QueryException $ex) {
             if (!$this->isTableAlreadyExistError($ex)) {
                 throw $ex;
             }
         }
     }
     $this->enableForeignKeyChecks();
     $this->info("{$migrationCount} table(s) migrated.");
 }
Example #16
0
 protected function migrateDatabase()
 {
     // First create fake users and articles tables
     (new CreateTestUsersTable())->up();
     (new CreateTestArticlesTable())->up();
     // Then migrate Merx tables
     $fileSystem = new Filesystem();
     $classFinder = new ClassFinder();
     foreach ($fileSystem->files(__DIR__ . "/../database/migrations") as $file) {
         $fileSystem->requireOnce($file);
         $migrationClass = $classFinder->findClass($file);
         (new $migrationClass())->up();
     }
 }
Example #17
0
 /**
  * Boot and Load theme starter files.
  *
  * @return bool
  */
 public function boot()
 {
     if ($this->booted) {
         return false;
     }
     $this->booted = true;
     $themePath = $this->getThemePath();
     $autoload = $this->getThemeAutoloadFiles($themePath);
     foreach ($autoload as $file) {
         $file = ltrim($file, '/');
         $this->files->requireOnce("{$themePath}/{$file}");
     }
     $this->dispatcher->fire("orchestra.theme.boot: {$this->theme}");
     return true;
 }
Example #18
0
 /**
  * Require the given file once.
  *
  * @param string $file
  * @return mixed 
  * @static 
  */
 public static function requireOnce($file)
 {
     return \Illuminate\Filesystem\Filesystem::requireOnce($file);
 }
Example #19
0
 /**
  * Require in all the migration files in a given path.
  *
  * @param  string  $path
  * @param  array   $files
  * @return void
  */
 public function requireFiles($path, array $files)
 {
     foreach ($files as $file) {
         $this->files->requireOnce($path . '/' . $file . '.php');
     }
 }
 /**
  * Map additional routes.
  *
  * @param Filesystem  $files
  * @param Application $application
  */
 public function map(Filesystem $files, Application $application)
 {
     if ($files->exists($routes = $application->getStoragePath('redirects/routes.php'))) {
         $files->requireOnce($routes);
     }
 }
Example #21
0
 /**
  * Require in all the migration files in a given path.
  *
  * @param  array   $files
  * @return void
  */
 public function requireFiles(array $files)
 {
     foreach ($files as $file) {
         $this->files->requireOnce($file);
     }
 }