Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'feature/update-docs-n-tests' into feature/file-writer
Browse files Browse the repository at this point in the history
  • Loading branch information
hassankhan committed Dec 8, 2013
2 parents a8bfa6d + a06d5b5 commit d7a9925
Show file tree
Hide file tree
Showing 14 changed files with 255 additions and 195 deletions.
109 changes: 59 additions & 50 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Zepto

Master: [![Build Status](https://travis-ci.org/hassankhan/Zepto.png?branch=master)](https://travis-ci.org/hassankhan/Zepto) Develop: [![Build Status](https://travis-ci.org/hassankhan/Zepto.png?branch=develop)](https://travis-ci.org/hassankhan/Zepto)
Master: [![Build Status](https://travis-ci.org/hassankhan/Zepto.png?branch=master)](https://travis-ci.org/hassankhan/Zepto) [![Coverage Status](https://coveralls.io/repos/hassankhan/Zepto/badge.png?branch=master)](https://coveralls.io/r/hassankhan/Zepto?branch=master)

[![Latest Stable Version](https://poser.pugx.org/hassankhan/Zepto/v/stable.png)](https://packagist.org/packages/hassankhan/Zepto) [![Montly Downloads](https://poser.pugx.org/hassankhan/Zepto/d/monthly.png)](https://packagist.org/packages/hassankhan/Zepto)
Develop: [![Build Status](https://travis-ci.org/hassankhan/Zepto.png?branch=develop)](https://travis-ci.org/hassankhan/Zepto) [![Coverage Status](https://coveralls.io/repos/hassankhan/Zepto/badge.png?branch=develop)](https://coveralls.io/r/hassankhan/Zepto?branch=develop)

[![Coverage Status](https://coveralls.io/repos/hassankhan/Zepto/badge.png)](https://coveralls.io/r/hassankhan/Zepto)
[![Latest Stable Version](https://poser.pugx.org/hassankhan/Zepto/v/stable.png)](https://packagist.org/packages/hassankhan/Zepto) [![Montly Downloads](https://poser.pugx.org/hassankhan/Zepto/d/monthly.png)](https://packagist.org/packages/hassankhan/Zepto)

Zepto is a stupidly simple, blazing fast, flat-file CMS based on [Pico](http://pico.dev7studios.com).

Expand Down
8 changes: 7 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ To-Do

## Project organisation

## Frontend
- Rewrite CSS to LESS
- Probably try and use Bootstrap
- Grunt/NPM support

## Documentation
- Router/routing
- Hooks
Expand All @@ -12,7 +17,7 @@ To-Do
- Decide whether to make a separate skeleton project that uses this or just to use this as is

## Application
- Abstract-ify Whoops and Twig
- Abstract-ify Whoops

## Router
- How to test router
Expand All @@ -25,6 +30,7 @@ To-Do
- Add Twig extensions

## Plugins
- Can't disable plugins without breaking program
- Add hooks to important parts of application
- Make plugins Pimple Objects
- Remove all hardcoded paths from PluginLoader
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.4.x-dev"
"dev-master": "0.5.x-dev"
}
},
"minimum-stability": "dev",
Expand Down
31 changes: 0 additions & 31 deletions library/Zepto/FileLoader/CsvLoader.php

This file was deleted.

31 changes: 0 additions & 31 deletions library/Zepto/FileLoader/JsonLoader.php

This file was deleted.

31 changes: 0 additions & 31 deletions library/Zepto/FileLoader/XmlLoader.php

This file was deleted.

4 changes: 2 additions & 2 deletions library/Zepto/PluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public function after_config_load(&$settings);

public function after_plugins_load();

public function request_url(&$url);

public function before_file_load(&$content_dir);

public function after_file_load(&$content);

public function request_url(&$url);

// Move all these methods into their own classes
// public function before_file_meta_parsed(&$headers);

Expand Down
53 changes: 33 additions & 20 deletions library/Zepto/Zepto.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ class Zepto {
* <code>
* $config = array(
* 'zepto' => array(
* 'cache_dir' => ROOT_DIR . 'cache',
* 'content_dir' => ROOT_DIR . 'content',
* 'plugin_dir' => ROOT_DIR . 'plugins',
* 'templates_dir' => ROOT_DIR . 'templates',
* 'content_ext' => array('md', 'markdown')
* 'content_dir' => 'content',
* 'plugins_dir' => 'plugins',
* 'templates_dir' => 'templates',
* 'default_template' => 'base.twig',
* 'content_ext' => array('.md', '.markdown'),
* 'plugins_enabled' => true
* ),
* 'site' => array(
* 'site_root' => 'Site root URL goes here',
* 'site_title' => 'Zepto',
* 'theme' => 'default',
* 'date_format' => 'jS M Y',
* 'page_order' => 'asc',
* 'page_order_by' => 'date|a-z',
* 'excerpt_length' => '50'
* 'site_root' => 'Site root URL goes here',
* 'site_title' => 'Zepto',
* 'date_format' => 'jS M Y',
* 'excerpt_length' => '50'
* ),
* 'twig' => array(
* 'cache' => false,
* 'autoescape' => false,
* 'debug' => false
* 'charset' => 'utf-8',
* 'cache' => 'cache',
* 'strict_variables' => false,
* 'autoescape' => false,
* 'auto_reload' => true
* )
* );
* </code>
Expand Down Expand Up @@ -112,7 +112,7 @@ function ($container) {
$this->load_plugins();

// Load content from files
$this->load_files();
$this->load_content();

// Create navigation object
$this->create_nav_links();
Expand Down Expand Up @@ -149,6 +149,9 @@ public function run_hooks($hook_id, $args = array())
throw new \Exception('No such hook exists');
}

// Send app reference to hooks
$args = array_merge($args, array($this));

// Run hooks associated with that event
foreach ($plugins as $plugin_id => $plugin) {
if (is_callable(array($plugin, $hook_id))) {
Expand Down Expand Up @@ -180,7 +183,12 @@ protected function load_plugins()
$this->run_hooks('after_plugins_load');
}

protected function load_files()
/**
* Loads files from the ``content`` folder
*
* @return
*/
protected function load_content()
{
// Get local reference to file loader
$container = $this->container;
Expand Down Expand Up @@ -238,7 +246,7 @@ protected function setup_router()

// Set Twig options
$twig_options = array(
'config' => $container['settings']['twig'],
'config' => $container['settings'],
'base_dir' => '/zepto',
'base_url' => $container['settings']['site']['site_root'],
'site_title' => $container['settings']['site']['site_title']
Expand All @@ -258,6 +266,11 @@ protected function setup_router()
}
}

/**
* Helper function to create navigation links
*
* @return
*/
protected function create_nav_links()
{
$container = $this->container;
Expand Down Expand Up @@ -297,8 +310,8 @@ private function _configure_error_handler()
// Configure the PrettyPageHandler:
$errorPage = new Whoops\Handler\PrettyPageHandler();

$errorPage->setPageTitle("Shit hit the fan!");
$errorPage->setEditor("sublime");
$errorPage->setPageTitle('Shit hit the fan!');
$errorPage->setEditor('sublime');
$error_handler->pushHandler($errorPage);
$error_handler->register();
}
Expand Down
10 changes: 5 additions & 5 deletions plugins/ExamplePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public function after_plugins_load()
echo __CLASS__ . '::after_plugins_load';
}

public function request_url(&$url)
{
echo __CLASS__ . '::request_url';
}

public function before_file_load(&$content_dir)
{
echo __CLASS__ . '::before_file_load';
Expand All @@ -36,6 +31,11 @@ public function after_file_load(&$content)
echo __CLASS__ . '::after_file_load';
}

public function request_url(&$url)
{
echo __CLASS__ . '::request_url';
}

}

?>
10 changes: 5 additions & 5 deletions plugins/OtherExamplePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public function after_plugins_load()
echo __CLASS__ . '::after_plugins_load';
}

public function request_url(&$url)
{
echo __CLASS__ . '::request_url';
}

public function before_file_load(&$content_dir)
{
echo __CLASS__ . '::before_file_load';
Expand All @@ -36,6 +31,11 @@ public function after_file_load(&$content)
echo __CLASS__ . '::after_file_load';
}

public function request_url(&$url)
{
echo __CLASS__ . '::request_url';
}

}

?>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Zepto;
namespace Zepto\FileLoader;

/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-03 at 13:49:12.
*/
class MarkdownLoaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var FileLoader
* @var MarkdownLoader
*/
protected $object;

Expand All @@ -17,7 +17,7 @@ class MarkdownLoaderTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new FileLoader\MarkdownLoader();
$this->object = new MarkdownLoader();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Zepto;
namespace Zepto\FileLoader;

/**
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-03 at 13:49:12.
*/
class PluginLoaderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var FileLoader
* @var PluginLoader
*/
protected $object;

Expand All @@ -17,7 +17,7 @@ class PluginLoaderTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->object = new FileLoader\PluginLoader();
$this->object = new PluginLoader();

include_once(ROOT_DIR . 'plugins/ExamplePlugin.php');
include_once(ROOT_DIR . 'plugins/OtherExamplePlugin.php');
Expand Down Expand Up @@ -45,15 +45,6 @@ protected function tearDown()
$this->object = null;
}

/**
* @covers Zepto\FileLoader\PluginLoader::load()
* @expectedException Exception
*/
public function testLoad()
{
$this->object->load('@£@', 'aa');
}

/**
* @covers Zepto\FileLoader\PluginLoader::load
* @todo Implement testLoad().
Expand Down Expand Up @@ -88,4 +79,13 @@ public function testLoadMultipleFiles()
$this->assertEquals($expected, $actual);
}

/**
* @covers Zepto\FileLoader\PluginLoader::load()
* @expectedException Exception
*/
public function testLoadInvalidFileOrDirectory()
{
$this->object->load('@£@', 'aa');
}

}
Loading

0 comments on commit d7a9925

Please sign in to comment.