diff --git a/bin/deardesi.js b/bin/deardesi.js index e25b296..7720e23 100644 --- a/bin/deardesi.js +++ b/bin/deardesi.js @@ -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); diff --git a/bower.json b/bower.json index 8547f72..e44d877 100644 --- a/bower.json +++ b/bower.json @@ -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" } } diff --git a/components/desirae/desirae.js b/components/desirae/desirae.js index 93bd762..7b3fbff 100644 --- a/components/desirae/desirae.js +++ b/components/desirae/desirae.js @@ -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)); } }; }] diff --git a/desirae b/desirae deleted file mode 160000 index 98f9980..0000000 --- a/desirae +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 98f998088a48630388dbb7ffad59a7a6ac8b62ac diff --git a/desirae-http-api.js b/desirae-http-api.js index d2138b4..86e198d 100644 --- a/desirae-http-api.js +++ b/desirae-http-api.js @@ -1,8 +1,7 @@ '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) { var restful = {} diff --git a/index.html b/index.html index 5803871..4258797 100644 --- a/index.html +++ b/index.html @@ -84,22 +84,22 @@ - - - - - - - + + + + + + + - - - - + - + + + + diff --git a/package.json b/package.json index a7772a4..56bec47 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/server.js b/server.js index 84af71b..d6076e8 100644 --- a/server.js +++ b/server.js @@ -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; diff --git a/views/post/post.js b/views/post/post.js index 5220045..8262b98 100644 --- a/views/post/post.js +++ b/views/post/post.js @@ -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();