Skip to content

Commit

Permalink
Adding build.xml and new dashboard demo page
Browse files Browse the repository at this point in the history
* build.xml with build & deploy targets
* new demo page
  • Loading branch information
Wojtek Oledzki committed Jun 23, 2013
1 parent 3d4fbf4 commit 9f93a2e
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
#
/logs

##
# Build, Dev, Test
/cache
/vendor
/out
/build.properties
/build.*.properties
101 changes: 101 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<project name="dashboard.hoborglabs.com" default="help" basedir=".">

<!-- optional environmental settings -->
<property file="build.properties" />

<!-- set default values if not already set in build.properties -->
<property name="dir.base" location="." />
<property name="dir.src" location="${dir.base}" />
<property name="dir.out" location="${dir.base}/out" />

<!-- Commands aliases -->
<property name="cmd.ds-console" value="console.php" />

<target name="build"
description="Builds Website."
depends="clean, build.assets, build.html"
>
<exec executable="git" outputproperty="build.version">
<arg line="log" />
<arg line="-1" />
<arg line="--format=%h" />
</exec>

<echo level="info">Packing website contnet.</echo>
<delete file="${dir.out}/dashboard.hoborglabs.com.${build.version}.tgz" failonerror="no" />
<tar destfile="${dir.out}/dashboard.hoborglabs.com.${build.version}.tgz" basedir="${dir.out}" compression="gzip" />
</target>

<target name="clean">
<echo level="info">Cleaning `${dir.out}` folder</echo>
<mkdir dir="${dir.out}" />
<delete>
<fileset dir="${dir.out}">
<include name="**" />
<include name="**/*" />
</fileset>
</delete>
</target>

<target name="build.assets"
description="Copy css, js and other assets to target folder"
>
<echo level="info">Copying CSS.</echo>
<mkdir dir="${dir.out}/styles/" />
<copy todir="${dir.out}/styles">
<fileset dir="${dir.src}/htdocs/styles">
<include name="css/*.css" />
<include name="gfx/**/*.png" />
<include name="gfx/**/*.gif" />
<include name="gfx/**/*.jpg" />
</fileset>
</copy>

<echo level="info">Copying images.</echo>
<mkdir dir="${dir.out}/images/" />
<copy todir="${dir.out}/images">
<fileset dir="${dir.src}/htdocs/images">
<include name="screenshots/*.*" />
<include name="*.*" />
</fileset>
</copy>
</target>

<target name="build.html">
<mkdir dir="${dir.out}/doc" />

<!-- If ds.env is not set, use "prod" -->
<property name="ds.env" value="prod" />

<echo level="info">Generating HTML to `${dir.out}` folder</echo>
<exec executable="php" failonerror="true">
<env key="DS_HOSTDIR" value="${dir.src}" />
<env key="DS_ENV" value="${ds.env}" />
<arg line="${cmd.ds-console}" />
<arg line="ds:generate" />
<arg line="--source='/'" />
<arg line="--output='${dir.out}'" />
</exec>
</target>

<target name="deploy" if="deploy.do_deploy">
<scp file="${dir.out}/dashboard.hoborglabs.com.${build.version}.tgz"
todir="${deploy.user}@${deploy.host}:${deploy.target}"
keyfile="${deploy.keyfile}"
/>
<sshexec host="${deploy.host}"
username="${deploy.user}"
keyfile="${deploy.keyfile}"
command="tar xzf ${deploy.target}/dashboard.hoborglabs.com.${build.version}.tgz -C ${deploy.target}/public"
/>
</target>

<!-- Help Message -->
<target name="help"
description="Prints this help"
>
<exec executable="ant">
<arg value="-p" />
</exec>
</target>
</project>
34 changes: 34 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "hoborglabs/display-service-bundle",
"description": "Display Service symfony2 bundle",
"type": "library",
"config": {
"vendor-dir": "vendors"
},
"keywords": ["xml", "xslt"],
"homepage": "http://hoborglabs.com",
"license": "MIT",
"authors": [
{
"name": "Wojtek Oledzki",
"email": "wojtek@hoborglabs.com",
"homepage": "http://wojtek.oledzki.info"
}
],
"repositories": [
{ "type": "vcs", "url": "git@bitbucket.org:hoborglabs/CommonsBundle.git" },
{ "type": "vcs", "url": "git@bitbucket.org:hoborglabs/displayservicebundle.git" }
],
"require": {
"php": ">=5.3.0",
"symfony/symfony": "2.0.15",
"hoborglabs/display-service-bundle": "*",
"hoborglabs/commons-bundle": "*",
"hoborglabs/dashboard": "*"
},
"autoload": {
"psr-0": {
"Hoborg": "src"
}
}
}
16 changes: 16 additions & 0 deletions demo-files/widget/demo/view.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="panel" style="text-align: center">
<span class="text-L {{header.class}}">{{header.text}}</span>
</div>
<div class="content">
<table class="text-L">
<tbody>
{{#data.data}}
<tr>
<?php foreach ($row as $col) : ?>
<td><?php echo $col; ?></td>
<?php endforeach; ?>
</tr>
{{/data.data}}
</tbody>
</table>
</div>
41 changes: 41 additions & 0 deletions demo-files/widget/demo/widget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* This is very simple widget for displaying basic information on a widget.
*/
class InfoWidget extends \Hoborg\Dashboard\Widget {

public function bootstrap() {
$widget = $this->data;

if (empty($widget['data']['conf']['file'])) {
$widget['body'] = 'no conf';
$widget['error'] = "Data file not configured: widget.conf.data";
return $widget;
}

$dataFile = $this->kernel->findFileOnPath(
$widget['data']['conf']['file'],
$this->kernel->getDataPath()
);

if (!is_readable($dataFile)) {
$widget['body'] = "$dataFile not readable";
$widget['error'] = "Data file ({$dataFile}) not readable";
return $widget;
}

$data = json_decode(file_get_contents($dataFile), true);

$view = array(
'header.text' => $data['header']['text'],
'header.class' =>$data['header']['status'],
'data' => $data['data'],
);
ob_start();
include __DIR__ . '/view.phtml';
$widget['body'] = ob_get_clean();

$this->data = $widget;
}
}
8 changes: 8 additions & 0 deletions htdocs/dashboard-demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
$rootPath = __DIR__ . '/..';
require_once "{$rootPath}/vendor/autoload.php";

$kernel = new \Hoborg\Dashboard\Kernel($rootPath, 'dev');
$kernel->addExtensionPath("{$rootPath}/demo-files");
$kernel->setDefaultParam('conf', 'demo');
$kernel->handle(array_merge($_GET, $_POST));
16 changes: 0 additions & 16 deletions htdocs/demo/index.php

This file was deleted.

3 changes: 3 additions & 0 deletions htdocs/styles/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,7 @@ body {

.hero-unit.hero-small h2 {
font-size: 36px;
}
.hero-unit blockquote small {
color: #6f6f6f
}

0 comments on commit 9f93a2e

Please sign in to comment.