Changeset 1645

Show
Ignore:
Timestamp:
06/23/08 14:25:51 (3 months ago)
Author:
mikey
Message:

add phing setup-project

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/stubbles/build.xml

    r1638 r1645  
    5555        <include name="cache"/> 
    5656        <include name="config/**"/> 
    57         <include name="docroot/**"/> 
     57        <include name="docroot"/> 
    5858        <include name="log"/> 
    5959        <include name="pages/**"/> 
     
    7676    <mkdir dir="${build.src.dir}/src/main/php" /> 
    7777    <mkdir dir="${build.src.dir}/src/main/resources" /> 
     78    <mkdir dir="${build.src.dir}/src/main/resources/build" /> 
    7879    <mkdir dir="${build.src.dir}/src/test/php" /> 
    7980    <mkdir dir="${build.src.dir}/src/test/resources" /> 
     
    9798      </fileset> 
    9899    </copy> 
     100    <copy file="${stubbles.base.dir}/projects/dist/docroot/.htaccess" tofile="${build.src.dir}/src/main/resources/build/.htaccess-dist" overwrite="true"/> 
    99101    <copy file="${stubbles.base.dir}/src/main/resources/phing/build.xml" tofile="${build.src.dir}/build-dist.xml" /> 
    100102    <copy file="${stubbles.base.dir}/src/main/resources/phing/build-stubbles.xml" tofile="${build.src.dir}/build-stubbles.xml" /> 
    101     <copy file="${stubbles.base.dir}/src/main/resources/phing/processors.xsl" tofile="${build.src.dir}/setup/processors.xsl" /> 
     103    <copy file="${stubbles.base.dir}/src/main/resources/phing/build-project.xml" tofile="${build.src.dir}/build-project.xml" /> 
     104    <copy file="${stubbles.base.dir}/src/main/resources/phing/processors.xsl" tofile="${build.src.dir}/src/main/resources/build/processors.xsl" /> 
    102105    <copy file="${stubbles.base.dir}/src/main/resources/phing/stubbles.sh" tofile="${build.src.dir}/stubbles.sh"> 
    103106      <filterchain> 
  • trunk/src/main/php/org/stubbles/phing/tasks/stubGenerateRewriteRulesTask.php

    r1153 r1645  
    1919     * source file 
    2020     * 
    21      * @var string 
     21     * @var string 
    2222     */ 
    23     protected $src
     23    protected $htaccessSource
    2424    /** 
    25      * target file 
     25     * destination directory 
    2626     * 
    27      * @var string 
     27     * @var string 
    2828     */ 
    29     protected $dest
     29    protected $destinationDir
    3030    /** 
    3131     * gets htaccess lines appendend  
    3232     * 
    33      * @var string 
     33     * @var string 
    3434     */ 
    3535    protected $htaccess; 
     
    3737     * commaseperated list of processors 
    3838     * 
    39      * @var string 
     39     * @var string 
    4040     */ 
    4141    protected $selectedProcessors; 
    42      
     42 
    4343    /** 
    4444     * constructor 
     
    4646    public function init() 
    4747    { 
    48         $this->src  = 'docroot/.htaccess-dist'; 
    49         $this->dest = 'docroot/.htaccess'; 
     48        // intentionally empty 
    5049    } 
    51      
     50 
    5251    /** 
    5352     * setter for build process 
    5453     * 
    55      * @param string $procs 
     54     * @param string $procs 
    5655     */ 
    5756    public function setSelectedProcessors($procs) 
     
    5958        $this->selectedProcessors = $procs; 
    6059    } 
    61      
     60 
     61    /** 
     62     * sets source file for .htaccess 
     63     * 
     64     * @param  string  $htaccessSource 
     65     */ 
     66    public function setHtaccessSource($htaccessSource) 
     67    { 
     68        $this->htaccessSource = $htaccessSource; 
     69    } 
     70 
     71    /** 
     72     * sets destination directory 
     73     * 
     74     * @param  string  $destinationDir 
     75     */ 
     76    public function setDestinationDir($destinationDir) 
     77    { 
     78        $this->destinationDir = $destinationDir; 
     79    } 
     80 
    6281    /** 
    6382     * construct .htaccess and write content 
    6483     * 
    65      * @param  array<strings>  $processor
     84     * @param  array<string>  $selectedProc
    6685     */ 
    6786    public function writeHtacess($selectedProcs) 
    6887    { 
    69         $lines = file($this->src); 
    70          
     88        $lines = file($this->htaccessSource); 
    7189        foreach ($lines as $line) { 
    72             if(preg_match('/^RewriteRule.*/', $line)) { 
     90            if (preg_match('/^RewriteRule.*/', $line)) { 
    7391                foreach ($selectedProcs as $selProc) { 
    74                     $this->htaccess .= preg_match('/^RewriteRule '.$selProc.'.*/', $line) ? $line: ''
     92                    $this->htaccess .= (preg_match('/^RewriteRule ' . $selProc . '.*/', $line) ? ($line) : (''))
    7593                } 
    7694            } else {                 
     
    7997        } 
    8098         
    81         file_put_contents($this->dest, $this->htaccess); 
     99        file_put_contents($this->destinationDir . '/.htaccess', $this->htaccess); 
    82100    } 
    83      
     101 
    84102    /** 
    85103     * implement main method of phing Task 
  • trunk/src/main/resources/phing/build-stubbles.xml

    r1641 r1645  
    11<?xml version="1.0"?> 
    22<project name="Stubbles" basedir="." default="main"> 
    3   <property name="stubbles.lib.path" value="${project.basedir}/lib" /> 
    4   <property name="stubbles.projects.path" value="${project.basedir}/projects" /> 
    5   <property name="stubbles.src.path" value="${project.basedir}/src/main" /> 
    6   <property name="phing.task.dir" value="${project.basedir}/src/main/php/org/stubbles/phing/tasks" /> 
    7   <taskDef name="stubInitConfig" classname="stubInitConfigTask" classpath="${phing.task.dir}" /> 
    8   <taskDef name="stubInitClassLoader" classname="stubInitClassLoaderTask" classpath="${phing.task.dir}" /> 
    9   <taskDef name="stubGenerateJsonRpcProxies" classname="stubGenerateJsonRpcProxiesTask" classpath="${phing.task.dir}" /> 
     3  <property name="stubbles.lib.path" value="${project.basedir}/lib"/> 
     4  <property name="stubbles.projects.path" value="${project.basedir}/projects"/> 
     5  <property name="stubbles.src.path" value="${project.basedir}/src/main"/> 
     6  <property name="stubbles.project.path" value="${stubbles.projects.path}/${stubbles.project}"/> 
     7  <property name="phing.task.dir" value="${project.basedir}/src/main/php/org/stubbles/phing/tasks"/> 
     8  <taskDef name="stubInitConfig" classname="stubInitConfigTask" classpath="${phing.task.dir}"/> 
     9  <taskDef name="stubInitClassLoader" classname="stubInitClassLoaderTask" classpath="${phing.task.dir}"/> 
     10  <taskDef name="stubGenerateJsonRpcProxies" classname="stubGenerateJsonRpcProxiesTask" classpath="${phing.task.dir}"/> 
    1011 
    1112  <target name="main" depends="prepare-folders, generate-clients" description="Executes all targets."> 
     
    4748 
    4849  <target name="projectcheck" unless="stubbles.project"> 
    49     <echo message="====================================================="/> 
    50     <echo message="Version not specified. You must enter a version. In"/> 
    51     <echo message="the future you can add this to build.properties or"/> 
    52     <echo message="enter it on the command line: "/> 
    53     <echo message=" "/> 
    54     <echo message="-stubbles.project=example"/> 
    55     <echo message="====================================================="/> 
    56     <input propertyname="stubbles.project" promptChar=":">stubbles.project</input> 
     50    <input propertyname="stubbles.project" promptChar=":">Please enter the name of the project</input> 
    5751  </target> 
    5852 
     
    7569 
    7670  <target name="clean-examples" description="Removes all example related stuff."> 
    77     <delete dir="${stubbles.src.path}/php/org/stubbles/examples" includeemptydirs="true" verbose="true" failonerror="true" /> 
     71    <delete dir="${stubbles.src.path}/php/org/stubbles/examples" includeemptydirs="true" verbose="true" failonerror="true"/> 
    7872    <delete dir="${stubbles.projects.path}/examples" includeemptydirs="true" verbose="true" failonerror="true"/> 
    7973  </target> 
     
    155149      </then> 
    156150      <else> 
    157         <echo>No json-rpc-service.ini configuration file available.</echo> 
     151        <echo>No json-rpc-service.ini configuration file available for project ${stubbles.project}.</echo> 
    158152        <echo>Skipping JSON-RPC client generation.</echo> 
    159153      </else> 
  • trunk/src/main/resources/phing/build.xml

    r1641 r1645  
    66  --> 
    77  <target name="main" description="Build project."> 
    8     <property file="build.properties" /> 
     8    <property file="build.properties"/> 
    99    <phing phingfile="build-stubbles.xml" target="main"/> 
     10  </target> 
     11 
     12  <target name="setup-project" description="Create a new project within installation."> 
     13    <phing phingfile="build-project.xml" target="setup-project"/> 
     14  </target> 
     15 
     16  <target name="generate-clients" description="Generates JSON-RPC clients for all projects."> 
     17    <phing phingfile="build-project.xml" target="generate-clients"/> 
    1018  </target> 
    1119