updated to latest, fixed minor bugs
This commit is contained in:
parent
f298003bc4
commit
61bd443e12
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
bower_components
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
|
|
@ -5,6 +5,7 @@ var PromiseA = require('bluebird')
|
|||
, path = require('path')
|
||||
, cli = require('cli')
|
||||
, UUID = require('node-uuid')
|
||||
, Desi
|
||||
;
|
||||
|
||||
cli.parse({
|
||||
|
@ -12,6 +13,13 @@ cli.parse({
|
|||
//, output: ['o', 'name of output directory within ~/path/to/blog', 'string', './compiled']
|
||||
});
|
||||
|
||||
function init() {
|
||||
Desi = require('desirae').Desirae;
|
||||
|
||||
Desi.registerDataMapper('ruhoh', require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh);
|
||||
Desi.registerDataMapper('ruhoh@2.6', require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh);
|
||||
}
|
||||
|
||||
function serve(blogdir) {
|
||||
var http = require('http')
|
||||
//, https = require('https')
|
||||
|
@ -27,8 +35,7 @@ function serve(blogdir) {
|
|||
}
|
||||
|
||||
function build(blogdir) {
|
||||
var Desi = require('desirae').Desirae
|
||||
, desi = {}
|
||||
var desi = {}
|
||||
, env = {}
|
||||
;
|
||||
|
||||
|
@ -60,9 +67,7 @@ function createPost(originalDir, blogdir, title, extra) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
var Desi = require('desirae').Desirae
|
||||
//, desi = {}
|
||||
, env = {}
|
||||
var env = {}
|
||||
, post = {}
|
||||
, slug
|
||||
, filepath
|
||||
|
@ -149,7 +154,10 @@ function createPost(originalDir, blogdir, title, extra) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
cli.main(function (args, options) {
|
||||
init();
|
||||
|
||||
var command = args[0]
|
||||
, blogdir = options.blogdir
|
||||
, originalDir = blogdir
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
"html5-boilerplate": "~4.3.0",
|
||||
"bootstrap": "~3.3.1",
|
||||
"md5": "~0.1.3",
|
||||
"desirae": "~0.9.0"
|
||||
"desirae": "~0.9.6",
|
||||
"desirae-datamap-ruhoh": "~1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ angular.module('myApp.services', []).
|
|||
, desi = {/*TODO api_base: '/api'*/}
|
||||
;
|
||||
|
||||
// TODO what version of ruhoh are ruhoh-twitter and ruhoh-boostrap-2
|
||||
Desi.registerDataMapper('ruhoh', window.DesiraeDatamapRuhoh || require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh);
|
||||
Desi.registerDataMapper('ruhoh@2.6', window.DesiraeDatamapRuhoh || require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh);
|
||||
|
||||
function getBlogdir () {
|
||||
return $http.get('/api/fs/rootdir').then(function (resp) {
|
||||
desi.blogdir = resp.data;
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
<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>
|
||||
<script src="./bower_components/desirae-datamap-ruhoh/datamapper-ruhoh.js"></script>
|
||||
|
||||
<!-- UX Using Angular, but not getting fancy -->
|
||||
<script src="./bower_components/angular/angular.js"></script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "desi",
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.3",
|
||||
"description": "A nice, friendly tool to help you get set up and start blogging, built on the Desirae blogging platform",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
@ -44,7 +44,8 @@
|
|||
"connect": "^3.3.4",
|
||||
"connect-query": "^0.2.0",
|
||||
"connect-send-json": "^1.0.0",
|
||||
"desirae": "^0.9.3",
|
||||
"desirae": "^0.9.6",
|
||||
"desirae-datamap-ruhoh": "^1.0.0",
|
||||
"fs.extra": "^1.3.0",
|
||||
"node-uuid": "^1.4.2",
|
||||
"require-yaml": "0.0.1",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="col-xs-12">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Welcome to Dear Desi! <small ng-bind="'(v%VERSION%)' | interpolate"></small></h1>
|
||||
<h1>Welcome to Desi! <small ng-bind="'(v%VERSION%)' | interpolate"></small></h1>
|
||||
</div>
|
||||
|
||||
<div class="jumbotron">
|
||||
|
@ -18,28 +18,42 @@
|
|||
<div class="col-lg-7">
|
||||
<br/>
|
||||
<!--iframe width="560" height="315" src="//www.youtube.com/embed/YZzhIIJmlE0" frameborder="0" allowfullscreen></iframe-->
|
||||
<img src="http://dropsha.re/files/fly6+.8/desi-parker-2.jpg"/>
|
||||
<pre>
|
||||
<code>
|
||||
npm install -g desi
|
||||
|
||||
git clone https://github.com/DearDesi/desirae-blog-template.git blog
|
||||
|
||||
pushd blog
|
||||
|
||||
git submodule add https://github.com/DearDesi/ruhoh-twitter.git \
|
||||
themes/ruhoh-twitter
|
||||
|
||||
desi serve
|
||||
</code>
|
||||
</pre>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<h2>Dear Desi is...</h2>
|
||||
<h2>Why Desi?</h2>
|
||||
<br/>
|
||||
<ul>
|
||||
<li>Builds in the Browser
|
||||
<li>Built in JavaScript
|
||||
<ul>
|
||||
<li>The in-browser static blog generator</li>
|
||||
<li>Write content in Markdown, Jade, or HTML</li>
|
||||
<li>Mustache Templates</li>
|
||||
<li>Use <a href="http://ruhoh.com">ruhoh</a> themes (or roll your own)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Git, Dropbox, or regular Folders for management</li>
|
||||
<li>Go headless with Node.js support</li>
|
||||
<li>Build your blog right in your browser</li>
|
||||
<li>Build headless with io.js (and node.js)</li>
|
||||
<li>Use Git, Dropbox, or regular Folders for management</li>
|
||||
<li>Dual Licensed Apache2 and MIT</li>
|
||||
<li>No Ruby version Hell - it'll still work in 6 months! :-D</li>
|
||||
</ul>
|
||||
<h3>What are you waiting for?</h3>
|
||||
<br/>
|
||||
<a class="btn btn-primary btn-lg pull-right" href="/#authors">Get Started</a>
|
||||
<a class="btn btn-primary btn-lg pull-right" href="/#authors">Try it!</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,11 @@ angular.module('myApp.build', ['ngRoute'])
|
|||
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
||||
scope.site = desi.site;
|
||||
|
||||
if (!desi.site.base_url || !desi.site.base_path) {
|
||||
window.alert("Please go back to the site config and enter any mandatory missing fields (base_url, base_path).");
|
||||
return;
|
||||
}
|
||||
|
||||
scope.production_url = desi.site.base_url + path.join('/', desi.site.base_path);
|
||||
|
||||
// this is the responsibility of the build system (Dear Desi), not the library (Desirae)
|
||||
|
|
|
@ -122,7 +122,23 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPostAbsPath" class="col-lg-2 control-label">Filepath</label>
|
||||
<label for="inputPostAbsPath" class="col-lg-2 control-label">Source Path</label>
|
||||
<div class="col-lg-10">
|
||||
<input
|
||||
required="required"
|
||||
disabled
|
||||
ng-model="Post.selected.sourcepath"
|
||||
ng-change="Post.onChange()"
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="inputPostAbsPath"
|
||||
placeholder="i.e. ~/blog.me.co/posts/my-first-post.md"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPostAbsPath" class="col-lg-2 control-label">Output Path</label>
|
||||
<div class="col-lg-10">
|
||||
<input
|
||||
required="required"
|
||||
|
|
|
@ -9,7 +9,7 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
}])
|
||||
|
||||
.controller('PostCtrl'
|
||||
, ['$scope', '$location', '$timeout', 'DesiraeService'
|
||||
, ['$scope', '$location', '$timeout', 'Desirae'
|
||||
, function ($scope, $location, $timeout, DesiraeService) {
|
||||
var scope = this
|
||||
;
|
||||
|
@ -19,6 +19,7 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
console.warn(desi);
|
||||
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
||||
scope.site = desi.site;
|
||||
scope.env = desi.site;
|
||||
newPost();
|
||||
|
||||
updateDate();
|
||||
|
@ -37,6 +38,7 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
, permalink: "/article/new.html"
|
||||
, uuid: window.uuid.v4()
|
||||
, abspath: scope.blogdir
|
||||
, sourcepath: ''
|
||||
, post: {
|
||||
yml: {
|
||||
title: ""
|
||||
|
@ -64,16 +66,18 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
post.yml.title = post.yml.title || '';
|
||||
post.yml.description = post.yml.description || '';
|
||||
|
||||
if (selected.permalink === post.yml.permalink) {
|
||||
selected.permalink = '/articles/' + post.yml.title.toLowerCase()
|
||||
scope.slug = post.yml.title.toLowerCase()
|
||||
.replace(/["']/g, '')
|
||||
.replace(/\W/g, '-')
|
||||
.replace(/^-+/g, '')
|
||||
.replace(/-+$/g, '')
|
||||
.replace(/--/g, '-')
|
||||
+ '/' // + '.html' //+ selected.format
|
||||
;
|
||||
|
||||
if (selected.permalink === post.yml.permalink) {
|
||||
selected.permalink = '/articles/' + scope.slug + '/';
|
||||
// + '.html' //+ selected.format
|
||||
|
||||
post.yml.permalink = selected.permalink;
|
||||
}
|
||||
/*
|
||||
|
@ -85,13 +89,14 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
post.frontmatter = window.jsyaml.dump(post.yml).trim();
|
||||
|
||||
// TODO use some sort of filepath pattern in config.yml
|
||||
selected.path = window.path.join((selected.collection || 'posts'), window.path.basename(post.yml.permalink));
|
||||
selected.path = window.path.join((scope.env.compiled_path || 'compiled'), post.yml.permalink);
|
||||
if (!/\.html?$/.test(selected.path)) {
|
||||
selected.path = window.path.join(selected.path, 'index.html');
|
||||
}
|
||||
|
||||
selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
||||
selected.abspath = window.path.join(scope.blogdir, selected.path);
|
||||
selected.sourcepath = window.path.join((selected.collection || 'posts'), scope.slug + '.' + selected.format);
|
||||
};
|
||||
scope.onFrontmatterChange = function () {
|
||||
var data
|
||||
|
@ -111,12 +116,13 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
|
||||
post = scope.selected.post;
|
||||
|
||||
scope.selected.path = window.path.join((scope.selected.collection || 'posts'), window.path.basename(post.yml.permalink));
|
||||
scope.selected.path = window.path.join((scope.env.compiled_path || 'compiled'), post.yml.permalink);
|
||||
if (!/\.html?$/.test(window.path.basename(post.yml.permalink))) {
|
||||
scope.selected.path = window.path.join(scope.selected.path.replace(/\.w+$/, ''), 'index.html');
|
||||
}
|
||||
scope.selected.url = window.path.join(scope.site.base_url + window.path.join(scope.site.base_path, post.yml.permalink));
|
||||
scope.selected.abspath = window.path.join(scope.blogdir, scope.selected.path);
|
||||
scope.selected.sourcepath = window.path.join((scope.selected.collection || 'posts'), scope.slug + '.' + scope.selected.format);
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
console.error('ignoring update that created parse error');
|
||||
|
@ -153,7 +159,7 @@ angular.module('myApp.post', ['ngRoute'])
|
|||
;
|
||||
|
||||
files.push({
|
||||
path: scope.selected.path
|
||||
path: scope.selected.sourcepath
|
||||
, contents:
|
||||
'---\n'
|
||||
+ scope.selected.post.frontmatter.trim()
|
||||
|
|
Loading…
Reference in New Issue