public function migrate($diffVersion = false) {
		
		$migrations      = new \DirectoryIterator(__DIR__."/../../migrations/");
		$migrationsValid = array();
		
		foreach ($migrations as $migration) {
			$filename = $migration->getFilename();
			if (!$migration->isDot() && $migration->isFile() && ($filename[0] != "_")) {
				$migrationsValid[] = $filename;
			}
		}
		
		asort($migrationsValid);
		
		foreach ($migrationsValid as $filename) {
			
			$basePath        = __DIR__."/../../../";
			$migrationData   = json_decode(file_get_contents(__DIR__."/../../migrations/".$filename));
			$checkType       = $migrationData->checkType;
			$sourcePath      = ($checkType == "fileExists") ? $basePath.$migrationData->sourcePath : $basePath.$migrationData->sourcePath.DIRECTORY_SEPARATOR;
			$destinationPath = ($checkType == "fileExists") ? $basePath.$migrationData->destinationPath : $basePath.$migrationData->destinationPath.DIRECTORY_SEPARATOR;
			
			if ($checkType == "dirEmpty") {
				
				$emptyDir = true;
				$objects  = new \DirectoryIterator($destinationPath);
				foreach ($objects as $object) {
					if (!$object->isDot() && ($object->getFilename() != "README") && ($object->getFilename() != ".DS_Store")) {
						$emptyDir = false;
					}
				}
				
				if ($emptyDir) {
					$this->runMigration($filename, $sourcePath, $destinationPath, false);
				}
				
			} else if ($checkType == "dirExists") {
				
				if (!is_dir($destinationPath)) {
					mkdir($destinationPath);
				}
				
			} else if ($checkType == "fileExists") {
				
				if (!file_exists($destinationPath)) {
					$this->runMigration($filename, $sourcePath, $destinationPath, true);
				}
				
			} else if (($checkType == "versionDiffDir") && $diffVersion) {
				
				// make sure the destination path exists
				if (!is_dir($destinationPath)) {
					mkdir($destinationPath);
				}
				
				$this->runMigration($filename, $sourcePath, $destinationPath, false);
				
			} else if (($checkType == "versionDiffFile") && $diffVersion) {
				
				$this->runMigration($filename, $sourcePath, $destinationPath, true);
				
			} else {
				
				print "pattern Lab doesn't recognize a checkType of ".$checkType.". The migrator class is pretty thin at the moment.\n";
				exit;
				
			}
			
		}
		
	}
public function migrate($diffVersion = false) {
		
		$migrations      = new \DirectoryIterator(__DIR__."/../../migrations/");
		$migrationsValid = array();
		
		foreach ($migrations as $migration) {
			$filename = $migration->getFilename();
			if (!$migration->isDot() && $migration->isFile() && ($filename[0] != "_")) {
				$migrationsValid[] = $filename;
			}
		}
		
		asort($migrationsValid);
		
		foreach ($migrationsValid as $filename) {
			
			$basePath        = __DIR__."/../../../";
			$migrationData   = json_decode(file_get_contents(__DIR__."/../../migrations/".$filename));
			$checkType       = $migrationData->checkType;
			$sourcePath      = ($checkType == "fileExists") ? $basePath.$migrationData->sourcePath : $basePath.$migrationData->sourcePath.DIRECTORY_SEPARATOR;
			$destinationPath = ($checkType == "fileExists") ? $basePath.$migrationData->destinationPath : $basePath.$migrationData->destinationPath.DIRECTORY_SEPARATOR;
			
			if ($checkType == "dirEmpty") {
				
				$emptyDir = true;
				$objects  = new \DirectoryIterator($destinationPath);
				foreach ($objects as $object) {
					if (!$object->isDot() && ($object->getFilename() != "README") && ($object->getFilename() != ".DS_Store")) {
						$emptyDir = false;
					}
				}
				
				if ($emptyDir) {
					$this->runMigration($filename, $sourcePath, $destinationPath, false);
				}
				
			} else if ($checkType == "dirExists") {
				
				if (!is_dir($destinationPath)) {
					mkdir($destinationPath);
				}
				
			} else if ($checkType == "fileExists") {
				
				if (!file_exists($destinationPath)) {
					$this->runMigration($filename, $sourcePath, $destinationPath, true);
				}
				
			} else if (($checkType == "versionDiffDir") && $diffVersion) {
				
				// make sure the destination path exists
				if (!is_dir($destinationPath)) {
					mkdir($destinationPath);
				}
				
				$this->runMigration($filename, $sourcePath, $destinationPath, false);
				
			} else if (($checkType == "versionDiffFile") && $diffVersion) {
				
				$this->runMigration($filename, $sourcePath, $destinationPath, true);
				
			} else {
				
				print "pattern Lab doesn't recognize a checkType of ".$checkType.". The migrator class is pretty thin at the moment.\n";
				exit;
				
			}
			
		}
		
	}
public function migrate ( $ diffVersion = false ) { $ migrations = new \ DirectoryIterator ( __DIR__ . "/../../migrations/" ) ; $ migrationsValid = array ( ) ; foreach ( $ migrations as $ migration ) { $ filename = $ migration -> getFilename ( ) ; if ( ! $ migration -> isDot ( ) && $ migration -> isFile ( ) && ( $ filename [ 0 ] != "_" ) ) { $ migrationsValid [ ] = $ filename ; } } asort ( $ migrationsValid ) ; foreach ( $ migrationsValid as $ filename ) { $ basePath = __DIR__ . "/../../../" ; $ migrationData = json_decode ( file_get_contents ( __DIR__ . "/../../migrations/" . $ filename ) ) ; $ checkType = $ migrationData -> checkType ; $ sourcePath = ( $ checkType == "fileExists" ) ? $ basePath . $ migrationData -> sourcePath : $ basePath . $ migrationData -> sourcePath . DIRECTORY_SEPARATOR ; $ destinationPath = ( $ checkType == "fileExists" ) ? $ basePath . $ migrationData -> destinationPath : $ basePath . $ migrationData -> destinationPath . DIRECTORY_SEPARATOR ; if ( $ checkType == "dirEmpty" ) { $ emptyDir = true ; $ objects = new \ DirectoryIterator ( $ destinationPath ) ; foreach ( $ objects as $ object ) { if ( ! $ object -> isDot ( ) && ( $ object -> getFilename ( ) != "README" ) && ( $ object -> getFilename ( ) != ".DS_Store" ) ) { $ emptyDir = false ; } } if ( $ emptyDir ) { $ this -> runMigration ( $ filename , $ sourcePath , $ destinationPath , false ) ; } } else if ( $ checkType == "dirExists" ) { if ( ! is_dir ( $ destinationPath ) ) { mkdir ( $ destinationPath ) ; } } else if ( $ checkType == "fileExists" ) { if ( ! file_exists ( $ destinationPath ) ) { $ this -> runMigration ( $ filename , $ sourcePath , $ destinationPath , true ) ; } } else if ( ( $ checkType == "versionDiffDir" ) && $ diffVersion ) { // make sure the destination path exists if ( ! is_dir ( $ destinationPath ) ) { mkdir ( $ destinationPath ) ; } $ this -> runMigration ( $ filename , $ sourcePath , $ destinationPath , false ) ; } else if ( ( $ checkType == "versionDiffFile" ) && $ diffVersion ) { $ this -> runMigration ( $ filename , $ sourcePath , $ destinationPath , true ) ; } else { print "pattern Lab doesn't recognize a checkType of " . $ checkType . ". The migrator class is pretty thin at the moment.\n" ; exit ; } } }
Read through the migrations and move files as needed
@param  {Boolean}      is this a different version
Read through the migrations and move files as needed