Customizing the Smarty SVN dev env

2 views
Skip to first unread message

Thue Janus Kristensen

unread,
Dec 26, 2009, 6:21:08 PM12/26/09
to smarty-d...@googlegroups.com
Here is a small patch to support customizing the SVN dev environment. The goal of this patch is to be able to modify the dev settings such as the location of the php binary, without modifying any files in SVN. This will make svn diff easier to run, as the result of svn diff will then not include installation-specific changes.

With this patch, php programs who want to call the php command line binary can include development/dev_settings.php , which will then first look in development/local_dev_settings.php , and if $smarty_dev_php_cli_bin is not set there it will set $smarty_dev_php_cli_bin to a default value ("php").

development/local_dev_settings.php is added to svn:ignore, so won't show up in svn diff or svn status.

The current SVN is customized to Uwe. To work on Uwe's computer after this patch, Uwe should add the following to development/local_dev_settings.php :
   $smarty_dev_php_cli_bin = "C:\wamp\bin\php\php5.2.9-1\php";

The patch also adds a small simple Makefile, which is useful on Unix/Linux when working on the command line.

Hope this is not too much thought about a small problem :)

Regards, Thue

(Patch is both attached and shown here inline)

Property changes on: .
___________________________________________________________________
Name: svn:ignore
   + local_dev_settings.php


Index: lexer/Create_Config_Parser.php
===================================================================
--- lexer/Create_Config_Parser.php      (revision 3406)
+++ lexer/Create_Config_Parser.php      (working copy)
@@ -1,6 +1,7 @@
 <?php
+require_once(dirname(__FILE__)."/../dev_settings.php");
 // Create Parser
-passthru('C:\wamp\bin\php\php5.2.9-1\php ./ParserGenerator/cli.php smarty_internal_configfileparser.y');
+passthru("$smarty_dev_php_cli_bin ./ParserGenerator/cli.php smarty_internal_configfileparser.y");

 // Create Lexer
 require_once './LexerGenerator.php';
Index: lexer/Create_Template_Parser.php
===================================================================
--- lexer/Create_Template_Parser.php    (revision 3406)
+++ lexer/Create_Template_Parser.php    (working copy)
@@ -1,6 +1,7 @@
 <?php
+require_once(dirname(__FILE__)."/../dev_settings.php");
 // Create Parser
-passthru('C:\wamp\bin\php\php5.2.9-1\php ./ParserGenerator/cli.php smarty_internal_templateparser.y');
+passthru("$smarty_dev_php_cli_bin ./ParserGenerator/cli.php smarty_internal_templateparser.y");

 // Create Lexer
 require_once './LexerGenerator.php';
Index: dev_settings.php
===================================================================
--- dev_settings.php    (revision 0)
+++ dev_settings.php    (revision 0)
@@ -0,0 +1,11 @@
+<?php
+
+if (file_exists(dirname(__FILE__)."/local_dev_settings.php")) {
+  require_once(dirname(__FILE__)."/local_dev_settings.php");
+}
+
+if (!isset($smarty_dev_php_bin)) {
+  $smarty_dev_php_cli_bin = "php";
+}
+
+?>
Index: Makefile
===================================================================
--- Makefile    (revision 0)
+++ Makefile    (revision 0)
@@ -0,0 +1,10 @@
+all: config-compiler template-compiler unit-test
+
+config-compiler:
+       cd lexer; php Create_Config_Parser.php
+
+template-compiler:
+       cd lexer; php Create_Template_Parser.php
+
+unit-test:
+       cd PHPunit; phpunit smartytests.php

smarty_local_dev_settings.patch
Reply all
Reply to author
Forward
0 new messages