예제 #1
0
파일: trax.php 프로젝트: phpontrax/trax
 function initialize()
 {
     self::register_autoload();
     self::$version = self::version();
     if (substr(PHP_OS, 0, 3) == 'WIN') {
         # Windows
         self::$path_seperator = ";";
     }
     # Set include paths
     self::$models_path = TRAX_ROOT . "/app/models";
     self::$views_path = TRAX_ROOT . "/app/views";
     self::$controllers_path = TRAX_ROOT . "/app/controllers";
     self::$helpers_path = TRAX_ROOT . "/app/helpers";
     self::$layouts_path = TRAX_ROOT . "/app/views/layouts";
     self::$assets_path = TRAX_ROOT . "/app/assets";
     self::$config_path = TRAX_ROOT . "/config";
     self::$environments_path = TRAX_ROOT . "/config/environments";
     self::$lib_path = TRAX_ROOT . "/lib";
     self::$app_path = TRAX_ROOT . "/app";
     self::$log_path = TRAX_ROOT . "/log";
     self::$vendor_path = TRAX_ROOT . "/vendor";
     self::$plugins_path = TRAX_ROOT . "/vendor/plugins";
     self::$public_path = TRAX_ROOT . "/public";
     self::$tmp_path = TRAX_ROOT . "/tmp";
     # Set which file to log php errors to for this application
     # As well in your application you can do error_log("whatever") and it will go to this log file.
     ini_set("log_errors", "On");
     ini_set("error_log", self::$log_path . "/" . TRAX_ENV . ".log");
     if (TRAX_ENV == "development") {
         # Display errors to browser if in development mode for debugging
         ini_set("display_errors", "On");
     } else {
         # Hide errors from browser if not in development mode
         ini_set("display_errors", "Off");
     }
     # Get the include_path so we know what the original path was
     self::$server_default_include_path = ini_get("include_path");
     # Set the include_paths
     self::set_default_include_paths();
     # Include Trax library files.
     include_once TRAX_LIB_ROOT . "/session.php";
     include_once TRAX_LIB_ROOT . "/input_filter.php";
     include_once TRAX_LIB_ROOT . "/trax_exceptions.php";
     include_once TRAX_LIB_ROOT . "/inflector.php";
     include_once TRAX_LIB_ROOT . "/active_record.php";
     include_once TRAX_LIB_ROOT . "/action_controller.php";
     include_once TRAX_LIB_ROOT . "/action_view.php";
     include_once TRAX_LIB_ROOT . "/action_mailer.php";
     include_once TRAX_LIB_ROOT . "/dispatcher.php";
     include_once TRAX_LIB_ROOT . "/router.php";
     self::load_active_record_connections_config();
     ViewHandlers::register_extension('html');
     # legancy phtml extension
     ViewHandlers::register_extension('phtml');
 }
예제 #2
0
파일: trax.php 프로젝트: phpontrax/trax
function trax()
{
    global $search, $replace, $quiet;
    //  Get command line argument, if any
    if (!array_key_exists('argc', $GLOBALS) || $GLOBALS['argc'] < 2) {
        usage();
        // print Usage message and exit
    }
    $first_param_is_option = substr($GLOBALS['argv'][1], 0, 1) == "-" ? true : false;
    //  Check for excess arguments
    if ($GLOBALS['argc'] > 3 && !$first_param_is_option) {
        echo "unrecognized command argument " . $GLOBALS['argv'][2] . "\n";
        usage();
    }
    if ($first_param_is_option) {
        foreach ($GLOBALS['argv'] as $arg) {
            if ($arg == '-v' || $arg == '--version') {
                include dirname(__FILE__) . "/vendor/trax/trax.php";
                echo "Trax " . Trax::version() . "\n";
                exit;
            } elseif ($arg == '-h' || $arg == '--help') {
                usage();
            }
        }
    } else {
        //  Destination directory on command line
        $dstdir = $GLOBALS['argv'][1];
        if ($GLOBALS['argv'][2] == '-q' || $GLOBALS['argv'][2] == '--quiet') {
            $quiet = true;
        }
    }
    //  Guarantee it ends with DIRECTORY_SEPARATOR
    if (substr($dstdir, -1, 1) != DIRECTORY_SEPARATOR) {
        $dstdir .= DIRECTORY_SEPARATOR;
    }
    if (!create_dir($dstdir)) {
        return;
    }
    //  Assign real values for symbol substitution
    $replace[0] = realpath($dstdir) . '/config';
    // actual value of
    // the full filesystem path to the
    // Trax config/ directory in the
    // user's work area
    //  copy source directory to destination directory
    copy_dir(SOURCE_DIR, $dstdir);
    $dstdir .= 'vendor/trax/';
    if (!create_dir($dstdir)) {
        return;
    }
    // copy trax core code to vendor folder of project
    copy_dir(TRAX_SOURCE_DIR, $dstdir);
}
예제 #3
0
파일: make-pkg.php 프로젝트: phpontrax/trax
 *      that they affect.  For each file and directory managed by
 *      Subversion, PackageFileManager first attempts to apply the
 *      RE pattern as coded.  Then it appends leading and trailing '/'
 *      to the pattern and tries again.  The results are hard to
 *      predict.</li>
 *  </ul>
 *
 *  @package PHPonTrax
 *  @version $Id$
 */
chdir("./trax/");
require_once 'PEAR/PackageFileManager2.php';
require_once 'PEAR/Packager.php';
require_once './vendor/trax/inflector.php';
require_once './vendor/trax/trax.php';
$trax_version = Trax::version();
$packagexml = new PEAR_PackageFileManager2();
// Set package options
$e = $packagexml->setOptions(array('baseinstalldir' => 'PHPonTrax', 'packagedirectory' => '.', 'filelistgenerator' => 'file', 'simpleoutput' => true, 'addhiddenfiles' => true, 'dir_roles' => array('doc' => 'doc', 'test' => 'test', 'data' => 'data'), 'exceptions' => array('pear-trax' => 'script', 'pear-trax.bat' => 'script', 'vendor/trax/templates/error.phtml' => 'php', 'vendor/trax/templates/view.phtml' => 'php', 'vendor/trax/templates/mailer_view.phtml' => 'php', 'vendor/trax/templates/scaffolds/add.phtml' => 'php', 'vendor/trax/templates/scaffolds/edit.phtml' => 'php', 'vendor/trax/templates/scaffolds/index.phtml' => 'php', 'vendor/trax/templates/scaffolds/layout.phtml' => 'php', 'vendor/trax/templates/scaffolds/show.phtml' => 'php', 'vendor/trax/templates/scaffolds/scaffold.css' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/form_scaffolding.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/layout.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/view_add.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/view_edit.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/view_index.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/view_show.phtml' => 'php', 'vendor/trax/templates/scaffolds/generator_templates/style.css' => 'php'), 'installexceptions' => array('pear-trax' => '/', 'dispatch.php' => 'public')));
$packagexml->setPackage('PHPonTrax');
$packagexml->setSummary('Rapid Application Development Made Easy');
$packagexml->setDescription('PHP port of Ruby on Rails');
$packagexml->setNotes('We\'ve implemented many new and exciting features');
$packagexml->setChannel('pear.phpontrax.com');
$packagexml->setReleaseVersion($trax_version);
$packagexml->setAPIVersion($trax_version);
$packagexml->setReleaseStability('stable');
$packagexml->setAPIStability('stable');
$packagexml->setLicense('MIT License', 'http://www.opensource.org/licenses/mit-license.php');
$packagexml->setPackageType('php');
// this is a PEAR-style php script package
예제 #4
0
echo "creating trax skeleton files\n";
exec("trax " . dirname(__FILE__) . "/trax-standalone");
echo "fetching README\n";
exec("wget http://www.phpontrax.com/downloads/README-standalone.txt");
rename("README-standalone.txt", "README");
chdir("vendor");
echo "fetching PEAR files\n";
exec("wget http://www.phpontrax.com/downloads/PEAR.tar.gz");
echo "untarring PEAR files\n";
exec("tar zxvf PEAR.tar.gz");
echo "removing PEAR tar file.\n";
unlink("PEAR.tar.gz");
echo "creating vendor/trax folder\n";
mkdir("trax");
echo "copying Trax files to vendor folder\n";
exec("cp -Rp ../../trax/vendor/trax/* trax");
#echo "checking out edge Trax from svn\n";
#exec("svn co svn://svn.phpontrax.com/trax/trunk/trax/vendor/trax trax");
chdir("../");
echo "updating config files\n";
$htaccess = file_get_contents("./public/.htaccess");
file_put_contents("./public/.htaccess", str_replace(dirname(__FILE__) . "/trax-standalone/config", "/home/username/trax/config", $htaccess));
$environment = file_get_contents("./config/environment.php");
$environment = str_replace("# define(\"PHP_LIB_ROOT\",    \"/usr/local/lib/php\");", "define(\"PHP_LIB_ROOT\",    dirname(dirname(__FILE__)).\"/vendor/PEAR\");", $environment);
$environment = str_replace("# define(\"TRAX_ROOT\",       dirname(dirname(__FILE__)));", "define(\"TRAX_ROOT\",       dirname(dirname(__FILE__)));", $environment);
file_put_contents("./config/environment.php", $environment);
include "./vendor/trax/trax.php";
$version = Trax::version();
chdir("../");
exec("tar zcvf trax-standalone-" . $version . ".tar.gz trax-standalone");
echo "done creating standalone Trax\n";