separating deardesi/desirae

This commit is contained in:
AJ ONeal 2015-01-13 03:41:14 -07:00
parent f5ef2cff9d
commit 311e731aa1
7 changed files with 186 additions and 222 deletions

74
DESI.md Normal file
View File

@ -0,0 +1,74 @@
Data
====
Every template gets an object with the exact same structure - whether it's a template or a widget or a page or a post.
Here we only document Desirae's default behavior, but there are many objects added for compatibility with Ruhoh that are not documented.
```
desi = {}
```
desi
====
* `config` - literally `config.yml`, parsed
* `site` - literally `site.yml`, parsed
* `authors` - literally the authors from `authors/*.yml`, parsed
* `author` - the primary author of the site
* `env` - urls and paths for this build (be it production, development, staging, etc)
* `content` - pre-rendered content (i.e. content rendered into the post layout rendered into the default layout)
* `collection` - config related to this collection
* `entity` - the page, post, article, etc that is the focus of the present template process
* `themes` - all themes
* `theme` - the default theme
* `layout` - the selected layout for this theme
* `satch` - the selected swatch for this theme
* `categories` - all categories
* `tags` - all tags
* `styles` - ??? goes into the final template in the head
* `scripts` - ?? that goes into the final template just before the body close
desi.entity
===========
stuff
* `uuid`
* `title`
* `disqus_url`
* `disqus_identifier`
more stuff
* `type` - `post`, `page`, etc
* `authors` - literally the relevant authors from `authors/*.yml`, parsed
* `author` - the primary author of this entity
* `theme` - null or a non-default theme
* `layout` - null or a non-default layout for this theme
* `swatch` - null or a non-default swatch for this theme
* `categories`: [] // *all* categories in all collections
* `tags`: [] // *all* categories in all collections
* `production_canonical_url` the PRODUCTION canonical_url for this entity
* `production_url` the PRODUCTION url for this entity
* `production_path` the PRODUCTION path for this entity
* `url` the full url in the current environment (might be production, development, etc)
* `path` the non-host part (i.e. `/compiled_dev/articles/my-first-post.html`)
* `previous` the previous entity in this collection
* `next` the next entitiy in this collection
NOTE: Plugins, widgets, etc SHOULD NOT modify config, site, authors, author, or env.
desi.posts
==========
, posts: { collated: desi.collated }
desi.config
===========
desi.site
===========
desi.env
===========

102
README.md
View File

@ -1,6 +1,8 @@
Desirae
=====
(in development)
A blog platform built for Developers, but with normal people in mind.
Desirae runs entirely in the browser, but needs a little help from Node.js for saving and retrieving files.
@ -20,39 +22,6 @@ Node (optional) - if you'd prefer to go headless, you can.
The server is *very* minimal and could easily be implemented in any language (such as ruby or python).
Install and Usage
=================
If you're on OS X or Linux, it's as easy as pie to install and use Desirae.
```bash
git clone git@github.com:DearDesi/desirae.git
pushd desirae
# Downloads and installs node.js and a few other tools Desirae needs
bash setup.sh ./blog
```
After the initial installation you can launch Dear Desi, the Web-based configuration and build tool like so:
```
deardesi ./blog 65080
```
Or, if you prefer, you can build with `desirae` from the command line:
```
desirae build ./blog
desirae build-dev ./blog
```
Create a new Post
-----------------
```
desirae post "My First Post"
```
Configuration
=============
@ -65,58 +34,6 @@ There are a few configuration files:
If any of these files change, the entire site needs to be retemplated.
Widgets
=======
All widgets should export an object with a `create(widgetConf, desiState)` function that returns a promise.
```yaml
widgets:
foogizmo:
# only stuff that is intensely specific to foogizmo goes here
# stuff like google ad and disqus ids should go in config.yml or data.yml
config:
foobeep: boop
handle:
- html
- markdown
handlers:
post: fooposter
page: foopager
```
```javascript
'use strict';
module.exports.Foogizmo.create = function (foogizmoConf, desiState) {
return new Promise(function (resolve) {
function pager(desiPageState) {
// Do processing
return Promise.resolve();
}
function poster(desiPostState) {
// Do processing
desiPostState.fooembedinator = function (fooval) {
// figure out what type of link fooval is and return iframe html
return '<iframe src="http://embedinator.com/"' + foovalProcessed + '></iframe>'
}
}
resolve({ foopager: pager, fooposter: poster });
});
}
```
Overlays
--------
For any config a widget uses, it should also check on post.fooconfig and theme.fooconfig to make sure that they don't override the foogizmo.config.fooconfig
Server
======
@ -137,17 +54,20 @@ GET /api/fs/walk
```json
[
{ "name": "happy-new-year.md"
, "createdDate": "2015-01-05T18:19:30.000Z"
, "lastModifiedDate": "2015-01-05T18:19:30.000Z"
, "size": 2121
, "relativePath": "posts/2015"
}
, { "name": "tips-for-the-ages.jade"
, "createdDate": "2014-06-16T18:19:30.000Z"
, "lastModifiedDate": "2014-06-16T18:19:30.000Z"
, "size": 389
, "relativePath": "posts"
}
, { "name": "my-first-post.html"
, "createdDate": "2013-08-01T22:47:37.000Z"
, "lastModifiedDate": "2013-08-01T22:47:37.000Z"
, "size": 4118
, "relativePath": "posts/2013"
@ -183,6 +103,7 @@ GET /api/fs/files
```json
{ "path": "posts/intro-to-http-with-netcat-node-connect.md"
, "createdDate": "2013-08-01T22:47:37.000Z"
, "lastModifiedDate": "2013-08-01T22:47:37.000Z"
, "contents": "..."
, "sha1": "6eae3a5b062c6d0d79f070c26e6d62486b40cb46"
@ -236,6 +157,7 @@ POST http://local.dear.desi:8080/api/fs/files?compiled=true&_method=PUT
{ "path": "posts/foo.md"
, "name": "foo.md"
, "relativePath": "posts"
, "createdDate": "2013-08-01T22:47:37.000Z"
, "lastModifiedDate": "2013-08-01T22:47:37.000Z"
, "contents": "..."
, "sha1": "6eae3a5b062c6d0d79f070c26e6d62486b40cb46"
@ -259,10 +181,18 @@ The response may include errors of all shapes and sizes.
}
```
**TODO** Allow rename and delete?
POST /api/fs/copy
------------------
```json
{ files: { "assets/logo.png": "compiled/assets/logo.png" } }
```
TODO
----
**TODO** Allow rename and delete?
option for client write to a hidden `.desi-revisions` (as well as indexeddb)
to safeguard against accidental blow-ups for people who aren't using git.

85
TODO.md Normal file
View File

@ -0,0 +1,85 @@
format should change permalink
date
show file path
show prod url
show dev url
POST tests
create a title and delete it (no error)
change the format. does the permalink change? (yes)
change the permalink. change the title. does the permalink stay? (yes)
change the format. does the permalink change? (yes)
change the format in the frontmatter permalink. does the format change? (yes)
create a description and delete it (no error)
create a description. does the frontmatter change? (yes)
protection
Don't allow changing the uuid, original_url, or original_date
TODO
---
check that no other post uses the same permalink
default data-model 'ruhoh@2.2'
other data-model 'desirae@1.0'
Widgets
=======
All widgets should export an object with a `create(widgetConf, desiState)` function that returns a promise.
```yaml
widgets:
foogizmo:
# only stuff that is intensely specific to foogizmo goes here
# stuff like google ad and disqus ids should go in config.yml or data.yml
config:
foobeep: boop
handle:
- html
- markdown
handlers:
post: fooposter
page: foopager
```
```javascript
'use strict';
module.exports.Foogizmo.create = function (foogizmoConf, desiState) {
return new Promise(function (resolve) {
function pager(desiPageState) {
// Do processing
return Promise.resolve();
}
function poster(desiPostState) {
// Do processing
desiPostState.fooembedinator = function (fooval) {
// figure out what type of link fooval is and return iframe html
return '<iframe src="http://embedinator.com/"' + foovalProcessed + '></iframe>'
}
}
resolve({ foopager: pager, fooposter: poster });
});
}
```
Overlays
--------
For any config a widget uses, it should also check on post.fooconfig and theme.fooconfig to make sure that they don't override the foogizmo.config.fooconfig

View File

@ -5,22 +5,27 @@
"AJ ONeal <awesome@coolaj86.com>"
],
"description": "A blogging platform in the browser. Wow!",
"main": "deardesi.js",
"main": "desirae.js",
"moduleType": [
"globals",
"node"
],
"keywords": [
"desirae",
"dear",
"desi",
"deardesi",
"blog",
"blogging",
"platform",
"ruhoh",
"nanoc",
"jekyll",
"octopress",
"browser"
],
"license": "Apache2",
"homepage": "http://github.com/coolaj86/deardesi",
"homepage": "http://github.com/DearDesi/desirae",
"ignore": [
"**/.*",
"node_modules",
@ -29,22 +34,13 @@
"tests"
],
"dependencies": {
"mustache": "~0.8.2",
"bluebird": "~2.6.2",
"rsvp": "~3.0.16",
"escape-string-regexp": "~1.0.2",
"js-yaml": "~3.2.5",
"path": "~3.46.1",
"forEachAsync": "~5.0.5",
"node-uuid": "~1.4.2",
"js-yaml": "~3.2.5",
"markdown-it": "~3.0.2",
"angular": "~1.3.8",
"angular-route": "~1.3.8",
"html5-boilerplate": "~4.3.0",
"bootstrap": "~3.3.1",
"md5": "~0.1.3"
},
"resolutions": {
"bluebird": "~2.6.2"
"mustache": "~0.8.2",
"node-uuid": "~1.4.2",
"path": "~3.46.1"
}
}

View File

@ -1,121 +0,0 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Dear Desi - Static Blog Generator</title>
<meta name="description" content="Desirae is a static blog generator that is built for the browser and also works in node.js">
<!-- Style -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"><!-- just as a fallback -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.1/spacelab/bootstrap.min.css">
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!--.navbar.navbar-default.navbar-fixed-top-->
<div style="margin-bottom: 0; border-top-width: 0;" class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<div style="padding-top: 9px; padding-left: 9px; padding-bottom: 9px;" class="pull-left"><img ng-src="http://dropsha.re/files/VY15+v8/desirae-parker-crop.jpg" style="border: 1px solid grey; height: 54px; width: 54px;" class="navbar-logo"/></div><a href="#/" style="padding-top: 23px; padding-left: 25px;" class="navbar-brand">Desirae</a>
<div style="padding-top: 9px;">
<button type="button" ng-init="navCollapsed = true" ng-click="navCollapsed = !navCollapsed" class="navbar-toggle"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
</div>
<div id="navbar-main" ng-class="!navCollapsed &amp;&amp; 'in'" class="navbar-collapse collapse">
<ul style="padding-top: 9px;" class="nav navbar-nav">
<li><a href="#/authors">Authors</a></li>
<li><a href="#/site">Site</a></li>
<li><a href="#/post">Post</a></li>
<li><a href="#/build">Build</a></li>
</ul>
</div>
</div>
</div>
<div ng-view></div>
<footer>
<center>
<p>
<!-- http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html -->
<!-- also needs updating at http://plus.google.com/me/about/edit/co -->
<a href="mailto:develop@dear.desi" rel="me">develop@dear.desi</a>
|
<a href="https://twitter.com/dearbesiblog?rel=author" rel="me">Twitter</a>
<!--a href="https://www.facebook.com/coolaj86?rel=author" rel="me">Facebook</a-->
|
<a href="https://github.com/DearDesi/desirae?rel=author" rel="me">Github</a> (v<span app-version></span>)
<!--a href="https://plus.google.com/111222501744950155474?rel=author" data-user="AJ ONeal" rel="me">Google+</a -->
|
<a href="#screencast" rel="me">YouTube</a>
|
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2 License</a>
|
<a href="http://opensource.org/licenses/MIT">MIT License</a>
</p>
<p>© AJ ONeal Tech LLC 2015
with help from
<a href="http://angularjs.org" target="_blank" title="Superheroic JavaScript MVW Framework">AngularJS</a>,
<a href="http://nodejs.org" target="_blank"
title="Open source, cross-platform server-side JavaScript runtime environment">node.js</a>,
and <a href="http://twitter.github.com/bootstrap/" target="_blank">Twitter Bootstrap</a>
</p>
</center>
</footer>
<!-- fork me on github sticker -->
<a href="https://github.com/DearDesi/desirae"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
<!-- Deps -->
<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="./lib/deardesi-utils.js"></script>
<script src="./lib/verify-config.js"></script>
<script src="./lib/deardesi-browser.js"></script>
<script src="./lib/frontmatter.js"></script>
<!-- Desi -->
<script src="./deardesi.js"></script>
<!-- UX Using Angular, but not getting fancy -->
<script src="./bower_components/angular/angular.js"></script>
<script src="./bower_components/angular-route/angular-route.js"></script>
<script src="./bower_components/md5/build/md5.min.js"></script>
<script src="./app.js"></script>
<script src="./views/about/about.js"></script>
<script src="./views/authors/authors.js"></script>
<script src="./views/site/site.js"></script>
<script src="./views/configure/configure.js"></script>
<script src="./views/build/build.js"></script>
<script src="./views/post/post.js"></script>
<script src="components/desirae/desirae.js"></script>
<script src="components/version/version.js"></script>
<script src="components/version/version-directive.js"></script>
<script src="components/version/interpolate-filter.js"></script>
</body>
</html>