[Alba-desarrollo] SVN Alba r6214 - in prosistem/alba/trunk/alba/plugins: . albaToolsPlugin albaToolsPlugin/data albaToolsPlugin/data/tasks albaToolsPlugin/modules albaToolsPlugin/modules/albaTools albaToolsPlugin/modules/albaTools/actions

commits en pressenter.com.ar commits en pressenter.com.ar
Lun Jun 1 23:19:36 CEST 2009


Author: ftoledo
Date: 2009-06-01 18:19:36 -0300 (Mon, 01 Jun 2009)
New Revision: 6214

Added:
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/tasks/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/tasks/alba.php
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/actions/
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/actions/actions.class.php
   prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/templates/
Removed:
   prosistem/alba/trunk/alba/plugins/albaTasks/
Log:
renombrando plugin

Added: prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/tasks/alba.php
===================================================================
--- prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/tasks/alba.php	                        (rev 0)
+++ prosistem/alba/trunk/alba/plugins/albaToolsPlugin/data/tasks/alba.php	2009-06-01 21:19:36 UTC (rev 6214)
@@ -0,0 +1,174 @@
+<?php
+
+pake_desc( 'Listado de Usuarios' );
+pake_task( 'alba-list-users', 'project_exists' );
+
+pake_desc( 'Limpiar archivos temporales');
+pake_task( 'alba-clear-temp','project_exists');
+
+pake_desc('[ALBA-fix] dump data to fixtures directory');
+pake_task('alba-dump-data', 'project_exists');
+
+pake_desc('[ALBA-fix] load data to fixtures directory');
+pake_task('alba-load-data', 'project_exists');
+
+
+function run_alba_list_users( $task, $args ) 
+{
+
+  // define constants
+    define('SF_ROOT_DIR',    sfConfig::get('sf_root_dir'));
+    define('SF_APP',         'principal');
+    define('SF_ENVIRONMENT', 'prod');
+    define('SF_DEBUG',       true);
+    require_once (SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
+                      
+    $databaseManager = new sfDatabaseManager();
+    $databaseManager->initialize();
+   
+   
+
+    $users = UsuarioPeer::doSelect(new Criteria());
+    foreach ($users as $user) {
+       pake_echo_action ($user->getId(), $user->getUsuario() . " [" .$user->getEmail(). "]");
+    }
+}
+
+function run_alba_clear_temp ( $task, $args ) {
+    pake_echo_action ('Limpiando archivos temporales...','Ok');
+    pake_echo_action ("NO IMPLEMENTADO AUN");
+}
+
+/**
+ * La funcion original en dist/symfony/data/tasks/sfPakePropel.php 
+ * NO FUNCIONA
+ * porque a la funcion dumpData() no se le pasan los parametros correctos 
+ * 
+ *
+ * Dumps yml database data to fixtures directory.
+ *
+ * @example symfony dump-data frontend data.yml
+ * @example symfony dump-data frontend data.yml dev
+ *
+ * @param object $task
+ * @param array $args
+ */
+function run_alba_dump_data($task, $args)
+{
+  if (!count($args))
+  {
+    throw new Exception('You must provide the app.');
+  }
+
+  $app = $args[0];
+
+  if (!is_dir(sfConfig::get('sf_app_dir').DIRECTORY_SEPARATOR.$app))
+  {
+    throw new Exception('The app "'.$app.'" does not exist.');
+  }
+
+  if (!isset($args[1]))
+  {
+    throw new Exception('You must provide a filename.');
+  }
+
+  $filename = $args[1];
+
+  $env = empty($args[2]) ? 'dev' : $args[2];
+
+  // define constants
+  define('SF_ROOT_DIR',    sfConfig::get('sf_root_dir'));
+  define('SF_APP',         $app);
+  define('SF_ENVIRONMENT', $env);
+  define('SF_DEBUG',       true);
+
+  // get configuration
+  require_once SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php';
+
+  $databaseManager = new sfDatabaseManager();
+  $databaseManager->initialize();
+
+  if (!sfToolkit::isPathAbsolute($filename))
+  {
+    $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures';
+    pake_mkdirs($dir);
+    $filename = $dir.DIRECTORY_SEPARATOR.$filename;
+  }
+
+  pake_echo_action('propel', sprintf('dumping data to "%s"', $filename));
+
+  $data = new sfPropelData();
+  
+  // FIX de parametros 
+  $data->dumpData($filename,'all','alba');
+}
+
+
+function run_alba_load_data($task, $args)
+{
+  if (!count($args))
+  {
+    throw new Exception('You must provide the app.');
+  }
+
+  $app = $args[0];
+
+  if (!is_dir(sfConfig::get('sf_app_dir').DIRECTORY_SEPARATOR.$app))
+  {
+    throw new Exception('The app "'.$app.'" does not exist.');
+  }
+
+  if (count($args) > 1 && $args[count($args) - 1] == 'append')
+  {
+    array_pop($args);
+    $delete = false;
+  }
+  else
+  {
+    $delete = true;
+  }
+
+  $env = empty($args[1]) ? 'dev' : $args[1];
+
+  // define constants
+  define('SF_ROOT_DIR',    sfConfig::get('sf_root_dir'));
+  define('SF_APP',         $app);
+  define('SF_ENVIRONMENT', $env);
+  define('SF_DEBUG',       true);
+
+  // get configuration
+  require_once SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php';
+
+  if (count($args) == 1)
+  {
+    if (!$pluginDirs = glob(sfConfig::get('sf_root_dir').'/plugins/*/data'))
+    {
+      $pluginDirs = array();
+    }
+    $fixtures_dirs = pakeFinder::type('dir')->name('fixtures')->in(array_merge($pluginDirs, array(sfConfig::get('sf_data_dir'))));
+  }
+  else
+  {
+    $fixtures_dirs = array_slice($args, 1);
+  }
+
+  $databaseManager = new sfDatabaseManager();
+  $databaseManager->initialize();
+
+  $data = new sfPropelData();
+  $data->setDeleteCurrentData($delete);
+
+  foreach ($fixtures_dirs as $fixtures_dir)
+  {
+    if (!is_readable($fixtures_dir))
+    {
+      continue;
+    }
+
+    pake_echo_action('propel', sprintf('load data from "%s"', $fixtures_dir));
+
+    $data->loadData($fixtures_dir,'alba');
+  }
+}
+
+?>
\ No newline at end of file

Added: prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/actions/actions.class.php	                        (rev 0)
+++ prosistem/alba/trunk/alba/plugins/albaToolsPlugin/modules/albaTools/actions/actions.class.php	2009-06-01 21:19:36 UTC (rev 6214)
@@ -0,0 +1,14 @@
+<?php
+class albaToolsActions extends sfActions
+{
+    public function executeConvert()
+    {
+        return $this->renderText("hola");
+    }
+    public function executeIndex()
+    {
+    
+    }
+
+}
+?>
\ No newline at end of file




Más información sobre la lista de distribución Alba-desarrollo