| 46 | | <!-- Set the cache permission property --> |
|---|
| | 48 | <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> |
|---|
| | 57 | </target> |
|---|
| | 58 | |
|---|
| | 59 | <target name="setup-examples" description="Sets up all examples."> |
|---|
| | 60 | <echo>----------------------------------</echo> |
|---|
| | 61 | <echo>| Setup examples |</echo> |
|---|
| | 62 | <echo>----------------------------------</echo> |
|---|
| | 63 | <if> |
|---|
| | 64 | <available file="${stubbles.projects.path}/examples/build.xml"/> |
|---|
| | 65 | <then> |
|---|
| | 66 | <phing phingfile="${stubbles.projects.path}/examples/build.xml" inheritAll="false" target="main"> |
|---|
| | 67 | <property name="javascript.srcpath" value="${stubbles.projects.path}/common/docroot/javascript"/> |
|---|
| | 68 | </phing> |
|---|
| | 69 | </then> |
|---|
| | 70 | <else> |
|---|
| | 71 | <echo>Project examples not available, can not setup examples.</echo> |
|---|
| | 72 | </else> |
|---|
| | 73 | </if> |
|---|
| | 74 | </target> |
|---|
| | 75 | |
|---|
| | 76 | <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" /> |
|---|
| | 78 | <delete dir="${stubbles.projects.path}/examples" includeemptydirs="true" verbose="true" failonerror="true"/> |
|---|
| | 79 | </target> |
|---|
| | 80 | |
|---|
| | 81 | <target name="clean-dist" description="Removes project dist from the build."> |
|---|
| | 82 | <echo>----------------------------------</echo> |
|---|
| | 83 | <echo>| Removing dist project |</echo> |
|---|
| | 84 | <echo>----------------------------------</echo> |
|---|
| | 85 | <echo>After removing the dist files, you will not be able to execute "setup-project" anymore.</echo> |
|---|
| | 86 | <input propertyname="cleanup.dist.confirm" promptChar="?" defaultValue="N">Are you sure, you want to remove project dist? (Y/N)</input> |
|---|
| | 87 | <if> |
|---|
| | 88 | <equals arg1="${cleanup.dist.confirm}" arg2="Y" casesensitive="false" /> |
|---|
| | 89 | <then> |
|---|
| | 90 | <delete dir="${stubbles.projects.path}/dist" includeemptydirs="true" verbose="true" failonerror="true"/> |
|---|
| | 91 | </then> |
|---|
| | 92 | </if> |
|---|
| | 93 | </target> |
|---|
| | 94 | |
|---|
| | 95 | <target name="init-stubbles" depends="projectcheck" description="Loads class loader."> |
|---|
| | 96 | <echo>----------------------------------</echo> |
|---|
| | 97 | <echo>| Loading Stubbles classloader |</echo> |
|---|
| | 98 | <echo>----------------------------------</echo> |
|---|
| | 99 | <stubInitConfig configPath="${stubbles.projects.path}/${stubbles.project}/config"/> |
|---|
| | 100 | <stubInitClassLoader/> |
|---|
| | 101 | </target> |
|---|
| | 102 | |
|---|
| | 103 | <target name="clear-cache" description="Removes all cache files."> |
|---|
| | 104 | <echo>----------------------------------</echo> |
|---|
| | 105 | <echo>| Clearing cache |</echo> |
|---|
| | 106 | <echo>----------------------------------</echo> |
|---|
| | 107 | <delete file="${stubbles.lib.path}/.cache" verbose="true"/> |
|---|
| | 108 | <delete> |
|---|
| | 109 | <fileset dir="${stubbles.projects.path}"> |
|---|
| | 110 | <include name="**/cache/**"/> |
|---|
| | 111 | </fileset> |
|---|
| | 112 | </delete> |
|---|
| | 113 | </target> |
|---|
| | 114 | |
|---|
| 55 | | <!-- Set the JSON-RPC properties --> |
|---|
| 56 | | <target name="setup-json-rpc" unless="jsonrpc.clients.dir" description="Basic setup for JSON-RPC functionality"> |
|---|
| 57 | | <input propertyname="jsonrpc.enabled" promptChar="?" defaultValue="Y">Do you want to enable JSON-RPC functionality? (Y/N)</input> |
|---|
| 58 | | <if> |
|---|
| 59 | | <equals arg1="${jsonrpc.enabled}" arg2="Y" casesensitive="false"/> |
|---|
| 60 | | <then> |
|---|
| 61 | | <echo>----------------------------------</echo> |
|---|
| 62 | | <echo>| Setting up JSON-RPC package |</echo> |
|---|
| 63 | | <echo>----------------------------------</echo> |
|---|
| 64 | | <input propertyname="jsonrpc.clients.dir" promptChar=":" defaultValue="genjs">Please supply the directory for generated clients</input> |
|---|
| 65 | | <input propertyname="jsonrpc.clients.ns" promptChar=":" defaultValue="stubbles.json.proxy">Please supply the JavaScript namespace for the generated proxies (without '.' at the end)</input> |
|---|
| 66 | | |
|---|
| 67 | | <append destFile="build.properties" text="jsonrpc.clients.dir=${jsonrpc.clients.dir}${line.separator}"/> |
|---|
| 68 | | <append destFile="build.properties" text="jsonrpc.clients.ns=${jsonrpc.clients.ns}${line.separator}"/> |
|---|
| 69 | | <copy file="${stubbles.config.path}/json-rpc-service-dist.ini" tofile="${stubbles.config.path}/json-rpc-service.ini" overwrite="true"> |
|---|
| 70 | | <filterchain> |
|---|
| 71 | | <expandproperties /> |
|---|
| 72 | | </filterchain> |
|---|
| 73 | | </copy> |
|---|
| 74 | | </then> |
|---|
| 75 | | <else> |
|---|
| 76 | | <echo>JSON-RPC initialization skipped.</echo> |
|---|
| 77 | | </else> |
|---|
| 78 | | </if> |
|---|
| 79 | | </target> |
|---|
| 80 | | |
|---|
| 81 | | <!-- Set up all processors to be used --> |
|---|
| 82 | | <target name="setup-processors" description="asks user which processors he likes to have"> |
|---|
| 83 | | <echo>------------------------</echo> |
|---|
| 84 | | <echo>| Setting up processors |</echo> |
|---|
| 85 | | <echo>------------------------</echo> |
|---|
| 86 | | <echo>Please choose which of the processors you'd like to have.</echo> |
|---|
| 87 | | <echo>Just comma seperate them (e.g. bla,bla,bla).</echo> |
|---|
| 88 | | <input propertyname="processors.choosen" promptChar=":" defaultValue="${processors.all}">choose processors</input> |
|---|
| 89 | | <input propertyname="processors.default" promptChar=":" validArgs="${processors.choosen}">choose default processor</input> |
|---|
| 90 | | <xslt file="${processors.dist.file}" tofile="${processors.default.file}" style="setup/processors.xsl" overwrite="true"> |
|---|
| 91 | | <param name="choosenProcs" expression="${processors.choosen}" /> |
|---|
| 92 | | <param name="defaultProc" expression="${processors.default}" /> |
|---|
| 93 | | </xslt> |
|---|
| 94 | | </target> |
|---|
| 95 | | |
|---|
| 96 | | <!-- Set up rewrite rules --> |
|---|
| 97 | | <target name="setup-rewrite-rules" description="set rewrite rules based on processor configuration"> |
|---|
| 98 | | <echo>----------------------------</echo> |
|---|
| 99 | | <echo>| Setting up rewrite rules |</echo> |
|---|
| 100 | | <echo>----------------------------</echo> |
|---|
| 101 | | <stubGenerateRewriteRules selectedProcessors="${processors.choosen}" /> |
|---|
| 102 | | </target> |
|---|
| 103 | | |
|---|
| 104 | | <!-- Enable logging functionality --> |
|---|
| 105 | | <target name="setup-logging" unless="logging.enabled" description="Basic setup for logging functionality"> |
|---|
| 106 | | <input propertyname="logging.enabled" promptChar="?" defaultValue="Y">Do you want to enable logging functionality? (Y/N)</input> |
|---|
| 107 | | <if> |
|---|
| 108 | | <equals arg1="${logging.enabled}" arg2="Y" casesensitive="false"/> |
|---|
| 109 | | <then> |
|---|
| 110 | | <echo>----------------------------------</echo> |
|---|
| 111 | | <echo>| Setting up logging package |</echo> |
|---|
| 112 | | <echo>----------------------------------</echo> |
|---|
| 113 | | <copy file="${stubbles.config.path}/xml/logging-dist.xml" tofile="${stubbles.config.path}/xml/logging.xml" overwrite="true" /> |
|---|
| 114 | | <append destFile="build.properties" text="logging.enabled=true${line.separator}"/> |
|---|
| 115 | | </then> |
|---|
| 116 | | <else> |
|---|
| 117 | | <append destFile="build.properties" text="logging.enabled=false${line.separator}"/> |
|---|
| 118 | | <echo>Logging initialization skipped.</echo> |
|---|
| 119 | | </else> |
|---|
| 120 | | </if> |
|---|
| 121 | | </target> |
|---|
| 122 | | |
|---|
| 123 | | <!-- Enable website functionality --> |
|---|
| 124 | | <target name="setup-website" unless="variantmanager.enabled" description="Basic setup for website functionality"> |
|---|
| 125 | | <copy file="${stubbles.config.path}/xml/config-dist.xml" tofile="${stubbles.config.path}/xml/config.xml" overwrite="true" /> |
|---|
| 126 | | <copy file="${stubbles.config.path}/xml/interceptors-dist.xml" tofile="${stubbles.config.path}/xml/interceptors.xml" overwrite="true" /> |
|---|
| 127 | | <copy file="${stubbles.config.path}/xml/processors-dist.xml" tofile="${stubbles.config.path}/xml/processors.xml" overwrite="true" /> |
|---|
| 128 | | <input propertyname="variantmanager.enabled" promptChar="?" defaultValue="Y">Do you want to enable variant manager functionality? (Y/N)</input> |
|---|
| 129 | | <if> |
|---|
| 130 | | <equals arg1="${variantmanager.enabled}" arg2="Y" casesensitive="false"/> |
|---|
| 131 | | <then> |
|---|
| 132 | | <echo>-------------------------------------</echo> |
|---|
| 133 | | <echo>| Setting up VariantManager package |</echo> |
|---|
| 134 | | <echo>-------------------------------------</echo> |
|---|
| 135 | | <copy file="${stubbles.config.path}/xml/variantmanager-dist.xml" tofile="${stubbles.config.path}/xml/variantmanager.xml" overwrite="true" /> |
|---|
| 136 | | <append destFile="build.properties" text="variantmanager.enabled=true${line.separator}"/> |
|---|
| 137 | | </then> |
|---|
| 138 | | <else> |
|---|
| 139 | | <append destFile="build.properties" text="variantmanager.enabled=false${line.separator}"/> |
|---|
| 140 | | <echo>VariantManager initialization skipped.</echo> |
|---|
| 141 | | </else> |
|---|
| 142 | | </if> |
|---|
| 143 | | </target> |
|---|
| 144 | | |
|---|
| 145 | | <!-- |
|---|
| 146 | | Setup examples |
|---|
| 147 | | --> |
|---|
| 148 | | <target name="setup-examples" depends="init-stubbles" description="Sets up all examples."> |
|---|
| 149 | | <echo>----------------------------------</echo> |
|---|
| 150 | | <echo>| Removing dist files |</echo> |
|---|
| 151 | | <echo>----------------------------------</echo> |
|---|
| 152 | | <phing phingfile="${project.basedir}/examples/build.xml" inheritAll="false" target="main"> |
|---|
| 153 | | <property name="javascript.srcpath" value="${project.basedir}/docroot/javascript" /> |
|---|
| 154 | | </phing> |
|---|
| 155 | | </target> |
|---|
| 156 | | |
|---|
| 157 | | <!-- |
|---|
| 158 | | Cleanup dist-files |
|---|
| 159 | | --> |
|---|
| 160 | | <target name="clean-dist" depends="init-stubbles" description="Removes left-over dist-files from the build."> |
|---|
| 161 | | <echo>----------------------------------</echo> |
|---|
| 162 | | <echo>| Removing dist files |</echo> |
|---|
| 163 | | <echo>----------------------------------</echo> |
|---|
| 164 | | <echo>After removing the dist files, you will not be able to execute "setup-project" anymore.</echo> |
|---|
| 165 | | <input propertyname="cleanup.dist.confirm" promptChar="?" defaultValue="N">Are you sure, you want to cleanup all dist files? (Y/N)</input> |
|---|
| 166 | | <if> |
|---|
| 167 | | <equals arg1="${cleanup.dist.confirm}" arg2="Y" casesensitive="false" /> |
|---|
| 168 | | <then> |
|---|
| 169 | | <delete file="${project.basedir}/build-dist.xml"/> |
|---|
| 170 | | <delete file="${project.basedir}/config/php/config-dist.php"/> |
|---|
| 171 | | <delete> |
|---|
| 172 | | <fileset dir="${stubbles.config.path}"> |
|---|
| 173 | | <include name="**/*-dist.xml"/> |
|---|
| 174 | | </fileset> |
|---|
| 175 | | </delete> |
|---|
| 176 | | </then> |
|---|
| 177 | | <else> |
|---|
| 178 | | <echo>No dist files have been deleted.</echo> |
|---|
| 179 | | </else> |
|---|
| 180 | | </if> |
|---|
| 181 | | </target> |
|---|
| 182 | | |
|---|
| 183 | | <!-- |
|---|
| 184 | | Cleanup basic configuration options |
|---|
| 185 | | --> |
|---|
| 186 | | <target name="clean-config" depends="init-stubbles" description="Removes the configuration added during setup."> |
|---|
| 187 | | <echo>----------------------------------</echo> |
|---|
| 188 | | <echo>| Removing configuration files |</echo> |
|---|
| 189 | | <echo>----------------------------------</echo> |
|---|
| 190 | | <delete file="${project.basedir}/build.properties"/> |
|---|
| 191 | | </target> |
|---|
| 192 | | |
|---|
| 193 | | <!-- |
|---|
| 194 | | Loads Stubbles configuration and sets Phing properties |
|---|
| 195 | | --> |
|---|
| 196 | | <target name="init-stubbles-config" description="Loads necessary configuration files."> |
|---|
| 197 | | <echo>----------------------------------</echo> |
|---|
| 198 | | <echo>| Loading Stubbles configuration |</echo> |
|---|
| 199 | | <echo>----------------------------------</echo> |
|---|
| 200 | | <property file="build.properties" /> |
|---|
| 201 | | <stubInitConfig configPath="${project.basedir}/config/"/> |
|---|
| 202 | | <echo>Config directory : ${stubbles.config.path}</echo> |
|---|
| 203 | | <echo>Cache directory : ${stubbles.cache.path}</echo> |
|---|
| 204 | | <echo>Source directory : ${stubbles.src.path}</echo> |
|---|
| 205 | | <echo>Lib directory : ${stubbles.lib.path}</echo> |
|---|
| 206 | | <echo>Log directory : ${stubbles.log.path}</echo> |
|---|
| 207 | | </target> |
|---|
| 208 | | |
|---|
| 209 | | <!-- |
|---|
| 210 | | Loads Stubbles class loader |
|---|
| 211 | | --> |
|---|
| 212 | | <target name="init-stubbles" depends="init-stubbles-config" description="Loads class loader."> |
|---|
| 213 | | <echo>----------------------------------</echo> |
|---|
| 214 | | <echo>| Loading Stubbles classloader |</echo> |
|---|
| 215 | | <echo>----------------------------------</echo> |
|---|
| 216 | | <stubInitClassLoader/> |
|---|
| 217 | | </target> |
|---|
| 218 | | |
|---|
| 219 | | <!-- |
|---|
| 220 | | Clears all cache files |
|---|
| 221 | | --> |
|---|
| 222 | | <target name="clear-cache" depends="init-stubbles-config" description="Removes all cache files."> |
|---|
| 223 | | <echo>----------------------------------</echo> |
|---|
| 224 | | <echo>| Clearing cache |</echo> |
|---|
| 225 | | <echo>----------------------------------</echo> |
|---|
| 226 | | <delete file="${stubbles.lib.path}/.cache" verbose="true"/> |
|---|
| 227 | | <delete> |
|---|
| 228 | | <fileset dir="projects"> |
|---|
| 229 | | <include name="**/cache/**" /> |
|---|
| 230 | | </fileset> |
|---|
| 231 | | </delete> |
|---|
| 232 | | </target> |
|---|
| 233 | | |
|---|
| 234 | | <!-- |
|---|
| 235 | | Sets permissions on folders |
|---|
| 236 | | --> |
|---|
| 237 | | <target name="prepare-folders" depends="init-stubbles" description="Adjusts directory permissions of directories."> |
|---|
| | 123 | <target name="prepare-folders" depends="cache-permission-check" description="Adjusts permissions of directories."> |
|---|