Skip to content

Commit

Permalink
Adding Phing build file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswsinc committed Apr 22, 2015
1 parent 6716475 commit 78f95b4
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 2 deletions.
51 changes: 51 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-model xlink:href="/usr/share/php5/PEAR/data/phing/etc/phing-grammar.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0" ?>

<project name="HTML Compressor" default="default">

<property name="build_dir" value=".~build" />
<property name="phar_file" value="${build_dir}/html-compressor.phar" />
<property name="phar_stub_file" value="stub.php" />
<property name="vendor_dir" value="includes/vendor" />
<property name="composer_lock" value="composer.lock" />

<target name="preamble">
<echo msg="PHP version: ${php.version}" />
<echo msg="Phing version: ${phing.version}" />
<echo msg="------------------------------------" />
<echo msg="Project: ${phing.project.name}" />
<echo msg="Base directory: ${project.basedir}" />
<echo msg="------------------------------------" />
</target>

<target name="prepare" depends="preamble">
<echo msg="Preparing to build..." />

<echo msg="Deleting previous: ${build_dir} ..." />
<delete dir="${build_dir}" includeemptydirs="true" quiet="true" />

<echo msg="Deleting previous: ${vendor_dir} ..." />
<delete dir="${vendor_dir}" includeemptydirs="true" quiet="true" />

<echo msg="Deleting previous: ${composer_lock} ..." />
<delete file="${composer_lock}" quiet="true" />

<echo msg="------------------------------------" />
</target>

<target name="build" depends="prepare">
<echo msg="Creating: ${build_dir} ..." />
<mkdir dir="${build_dir}" />

<echo msg="Running Composer..." />
<composer composer="composer" />

<echo msg="Creating PHAR package file..." />
<pharpackage basedir="./" stub="${phar_stub_file}" destfile="${phar_file}" />
</target>

<target name="default" depends="build_or_rebuild">
<echo msg="Build complete! :-)" />
</target>

</project>
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@

"autoload" : {
"psr-4": {
"WebSharks\\HtmlCompressor\\": "includes/classes/"
"WebSharks\\HtmlCompressor\\": "src/includes/classes/"
}
},

"config" : {
"vendor-dir": "includes/vendor"
"vendor-dir": "src/includes/vendor"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* HTML Compressor Stub.
*
* @since 150421 Improving PHAR support.
*
* @author JasWSInc <https://github.com/jaswsinc>
* @copyright WebSharks, Inc. <http://www.websharks-inc.com>
* @license GNU General Public License, version 2
*/
namespace WebSharks\HtmlCompressor;

require_once dirname(__FILE__).'/includes/classes/Core.php';

0 comments on commit 78f95b4

Please sign in to comment.