mirror of
https://github.com/atlanticbiomedical/portal-legacy.git
synced 2025-07-02 01:47:28 -04:00
initial commit
This commit is contained in:
66
data/symfony/bin/create_sandbox.sh
Executable file
66
data/symfony/bin/create_sandbox.sh
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
# creates a symfony sandbox for this symfony version
|
||||
|
||||
echo ">>> initialization"
|
||||
DIR=../`dirname $0`
|
||||
SANDBOX_NAME=sf_sandbox
|
||||
APP_NAME=frontend
|
||||
PHP=php
|
||||
|
||||
echo ">>> project initialization"
|
||||
rm -rf ${SANDBOX_NAME}
|
||||
mkdir ${SANDBOX_NAME}
|
||||
cd ${SANDBOX_NAME}
|
||||
|
||||
echo ">>> create a new project and a new app"
|
||||
${PHP} ${DIR}/../../data/bin/symfony init-project ${SANDBOX_NAME}
|
||||
${PHP} symfony init-app ${APP_NAME}
|
||||
|
||||
echo ">>> add LICENSE"
|
||||
cp ${DIR}/../../LICENSE LICENSE
|
||||
|
||||
echo ">>> add README"
|
||||
cp ${DIR}/../../data/data/SANDBOX_README README
|
||||
|
||||
echo ">>> add symfony command line for windows users"
|
||||
cp ${DIR}/../../data/bin/symfony.bat symfony.bat
|
||||
|
||||
echo ">>> freeze symfony"
|
||||
${PHP} symfony freeze
|
||||
rm config/config.php.bak
|
||||
|
||||
echo ">>> default to sqlite (propel.ini)"
|
||||
sed -i '' -e "s#\(propel.database *= *\)mysql#\1sqlite#" config/propel.ini
|
||||
sed -i '' -e "s#\(propel.database.createUrl *= *\).*#\1sqlite://./../../../../data/sandbox.db#" config/propel.ini
|
||||
sed -i '' -e "s#\(propel.database.url *= *\).*#\1sqlite://./../../../../data/sandbox.db#" config/propel.ini
|
||||
|
||||
echo ">>> default to sqlite (databases.yml)"
|
||||
echo "all:
|
||||
propel:
|
||||
class: sfPropelDatabase
|
||||
param:
|
||||
phptype: sqlite
|
||||
database: %SF_DATA_DIR%/sandbox.db
|
||||
" > config/databases.yml
|
||||
|
||||
echo ">>> add some empty files in empty directories"
|
||||
touch apps/${APP_NAME}/modules/.sf apps/${APP_NAME}/i18n/.sf doc/.sf web/images/.sf
|
||||
touch log/.sf cache/.sf batch/.sf data/sql/.sf data/model/.sf
|
||||
touch data/symfony/generator/sfPropelAdmin/default/skeleton/templates/.sf
|
||||
touch data/symfony/generator/sfPropelAdmin/default/skeleton/validate/.sf
|
||||
touch data/symfony/modules/default/config/.sf
|
||||
touch lib/model/.sf plugins/.sf web/js/.sf
|
||||
touch test/unit/.sf test/functional/.sf test/functional/${APP_NAME}/.sf
|
||||
touch web/uploads/assets/.sf
|
||||
|
||||
touch data/sandbox.db
|
||||
chmod 777 data
|
||||
chmod 777 data/sandbox.db
|
||||
|
||||
echo ">>> create archive"
|
||||
cd ..
|
||||
tar zcpf ${SANDBOX_NAME}.tgz ${SANDBOX_NAME}
|
||||
|
||||
echo ">>> cleanup"
|
||||
rm -rf ${SANDBOX_NAME}
|
116
data/symfony/bin/release.php
Executable file
116
data/symfony/bin/release.php
Executable file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2007 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Release script.
|
||||
*
|
||||
* Usage: php data/bin/release.php 1.0.0 stable
|
||||
*
|
||||
* @package symfony
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @version SVN: $Id$
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/../../lib/vendor/pake/pakeFunction.php');
|
||||
require_once(dirname(__FILE__).'/../../lib/vendor/pake/pakeGetopt.class.php');
|
||||
require_once(dirname(__FILE__).'/../../lib/vendor/lime/lime.php');
|
||||
|
||||
if (!isset($argv[1]))
|
||||
{
|
||||
throw new Exception('You must provide version prefix.');
|
||||
}
|
||||
|
||||
if (!isset($argv[2]))
|
||||
{
|
||||
throw new Exception('You must provide stability status (alpha/beta/stable).');
|
||||
}
|
||||
|
||||
$stability = $argv[2];
|
||||
|
||||
if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2)
|
||||
{
|
||||
$version_prefix = $argv[1];
|
||||
|
||||
$result = pake_sh('svn status -u '.getcwd());
|
||||
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match))
|
||||
{
|
||||
$version = $match[1];
|
||||
}
|
||||
|
||||
if (!isset($version))
|
||||
{
|
||||
throw new Exception('unable to find last svn revision');
|
||||
}
|
||||
|
||||
// make a PEAR compatible version
|
||||
$version = $version_prefix.'.'.$version;
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = $argv[1];
|
||||
}
|
||||
|
||||
print 'releasing symfony version "'.$version."\"\n";
|
||||
|
||||
// Test
|
||||
$h = new lime_harness(new lime_output_color());
|
||||
|
||||
$h->base_dir = realpath(dirname(__FILE__).'/../../test');
|
||||
|
||||
// unit tests
|
||||
$h->register_glob($h->base_dir.'/unit/*/*Test.php');
|
||||
|
||||
// functional tests
|
||||
$h->register_glob($h->base_dir.'/functional/*Test.php');
|
||||
$h->register_glob($h->base_dir.'/functional/*/*Test.php');
|
||||
|
||||
$ret = $h->run();
|
||||
|
||||
if (!$ret)
|
||||
{
|
||||
throw new Exception('Some tests failed. Release process aborted!');
|
||||
}
|
||||
|
||||
if (is_file('package.xml'))
|
||||
{
|
||||
pake_remove('package.xml', getcwd());
|
||||
}
|
||||
|
||||
pake_copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
|
||||
|
||||
// add class files
|
||||
$finder = pakeFinder::type('file')->ignore_version_control()->relative();
|
||||
$xml_classes = '';
|
||||
$dirs = array('lib' => 'php', 'data' => 'data');
|
||||
foreach ($dirs as $dir => $role)
|
||||
{
|
||||
$class_files = $finder->in($dir);
|
||||
foreach ($class_files as $file)
|
||||
{
|
||||
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// replace tokens
|
||||
pake_replace_tokens('package.xml', getcwd(), '##', '##', array(
|
||||
'SYMFONY_VERSION' => $version,
|
||||
'CURRENT_DATE' => date('Y-m-d'),
|
||||
'CLASS_FILES' => $xml_classes,
|
||||
'STABILITY' => $stability,
|
||||
));
|
||||
|
||||
$results = pake_sh('pear package');
|
||||
echo $results;
|
||||
|
||||
pake_remove('package.xml', getcwd());
|
||||
|
||||
// copy .tgz as symfony-latest.tgz
|
||||
pake_copy(getcwd().'/symfony-'.$version.'.tgz', getcwd().'/symfony-latest.tgz');
|
||||
|
||||
exit(0);
|
173
data/symfony/bin/symfony.php
Executable file
173
data/symfony/bin/symfony.php
Executable file
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the symfony package.
|
||||
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (!isset($sf_symfony_lib_dir))
|
||||
{
|
||||
die("You must launch symfony command line with the symfony script\n");
|
||||
}
|
||||
|
||||
if (ini_get('zend.ze1_compatibility_mode'))
|
||||
{
|
||||
die("symfony cannot run with zend.ze1_compatibility_mode enabled.\nPlease turn zend.ze1_compatibility_mode to Off in your php.ini.\n");
|
||||
}
|
||||
|
||||
// check if we are using an old project
|
||||
if (file_exists('config/config.php') && !isset($sf_symfony_lib_dir))
|
||||
{
|
||||
// allow only upgrading
|
||||
if (!in_array('upgrade', $argv))
|
||||
{
|
||||
echo "Please upgrade your project before launching any other symfony task\n";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
require_once($sf_symfony_lib_dir.'/vendor/pake/pakeFunction.php');
|
||||
require_once($sf_symfony_lib_dir.'/vendor/pake/pakeGetopt.class.php');
|
||||
|
||||
// autoloading for pake tasks
|
||||
class simpleAutoloader
|
||||
{
|
||||
static public
|
||||
$class_paths = array(),
|
||||
$autoload_callables = array();
|
||||
|
||||
static public function initialize($sf_symfony_lib_dir)
|
||||
{
|
||||
self::$class_paths = array();
|
||||
|
||||
self::register($sf_symfony_lib_dir, '.class.php');
|
||||
self::register($sf_symfony_lib_dir.'/vendor/propel', '.php');
|
||||
self::register($sf_symfony_lib_dir.'/vendor/creole', '.php');
|
||||
self::register('lib/model', '.php');
|
||||
self::register('plugins', '.php');
|
||||
}
|
||||
|
||||
static public function __autoload($class)
|
||||
{
|
||||
if (!isset(self::$class_paths[$class]))
|
||||
{
|
||||
foreach ((array) self::$autoload_callables as $callable)
|
||||
{
|
||||
if (call_user_func($callable, $class))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once(self::$class_paths[$class]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static public function register($dir, $ext)
|
||||
{
|
||||
if (!is_dir($dir))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (pakeFinder::type('file')->name('*'.$ext)->ignore_version_control()->follow_link()->in($dir) as $file)
|
||||
{
|
||||
self::$class_paths[str_replace($ext, '', str_replace('.class', '', basename($file, $ext)))] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
static public function add($class, $file)
|
||||
{
|
||||
if (!is_file($file))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self::$class_paths[$class] = $file;
|
||||
}
|
||||
|
||||
static public function registerCallable($callable)
|
||||
{
|
||||
if (!is_callable($callable))
|
||||
{
|
||||
throw new Exception('Autoload callable does not exist');
|
||||
}
|
||||
|
||||
self::$autoload_callables[] = $callable;
|
||||
}
|
||||
}
|
||||
|
||||
function __autoload($class)
|
||||
{
|
||||
static $initialized = false;
|
||||
|
||||
if (!$initialized)
|
||||
{
|
||||
simpleAutoloader::initialize(sfConfig::get('sf_symfony_lib_dir'));
|
||||
$initialized = true;
|
||||
}
|
||||
|
||||
return simpleAutoloader::__autoload($class);
|
||||
}
|
||||
|
||||
// trap -V before pake
|
||||
if (in_array('-V', $argv) || in_array('--version', $argv))
|
||||
{
|
||||
printf("symfony version %s\n", pakeColor::colorize(trim(file_get_contents($sf_symfony_lib_dir.'/VERSION')), 'INFO'));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (count($argv) <= 1)
|
||||
{
|
||||
$argv[] = '-T';
|
||||
}
|
||||
|
||||
require_once($sf_symfony_lib_dir.'/config/sfConfig.class.php');
|
||||
|
||||
sfConfig::add(array(
|
||||
'sf_root_dir' => getcwd(),
|
||||
'sf_symfony_lib_dir' => $sf_symfony_lib_dir,
|
||||
'sf_symfony_data_dir' => $sf_symfony_data_dir,
|
||||
));
|
||||
|
||||
// directory layout
|
||||
include($sf_symfony_data_dir.'/config/constants.php');
|
||||
|
||||
// include path
|
||||
set_include_path(
|
||||
sfConfig::get('sf_lib_dir').PATH_SEPARATOR.
|
||||
sfConfig::get('sf_app_lib_dir').PATH_SEPARATOR.
|
||||
sfConfig::get('sf_model_dir').PATH_SEPARATOR.
|
||||
sfConfig::get('sf_symfony_lib_dir').DIRECTORY_SEPARATOR.'vendor'.PATH_SEPARATOR.
|
||||
get_include_path()
|
||||
);
|
||||
|
||||
// register tasks
|
||||
$dirs = array(
|
||||
sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'tasks' => 'myPake*.php', // project tasks
|
||||
sfConfig::get('sf_symfony_data_dir').DIRECTORY_SEPARATOR.'tasks' => 'sfPake*.php', // symfony tasks
|
||||
sfConfig::get('sf_root_dir').'/plugins/*/data/tasks' => '*.php', // plugin tasks
|
||||
);
|
||||
foreach ($dirs as $globDir => $name)
|
||||
{
|
||||
if ($dirs = glob($globDir))
|
||||
{
|
||||
$tasks = pakeFinder::type('file')->name($name)->in($dirs);
|
||||
foreach ($tasks as $task)
|
||||
{
|
||||
include_once($task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run task
|
||||
pakeApp::get_instance()->run(null, null, false);
|
||||
|
||||
exit(0);
|
Reference in New Issue
Block a user