mirror of
				https://github.com/sitelease/sugar-cube-client.git
				synced 2025-10-31 12:02:30 +01:00 
			
		
		
		
	Updated the build system
This commit is contained in:
		
							
								
								
									
										29
									
								
								RoboFile.php
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								RoboFile.php
									
									
									
									
									
								
							| @ -16,14 +16,17 @@ class RoboFile extends Tasks { | ||||
|     $path = (string) getenv('PATH'); | ||||
|     $vendor = (string) realpath('vendor/bin'); | ||||
|     if (strpos($path, $vendor) === false) putenv("PATH=$vendor".PATH_SEPARATOR.$path); | ||||
|     $this->stopOnFail(); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Deletes all generated files and reset any saved state. | ||||
|    */ | ||||
|   function clean(): void { | ||||
|     $this->_cleanDir('var'); | ||||
|     $this->_deleteDir(['build', 'doc/api', 'web']); | ||||
|   function clean(): Result { | ||||
|     return $this->collectionBuilder() | ||||
|       ->addTask($this->taskCleanDir('var')) | ||||
|       ->addTask($this->taskDeleteDir(['build', 'doc/api', 'web'])) | ||||
|       ->run(); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
| @ -39,12 +42,14 @@ class RoboFile extends Tasks { | ||||
|    * @return Result The task result. | ||||
|    */ | ||||
|   function doc(): Result { | ||||
|     $this->taskFilesystemStack() | ||||
|       ->copy('CHANGELOG.md', 'doc/about/changelog.md') | ||||
|       ->copy('LICENSE.md', 'doc/about/license.md') | ||||
|     return $this->collectionBuilder() | ||||
|       ->addTask($this->taskFilesystemStack() | ||||
|         ->copy('CHANGELOG.md', 'doc/about/changelog.md') | ||||
|         ->copy('LICENSE.md', 'doc/about/license.md')) | ||||
|       ->addTask($this->taskExec('mkdocs build --config-file=doc/mkdocs.yml')) | ||||
|       ->addTask($this->taskFilesystemStack() | ||||
|         ->remove(['doc/about/changelog.md', 'doc/about/license.md', 'web/mkdocs.yml', 'web/phpdoc.xml'])) | ||||
|       ->run(); | ||||
|  | ||||
|     return $this->_exec('mkdocs build --config-file=doc/mkdocs.yml'); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
| @ -72,7 +77,7 @@ class RoboFile extends Tasks { | ||||
|    */ | ||||
|   function upgrade(): Result { | ||||
|     $composer = escapeshellarg(PHP_OS_FAMILY == 'Windows' ? 'C:\Program Files\PHP\share\composer.phar' : '/usr/local/bin/composer'); | ||||
|     return $this->taskExecStack()->stopOnFail() | ||||
|     return $this->taskExecStack() | ||||
|       ->exec('git reset --hard') | ||||
|       ->exec('git fetch --all --prune') | ||||
|       ->exec('git pull --rebase') | ||||
| @ -92,9 +97,9 @@ class RoboFile extends Tasks { | ||||
|   /** | ||||
|    * Watches for file changes. | ||||
|    */ | ||||
|   function watch(): void { | ||||
|     $this->taskWatch() | ||||
|       ->monitor(['src', 'test'], function() { $this->test(); }) | ||||
|   function watch(): Result { | ||||
|     return $this->taskWatch() | ||||
|       ->monitor('test', function() { $this->test(); }) | ||||
|       ->run(); | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user