Permalink
Browse files

initial import

  • Loading branch information...
csanquer committed Feb 5, 2013
0 parents commit 15c93be06c4b72f55309622cd6fc7391554aad84
Showing with 18,246 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +44 −0 .php_cs
  3. +2 −0 CREDITS
  4. +674 −0 LICENSE
  5. +45 −0 README.md
  6. +35 −0 app/app.php
  7. +171 −0 app/bootstrap.php
  8. +6 −0 app/config/config.php.dist
  9. +39 −0 app/console
  10. +6 −0 app/sql/database.sql
  11. +96 −0 app/views/base.html.twig
  12. +21 −0 app/views/datalea/config_file_form.html.twig
  13. +18 −0 app/views/datalea/dump.html.twig
  14. +30 −0 app/views/datalea/form/fields.html.twig
  15. +128 −0 app/views/datalea/generate.html.twig
  16. +12 −0 app/views/datalea/index.html.twig
  17. +149 −0 app/views/twitter_bootstrap_form_layout.html.twig
  18. +48 −0 composer.json
  19. +1,474 −0 composer.lock
  20. +1 −0 console
  21. +137 −0 src/Spyrit/Datalea/Controller/MainControllerProvider.php
  22. +410 −0 src/Spyrit/Datalea/Faker/Dump/Dumper.php
  23. +36 −0 src/Spyrit/Datalea/Faker/Dump/FakerSimpleXMLElement.php
  24. +63 −0 src/Spyrit/Datalea/Faker/Dump/Loader.php
  25. +179 −0 src/Spyrit/Datalea/Faker/Model/ColumnConfig.php
  26. +311 −0 src/Spyrit/Datalea/Faker/Model/Config.php
  27. +439 −0 src/Spyrit/Datalea/Faker/Model/VariableConfig.php
  28. +93 −0 src/Spyrit/Datalea/Form/Type/FakerColumnConfigType.php
  29. +53 −0 src/Spyrit/Datalea/Form/Type/FakerConfigFileType.php
  30. +179 −0 src/Spyrit/Datalea/Form/Type/FakerConfigType.php
  31. +132 −0 src/Spyrit/Datalea/Form/Type/FakerVariableConfigType.php
  32. +21 −0 src/Spyrit/Datalea/Form/extension/BootstrapFormExtension.php
  33. +50 −0 src/Spyrit/Datalea/Form/extension/Type/HelpFormTypeExtension.php
  34. +35 −0 src/Spyrit/Datalea/Form/extension/Type/RowContainerFormTypeExtension.php
  35. +7 −0 web/.htaccess
  36. +1,092 −0 web/css/bootstrap-responsive.css
  37. +9 −0 web/css/bootstrap-responsive.min.css
  38. +6,039 −0 web/css/bootstrap.css
  39. +9 −0 web/css/bootstrap.min.css
  40. +84 −0 web/css/styles.css
  41. BIN web/img/glyphicons-halflings-white.png
  42. BIN web/img/glyphicons-halflings.png
  43. +7 −0 web/index.php
  44. +16 −0 web/index_dev.php
  45. +2,159 −0 web/js/bootstrap.js
  46. +6 −0 web/js/bootstrap.min.js
  47. +2 −0 web/js/jquery-1.8.3.min.js
  48. +485 −0 web/select2/LICENSE
  49. +74 −0 web/select2/README.md
  50. +8 −0 web/select2/component.json
  51. +64 −0 web/select2/release.sh
  52. BIN web/select2/select2-spinner.gif
  53. +573 −0 web/select2/select2.css
  54. +2,467 −0 web/select2/select2.js
  55. BIN web/select2/select2.png
  56. BIN web/select2/select2x2.png
@@ -0,0 +1,8 @@
vendor
app/cache
app/config/config.yml
app/config/config.php
bin
data
web/uploads
composer.phar
44 .php_cs
@@ -0,0 +1,44 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude(array(
'model/om',
'model/map',
'vendor',
'web/images',
'Symfony/Tests/Component/ClassLoader/ClassCollectionLoaderTest.php',
'Symfony/Tests/Component/DependencyInjection/Fixtures/containers/container9.php',
'Symfony/Tests/Component/DependencyInjection/Fixtures/includes/foo.php',
'Symfony/Tests/Component/DependencyInjection/Fixtures/php/services9.php',
'Symfony/Tests/Component/DependencyInjection/Fixtures/yaml/services9.yml',
'Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php',
'Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.php',
'Symfony/Tests/Component/Yaml/Fixtures/sfTests.yml',
))
->notName('/.*\.(ico|gif|png|jpeg|jpg|bmp|zip|gz|tar|7z|tiff|log|phar|jar)/')
->in(array(
__DIR__.'/src',
))
;
return Symfony\CS\Config\Config::create()
->fixers(array(
'indentation',
'linefeed',
'unused_use',
'trailing_spaces',
'php_closing_tag',
'short_tag',
'return',
'visibility',
'braces',
'phpdoc_params',
'eof_ending',
'extra_empty_lines',
'include',
'psr0',
'controls_spaces',
'elseif',
))
->finder($finder)
;
@@ -0,0 +1,2 @@
Charles SANQUER (Spyrit Systeme) <charles.sanquer@spyrit.net>
Maxime Corson (Spyrit Systeme) <maxime.corson@spyrit.net>
674 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,45 @@
Datalea - a Random Test Data Generator
====================================
Install
-------
- copy config sample file and edit the copy with your environment values
cp app/config/config.php.dist app/config/config.php
- get composer http://getcomposer.org/ and install dependencies
curl -s https://getcomposer.org/installer | php
- install dependencies
php composer.phar install
- set you web server document root to web directory
- clean cache
php app/console cache:clear
Licensing
---------
License GPL 3
* Copyright (C) 2012-2013 Spyrit Systeme
This file is part of Datalea.
Spyrit Fake Data Generator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Spyrit Fake Data Generator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Spyrit Fake Data Generator. If not, see <http://www.gnu.org/licenses/>.
@@ -0,0 +1,35 @@
<?php
// get environment constants or set default
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
if (!defined('SILEX_ENV')) {
define('SILEX_ENV', 'dev');
}
if (!defined('SILEX_DEBUG')) {
define('SILEX_DEBUG', false);
}
require_once __DIR__.DS.'bootstrap.php';
$app = createDefaultSilexApp(__DIR__, SILEX_ENV, SILEX_DEBUG);
/*
* add custom service providers
*/
/*
* mount or define custom controllers
*/
$app->mount('/', new \Spyrit\Datalea\Controller\MainControllerProvider());
/*
* run silex application
*/
$app->run();
//var_dump($app);
@@ -0,0 +1,171 @@
<?php
// get environment constants or set default
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
require_once __DIR__.DS.'..'.DS.'vendor'.DS.'autoload.php';
/**
* Create a Default Silex application with some extra service providers
*
* @param string $appdir default = __DIR__ , application directory
* @param string $env default = prod
* @param bool $debug default = false , debug mode
*
* @return \Silex\Application
*/
function createDefaultSilexApp($appdir = __DIR__, $env = 'prod', $debug = false)
{
$fs = new \Symfony\Component\Filesystem\Filesystem();
$app = new \Silex\Application();
if (!$fs->exists($appdir)) {
die('the application directory doesn\'t exists !!');
}
/*
* define main paths
*/
$app['app_dir'] = realpath($appdir);
$app['root_dir'] = realpath($appdir.DS.'..');
$app['web_dir'] = realpath($appdir.DS.'..'.DS.'web');
// get configs
$config = require_once $app['app_dir'].DS.'config'.DS.'config.php';
//set umask
$umask = isset($config['umask']) && is_int($config['umask']) ? $config['umask'] : 0002;
umask($umask);
//create cache directories
$app['cache_dir'] = $appdir.DS.'cache';
if (!$fs->exists($app['cache_dir'])) {
$rights = isset($config['cache_access']) && is_int($config['cache_access']) ? $config['cache_access'] : 0775;
$fs->mkdir(array(
$app['cache_dir'],
$app['cache_dir'].DS.'http',
$app['cache_dir'].DS.'twig',
), $rights);
$fs->chmod($app['cache_dir'], $rights);
$fs->chmod($app['cache_dir'].DS.'http', $rights);
$fs->chmod($app['cache_dir'].DS.'twig', $rights);
}
$app['data_dir'] = $app['root_dir'].DS.'data';
if (!$fs->exists($app['data_dir'])) {
$fs->mkdir($app['data_dir'], 0777);
}
$app['uploads_dir'] = $app['web_dir'].DS.'uploads';
if (!$fs->exists($app['uploads_dir'])) {
$fs->mkdir($app['uploads_dir'], 0777);
}
/*
* define environment variables
*/
$app['debug'] = (bool) $debug;
$app['env'] = $env;
/*
* add service providers
*/
//add http cache
//$app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
// 'http_cache.cache_dir' => $app['cache_dir'].DS.'http',
//));
//add url generator
$app->register(new \Silex\Provider\UrlGeneratorServiceProvider());
//add symfony2 sessions
$app->register(new \Silex\Provider\SessionServiceProvider());
//add symfony2 forms and validators
$app->register(new \Silex\Provider\ValidatorServiceProvider());
// must be registered before twig
$app->register(new \Silex\Provider\FormServiceProvider(), array(
'form.secret' => '4fws6dg4w6df4<qg4sh4646qfgsd4',
));
$app['form.extensions'] = $app->share($app->extend('form.extensions', function ($extensions) use ($app) {
$extensions[] = new \Spyrit\Datalea\Form\extension\BootstrapFormExtension();
return $extensions;
}));
//add symfony2 translation (needed for twig + forms)
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'locale_fallback' => empty($config['locale_fallback']) ? 'en' : $config['locale_fallback'],
));
// add twig templating
$app->register(new \Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/views',
// 'twig.templates' => array(),
'twig.options' => array(
'debug' => $app['debug'],
'cache' => $app['cache_dir'].DS.'twig',
'auto_reload' => $app['debug'],
),
'twig.form.templates' => array(
'form_div_layout.html.twig', // Twig SF2 original form theme
'twitter_bootstrap_form_layout.html.twig', // Custom twitter bootstrap form theme in app/views
),
));
//add swiftmailer with default SMTP transport
if (!empty($config['swiftmailer'])) {
$app->register(new \Silex\Provider\SwiftmailerServiceProvider(), array(
'swiftmailer.options' => isset($config['swiftmailer']['options']) ? $config['swiftmailer']['options'] : array(),
));
// custom swiftmailer transport
$swiftTransport = in_array($config['swiftmailer']['transport'], array('mail', 'sendmail', 'smtp')) ? $config['swiftmailer']['transport'] : 'smtp';
switch ($swiftTransport) {
case 'mail':
$app['swiftmailer.transport'] = new \Swift_MailTransport();
break;
case 'sendmail':
$app['swiftmailer.transport'] = new \Swift_SendmailTransport();
break;
case 'smtp':
default:
break;
}
}
//Database PDO Connection
if (!empty($config['databases'])) {
$app->register(new \Spyrit\Silex\Utils\Provider\PDOServiceProvider(), array(
'pdo.dbs.options' => is_array($config['databases']) ? $config['databases'] : array(),
));
}
/*
* mount or define controllers
*/
// Exception Error page
if ($app['env'] == 'prod') {
$app->error(function(\Exception $e) use ($app) {
if ($e instanceof Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
$content = vsprintf('<h1>%d - %s (%s)</h1>', array(
$e->getStatusCode(),
Symfony\Component\HttpFoundation\Response::$statusTexts[$e->getStatusCode()],
$app['request']->getRequestUri()
));
$code = $e->getStatusCode();
} elseif ($e instanceof Symfony\Component\HttpKernel\Exception\HttpException) {
$content = '<h1>An error occured!</h1>';
$code = $e->getStatusCode();
} else {
$content = '<h1>An error occured!</h1>';
$code = 200;
}
return new \Symfony\Component\HttpFoundation\Response($content, $code);
});
}
return $app;
}
@@ -0,0 +1,6 @@
<?php
return array(
'locale_fallback' => 'en',
'umask' => 0000,
'cache_access' => 0777,
);
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
require_once __DIR__.DS.'..'.DS.'vendor'.DS.'autoload.php';
use Spyrit\Silex\Utils\Command\CacheClearCommand;
use Symfony\Component\Console\Application as BaseApplication;
class Application extends BaseApplication
{
const NAME = 'Silex Console Tool';
const VERSION = '0.1';
protected $projectDir;
public function __construct()
{
parent::__construct(static::NAME, static::VERSION);
$this->add(new CacheClearCommand());
$this->projectDir = realpath(__DIR__.DS.'..');
}
public function getProjectDir()
{
return $this->projectDir;
}
public function getBinDir()
{
return $this->projectDir.DS.'bin';
}
}
$application = new Application();
$application->run();
@@ -0,0 +1,6 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
Oops, something went wrong.

0 comments on commit 15c93be

Please sign in to comment.