diff --git a/build/api/core/ModuleRequest.php b/build/api/core/ModuleRequest.php index 2d79f0b..6704246 100644 --- a/build/api/core/ModuleRequest.php +++ b/build/api/core/ModuleRequest.php @@ -370,8 +370,10 @@ /* (1) On verifie que le token est valide */ - $checkToken = new Repo('token/check', [$token] ); - $token_permissions = $checkToken->answer(); + // $checkToken = new Repo('token/check', [$token] ); + $token_permissions = false; + // TODO: Token management + // $token_permissions = $checkToken->answer(); // Si le token est invalide, on retourne une erreur -> FAUX if( $token_permissions === false ){ diff --git a/build/api/module/release.php b/build/api/module/release.php new file mode 100644 index 0000000..c41c177 --- /dev/null +++ b/build/api/module/release.php @@ -0,0 +1,53 @@ + Project's name + * @branch Git branch + * + */ + public static function pull($args){ + extract($args); + + /* [1] Load projects' configuration + =========================================================*/ + /* (1) Fetch file */ + $fc = file_get_contents(__CONFIG__.'/projects.json'); + if( !$fc ) + return ['ModuleError'=>ManagerError::UnreachableResource]; + + /* (2) Checks json format */ + $js = json_decode( $fc, true ); + + if( !$js ) + return ['ModuleError'=>ManagerError::ParsingFailed]; + + + /* [2] Checks @project argument and files + =========================================================*/ + /* (1) Checks @project */ + if( !isset($js[$project]) ) + return ['ModuleError'=>ManagerError::UnreachableResource]; + + /* (2) Checks @project's folder */ + if( !is_dir($js[$project]['root']) ) + return ['ModuleError'=>ManagerError::UnreachableResource]; + + /* (3) Checks @git directory */ + if( !is_dir($js[$project]['root'].'/.git') ) + return ['ModuleError'=>ManagerError::UnreachableResource]; + + + /* [3] Launch script + =========================================================*/ + /* (1) Launch command + test */ + } + + } diff --git a/config/modules.json b/config/modules.json index 36a3713..1a351a2 100755 --- a/config/modules.json +++ b/config/modules.json @@ -1,3 +1,12 @@ { - + "release": { + "pull": { + "description": "Pulls project from git branch.", + "permissions": [], + "parameters": { + "project": { "description": "Project's name.", "type": "varchar(2,30,alphanumeric)" }, + "branch": { "description": "Git release branch.", "type": "varchar(2,30,alphanumeric)" } + } + } + } } diff --git a/config/projects.json b/config/projects.json new file mode 100644 index 0000000..a028a7a --- /dev/null +++ b/config/projects.json @@ -0,0 +1,10 @@ +{ + "nxtic": { + "root": "/var/www/nxtic" + }, + + "prod-releaser": { + "root": "/var/www/prod-releaser" + } + +}