Permalink
Browse files

Rewrite lib.

  • Loading branch information...
cliffano committed Nov 27, 2011
1 parent d3e7983 commit 6e7cce11f1d5e022bc1648dc761526159a9e1c80
View
@@ -0,0 +1,5 @@
+### 0.0.2
+* Refactor lib modules
+
+### 0.0.1
+* Initial version
View
@@ -6,23 +6,23 @@ Static website generator.
Installation
------------
- npm install ae86
+ npm install -g ae86
Usage
-----
-Display help info
+Create new project structure:
- ae86 -h
+ ae86 init
-Initialise project
+* partials/ - directory containing partial template files
+* layouts/ - directory containing layout template files
+* pages/ - directory containing website page files
+* ae86.js - file containing website params and custom tags
+
+To generate the website:
+
+ ae86 gen
- ae86 init
-
-Generate website
- ae86 gen
-
-Delete generated website
- ae86 clean
View
@@ -1,69 +1,4 @@
#!/usr/bin/env node
-var DEFAULT_LAYOUTS_DIR = 'layouts',
- DEFAULT_PAGES_DIR = 'pages',
- DEFAULT_PARTIALS_DIR = 'partials',
- DEFAULT_STATIC_DIR = 'static',
- DEFAULT_OUT_DIR = 'out',
- DEFAULT_FILE = 'params.js',
- DEFAULT_ENGINE = 'jazz',
- DEFAULT_IGNORE = '.cvs,.git,.svn,.DS_Store',
- DEFAULT_ENCODING = 'utf-8',
- DEFAULT_MODE = 0755,
- path = require('path'),
- nomnom = require('nomnom'),
- AE86 = require('../lib/ae86').AE86,
- base = process.cwd(),
- opts, options, engine, Engine, instance, doInit, doGen, doClean;
-
-instance = function (args) {
- options = {
- layouts: path.join(base, DEFAULT_LAYOUTS_DIR),
- pages: path.join(base, DEFAULT_PAGES_DIR),
- partials: path.join(base, DEFAULT_PARTIALS_DIR),
- static: path.join(base, DEFAULT_STATIC_DIR),
- out: path.join(base, (args.out || DEFAULT_OUT_DIR)),
- params: (path.existsSync(path.join(base, DEFAULT_FILE))) ? require(path.join(base, DEFAULT_FILE.replace(/\.js/, ''))).params : {},
- ignore: (args.ignore) ? args.ignore.split(',') : DEFAULT_IGNORE.split(','),
- encoding: DEFAULT_ENCODING,
- mode: DEFAULT_MODE
- };
- return new AE86(options);
-};
-
-doInit = function (args) {
- instance(args).init();
-};
-
-doGen = function (args) {
- engine = args.engine || DEFAULT_ENGINE;
- console.log('Revving up AE86\'s ' + engine + ' engine...');
- Engine = require('../lib/engine/' + engine).Engine;
- instance(args).generate(new Engine());
-};
-
-doClean = function (args) {
- instance(args).clean();
-};
-
-opts = {
- out: {
- string: '-o OUT_DIR',
- help: 'Directory where the website files will be written to, default: ' + DEFAULT_OUT_DIR
- },
- engine: {
- string: '-e ENGINE',
- help: 'Templating engine, default: ' + DEFAULT_ENGINE
- },
- ignore: {
- string: '-i IGNORE',
- help: 'Directories/files to be ignored (comma separated), default: ' + DEFAULT_IGNORE
- }
-};
-
-nomnom.scriptName('ae86');
-nomnom.globalOpts(opts);
-nomnom.command('init').callback(doInit);
-nomnom.command('gen').callback(doGen);
-nomnom.command('clean').callback(doClean);
-nomnom.parseArgs();
+var cli = require('../lib/cli');
+cli.exec();
View
@@ -1,14 +0,0 @@
-<html>
-<head>
- <title>{title}</title>
- <link rel="stylesheet" href="{relative('styles/default.css')}" type="text/css"/>
- <script type="text/javascript" src="{relative('scripts/default.js')}"></script>
-</head>
-<body>
- <div id="doc">
- {include('header')}
- {body}
- {include('footer')}
- </div>
-</body>
-</html>
@@ -1,5 +0,0 @@
-<link rel="stylesheet" href="styles/contact.css" type="text/css"/>
-<h2>{nav.contact.title}</h2>
-<script type="text/javascript">
- write('You can contact us by leaving a message at <a href="{url}/issues">{url}/issues</a>');
-</script>
@@ -1,7 +0,0 @@
-<h2>{nav.home.title}</h2>
-<p>
- Hi,
-</p>
-<p>
- <strong>{title}</strong> is the {enlarge('number one')} expert of the ancient art of paper printing.
-</p>
@@ -1,8 +0,0 @@
-<h2>{nav.services.title}</h2>
-
-Services:
-<ul>
-{foreach service in services}
- <li>{service}</li>
-{end}
-</ul>
@@ -1,9 +0,0 @@
-<link rel="stylesheet" href="styles/services/specialty.css" type="text/css"/>
-<h2>{nav.specialty.title}</h2>
-
-Our specialty is at printing business cards with the following sizes:
-<ul>
-{foreach size in specialty.businesscard.sizes}
- <li>{size}</li>
-{end}
-</ul>
View
@@ -1,20 +0,0 @@
-exports.params = {
- name: 'ae86',
- url: 'http://github.com/cliffano/ae86',
- title: 'AE86 Printing',
- nav: {
- home: { title: 'Home', url: 'index.html'},
- services: { title: 'Services', url: 'services/index.html'},
- specialty: { title: 'Specialty', url: 'services/specialty/index.html'},
- contact: { title: 'Contact Us', url: 'contact.html'}
- },
- services: [ 'Business Card', 'Brochure', 'Annual Report' ],
- specialty: {
- businesscard: {
- sizes: [ '55x90mm', '110x99mm' ]
- }
- },
- enlarge: function(text, cb) {
- cb('<span style="font-size: 500%;">' + text + '</span>')
- }
-};
@@ -1,3 +0,0 @@
-<div id="footer">
- <p>Copyright &copy; 2010 - 2011 <a href="{url}">{name}</a></p>
-</div>
@@ -1,3 +0,0 @@
-<div id="header">
- <h1><img src="{relative('images/logo.png')}"/> {title}</h1>
-</div>
@@ -1,5 +0,0 @@
-<div id="nav">
- {foreach menu in nav}
- <a href="{relative(menu.value.url)}">{menu.value.title}</a> |
- {end}
-</div>
View
@@ -1 +0,0 @@
-{include('elements/copyright')}
View
@@ -1,2 +0,0 @@
-{include('elements/logo')}
-{include('elements/nav')}
Binary file not shown.
@@ -1,3 +0,0 @@
-var write = function (message) {
- document.write(message);
-};
@@ -1,3 +0,0 @@
-h2 {
- text-decoration: underline;
-}
@@ -1,36 +0,0 @@
-body {
- background-color: #666666;
- margin: 0;
- padding: 0;
-}
-div#doc {
- background-color: #ffffff;
- color: #000000;
- font-family: serif;
- margin: auto;
- padding: 20px;
- width: 960px;
-}
-div#header {
- border-bottom: 3px solid #000000;
- text-align: center;
-}
-div#nav {
- font-weight: bold;
- padding: 10px;
- text-align: center;
-}
-div#footer {
- border-top: 3px solid #000000;
- font-weight: bold;
- text-align: right;
-}
-h1 {
- font-size: 250%;
-}
-h2 {
- font-style: italic;
-}
-a {
- color: #800000;
-}
@@ -1,3 +0,0 @@
-li {
- color: #00ff00;
-}
Oops, something went wrong.

0 comments on commit 6e7cce1

Please sign in to comment.