works with desirae v0.9.0 as module

This commit is contained in:
AJ ONeal 2015-01-15 01:41:52 -05:00
parent b0d2bf6ff9
commit 4b0d93725e
9 changed files with 47 additions and 21 deletions

View File

@ -25,6 +25,28 @@ function serve(blogdir) {
//secureServer = https.createServer(app).listen(65043);
}
function build(blogdir) {
var Desi = require('desirae').Desirae
, desi = {}
, env = {}
;
env.working_path = env.blogdir = blogdir;
Desi.init(desi, env).then(function () {
env.url = desi.site.base_url + desi.site.base_path.replace(/^\/$/, '');
env.base_url = desi.site.base_url;
env.base_path = desi.site.base_path;
env.compiled_path = 'compiled';
//env.since = 0;
Desi.buildAll(desi, env).then(function () {
Desi.write(desi, env).then(function () {
console.log('Build Success!');
});
});
});
}
cli.main(function (args, options) {
var command = args[0]
, blogdir = options.blog
@ -47,6 +69,10 @@ cli.main(function (args, options) {
process.exit(1);
return;
}
else if ('build' === command) {
build(blogdir);
return;
}
else if ('post' === command) {
console.error("`post' not yet implemented");
process.exit(1);

View File

@ -37,6 +37,7 @@
"angular-route": "~1.3.8",
"html5-boilerplate": "~4.3.0",
"bootstrap": "~3.3.1",
"md5": "~0.1.3"
"md5": "~0.1.3",
"desirae": "~0.9.0"
}
}

View File

@ -1,8 +1,7 @@
angular.module('myApp.services', []).
factory('Desirae', ['$q', '$http', function ($q, $http) {
var Desi = window.Desi || require('./deardesi').Desi
var Desi = window.Desirae || require('./deardesi').Desirae
, desi = {/*TODO api_base: '/api'*/}
, fsapi = window.fsapi
;
function getBlogdir () {
@ -65,7 +64,7 @@ angular.module('myApp.services', []).
return d.promise;
}
, putFiles: function (files) {
return $q.when(fsapi.putFiles(files));
return $q.when(Desi.fsapi.putFiles(files));
}
};
}]

@ -1 +0,0 @@
Subproject commit 98f998088a48630388dbb7ffad59a7a6ac8b62ac

View File

@ -1,7 +1,6 @@
'use strict';
var fsapi = require('./desirae/lib/fsapi').fsapi
, path = require('path')
var fsapi = require('desirae/lib/node-adapters').fsapi
;
module.exports.create = function (options) {

View File

@ -84,22 +84,22 @@
<!-- Deps -->
<script src="./desirae/bower_components/bluebird/js/browser/bluebird.js"></script>
<script src="./desirae/bower_components/mustache/mustache.js"></script>
<script src="./desirae/bower_components/markdown-it/dist/markdown-it.js"></script>
<script src="./desirae/bower_components/js-yaml/dist/js-yaml.js"></script>
<script src="./desirae/bower_components/path/path.js"></script>
<script src="./desirae/bower_components/node-uuid/uuid.js"></script>
<script src="./desirae/bower_components/forEachAsync/forEachAsync.js"></script>
<script src="./bower_components/bluebird/js/browser/bluebird.js"></script>
<script src="./bower_components/mustache/mustache.js"></script>
<script src="./bower_components/markdown-it/dist/markdown-it.js"></script>
<script src="./bower_components/js-yaml/dist/js-yaml.js"></script>
<script src="./bower_components/path/path.js"></script>
<script src="./bower_components/node-uuid/uuid.js"></script>
<script src="./bower_components/forEachAsync/forEachAsync.js"></script>
<!-- Libs -->
<script src="./desirae/lib/deardesi-utils.js"></script>
<script src="./desirae/lib/verify-config.js"></script>
<script src="./desirae/lib/deardesi-browser.js"></script>
<script src="./desirae/lib/frontmatter.js"></script>
<script src="./bower_components/desirae/lib/verify-config.js"></script>
<!-- Desi -->
<script src="./desirae/desirae.js"></script>
<script src="./bower_components/desirae/desirae.js"></script>
<script src="./bower_components/desirae/lib/frontmatter.js"></script>
<script src="./bower_components/desirae/lib/browser-adapters.js"></script>
<script src="./bower_components/desirae/lib/utils.js"></script>
<!-- UX Using Angular, but not getting fancy -->
<script src="./bower_components/angular/angular.js"></script>

View File

@ -43,6 +43,7 @@
"connect": "^3.3.4",
"connect-query": "^0.2.0",
"connect-send-json": "^1.0.0",
"desirae": "^0.9.0",
"fs.extra": "^1.3.0",
"require-yaml": "0.0.1",
"serve-static": "^1.8.0"

View File

@ -59,7 +59,7 @@ function create(options) {
//.use(serveStatic(options.blogdir))
.use('/blog', serveStatic(options.blogdir))
.use('/compiled_dev', serveStatic(path.join(options.blogdir, '/compiled_dev')))
//.use('/compiled', serveStatic(path.join(options.blogdir, '/compiled')))
.use('/compiled', serveStatic(path.join(options.blogdir, '/compiled')))
;
return app;

View File

@ -16,6 +16,7 @@ angular.module('myApp.post', ['ngRoute'])
function init() {
Desirae.meta().then(function (desi) {
console.warn(desi);
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
scope.site = desi.site;
newPost();