Improvements to the API commands
Esse commit está contido em:
@@ -11,32 +11,41 @@ namespace Lobe\testFacade;
|
||||
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
|
||||
*/
|
||||
class testFacade extends \Lobe\Neuron implements \neuron{
|
||||
|
||||
// TODO: REMOVE THIS FILE AFTER THE REQUIRED TESTS
|
||||
public function __construct(Array $data)
|
||||
{
|
||||
echo "Here, a list of available commands from the \API package:\n";
|
||||
echo "\API\\\n";
|
||||
echo " GET::\n";
|
||||
echo " \API\Get::plugins(true); // passing true, it echoes directly\n";
|
||||
echo " \API\Get::projectData();\n";
|
||||
echo " \API\Get::currentProject();\n";
|
||||
echo " \API\Get::tables();\n";
|
||||
echo " \API\Get::DDL();\n";
|
||||
echo " \API\Get::DecoratedDDL();\n";
|
||||
echo " \API\Get::lobes();\n";
|
||||
echo " \API\Get::source();\n";
|
||||
echo " \API\Get::idioms();\n";
|
||||
echo " GET::";
|
||||
echo "plugins(true); // passing true, it echoes directly\n";
|
||||
echo " projectData();\n";
|
||||
echo " currentProject();\n";
|
||||
echo " tables();\n";
|
||||
echo " DDL();\n";
|
||||
echo " DecoratedDDL();\n";
|
||||
echo " lobes();\n";
|
||||
echo " source();\n";
|
||||
echo " idioms();\n";
|
||||
|
||||
echo " Project::\n";
|
||||
echo " \API\Project::data();\n";
|
||||
echo " \API\Project::current();\n";
|
||||
echo " \API\Project::getDDLCommand();\n";
|
||||
echo " \API\Project::getDDLCommand(false);\n";
|
||||
echo " \API\Project::openProject('demo_en');\n";
|
||||
echo " \API\Project::projectExists('demo_en');\n";
|
||||
echo " \API\Project::source();\n";
|
||||
echo " User::";
|
||||
echo "projectsList();\n";
|
||||
echo " usersList();\n";
|
||||
|
||||
echo " User::\n";
|
||||
echo " \API\User::projectsList();\n";
|
||||
echo " FileManager::";
|
||||
echo "appendDataToFile(\$file, \$data);\n";
|
||||
echo " createDir('newDir/anotherNewDir/finalNewDir');\n";
|
||||
echo " createFile(\$uri); // also accepts nested directories\n";
|
||||
echo " createXMLFile(\$uri);\n";
|
||||
echo " writeToFile(\$file, \$data);\n";
|
||||
|
||||
echo " Project::";
|
||||
echo "data();\n";
|
||||
echo " current();\n";
|
||||
echo " getDDLCommand();\n";
|
||||
echo " getDDLCommand(false); // not decorated\n";
|
||||
echo " openProject(\$projectName);\n";
|
||||
echo " projectExists(\$projectName);\n";
|
||||
echo " source();\n";
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,11 @@ namespace theos;
|
||||
*/
|
||||
class Gosh {
|
||||
public $bdGen= null;
|
||||
|
||||
public static function getLobesDir()
|
||||
{
|
||||
return _MINDSRC_."/mind3rd/API/Lobe/";
|
||||
}
|
||||
|
||||
public function generate($data)
|
||||
{
|
||||
|
||||
@@ -10,14 +10,9 @@ namespace theos;
|
||||
*
|
||||
* @author felipe
|
||||
*/
|
||||
final class ProjectFileManager {
|
||||
|
||||
public static function getLobesDir()
|
||||
{
|
||||
return _MINDSRC_."/mind3rd/API/Lobe/";
|
||||
}
|
||||
class ProjectFileManager {
|
||||
|
||||
private static function filterURI($uri, $allowSlashes=true)
|
||||
protected static function filterURI($uri, $allowSlashes=true)
|
||||
{
|
||||
$uri= \urlencode(\utf8_encode($uri));
|
||||
if($allowSlashes)
|
||||
@@ -31,19 +26,20 @@ final class ProjectFileManager {
|
||||
return $uri;
|
||||
}
|
||||
|
||||
private static function mountURI($uri= '', $allowSlashes= true)
|
||||
protected static function mountURI($uri= '', $allowSlashes= true)
|
||||
{
|
||||
$tmpURI = '';//\Mind::$currentProject['path']."/";
|
||||
$tmpURI = '';
|
||||
$tmpURI.= self::filterURI($uri, $allowSlashes);
|
||||
return $tmpURI;
|
||||
}
|
||||
|
||||
public static function createDir()
|
||||
public static function createDir($uri)
|
||||
{
|
||||
|
||||
$uri= self::setInnerURI($uri);
|
||||
self::fixDirectory($uri);
|
||||
}
|
||||
|
||||
private static function fixDirectory($uri)
|
||||
protected static function fixDirectory($uri)
|
||||
{
|
||||
if(file_exists($uri))
|
||||
return true;
|
||||
@@ -57,12 +53,13 @@ final class ProjectFileManager {
|
||||
|
||||
public static function appendDataToFile($file, $data)
|
||||
{
|
||||
$file= self::setInnerURI($file);
|
||||
if(file_exists($file))
|
||||
return \file_put_contents ($file, $data, \FILE_APPEND);
|
||||
return \file_put_contents($file, $data, \FILE_APPEND);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function setInnerURI($uri)
|
||||
protected static function setInnerURI($uri)
|
||||
{
|
||||
return \Mind::$currentProject['path']."/".$uri;
|
||||
}
|
||||
@@ -83,13 +80,18 @@ final class ProjectFileManager {
|
||||
if($type=='general')
|
||||
return fopen($uri, 'wb+');
|
||||
else{
|
||||
if(file_exists($uri))
|
||||
return @\simplexml_load_file($uri);
|
||||
$h= fopen($uri, 'wb+');
|
||||
$content= '<?xml version="1.0" ?><root></root>';
|
||||
fwrite($h, $content);
|
||||
fclose($h);
|
||||
return @\simplexml_load_file($uri);
|
||||
return self::createXMLFile($uri);
|
||||
}
|
||||
}
|
||||
|
||||
public static function createXMLFile($uri)
|
||||
{
|
||||
if(file_exists($uri))
|
||||
return @\simplexml_load_file($uri);
|
||||
$h= fopen($uri, 'wb+');
|
||||
$content= '<?xml version="1.0" ?><root></root>';
|
||||
fwrite($h, $content);
|
||||
fclose($h);
|
||||
return @\simplexml_load_file($uri);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
namespace API;
|
||||
/**
|
||||
* Description of FileManager
|
||||
*
|
||||
* @author felipe
|
||||
*/
|
||||
class FileManager extends \theos\ProjectFileManager{
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
; This file will be used by mind3rd due to generate
|
||||
; the structure or even code for it
|
||||
;
|
||||
; First, let's inform mind3rd about what you want
|
||||
; to use in your application
|
||||
;
|
||||
; The idiom is the human language you want to use
|
||||
idiom=pt-br
|
||||
; The technology you specify here, will be used as
|
||||
; the backend of your application
|
||||
; this will be the name of the model you want to apply
|
||||
; to your app, of course, it depends on the models
|
||||
; you've got installed
|
||||
technology=php-zf
|
||||
; You will need to configure your database
|
||||
; the module you choose will probably try to implement
|
||||
; some PDO drivers, so, put the one you want, here
|
||||
database_drive=pgsql
|
||||
; now, the ip address or host name
|
||||
database_addr=localhost
|
||||
; then, the port
|
||||
database_port=5432
|
||||
; and here, the user and password
|
||||
database_user=root
|
||||
dataase_pwd=root
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* This is a model, created to ilustrate how and where
|
||||
* you can write your code
|
||||
* You may have as many files as you want, altough, the
|
||||
* main.mnd is required
|
||||
*/
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$dir= \theos\ProjectFileManager::getLobesDir();
|
||||
$dir= \theos\Gosh::getLobesDir();
|
||||
$d = dir($dir);
|
||||
$options= Array();
|
||||
$avOpts= Array();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário