Initial import
This commit is contained in:
commit
4cc4e303ab
44 changed files with 691 additions and 0 deletions
20
example/app/posts.rb
Normal file
20
example/app/posts.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require "nokogiri"
|
||||
require "ace/filters"
|
||||
|
||||
# Inheritted methods:
|
||||
# - content
|
||||
# - metadata
|
||||
# - config
|
||||
class Post < Ace::Item
|
||||
before Ace::LayoutFilter, layout: "post.html"
|
||||
|
||||
def document
|
||||
Nokogiri::HTML(self.content)
|
||||
end
|
||||
|
||||
def excerpt
|
||||
self.document.css("p.excerpt")
|
||||
end
|
||||
end
|
28
example/app/tags.rb
Normal file
28
example/app/tags.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class Tag < Ace::Item
|
||||
before Ace::LayoutFilter, layout: "tag.html"
|
||||
end
|
||||
|
||||
class TagPagesGenerator
|
||||
def tags
|
||||
Post.instances.inject(Hash.new) do |buffer, post|
|
||||
if tags = post.metadata[:tags]
|
||||
tags.each do |tag|
|
||||
buffer[tag] ||= Array.new
|
||||
buffer[tag] << post
|
||||
end
|
||||
end
|
||||
buffer
|
||||
end
|
||||
end
|
||||
|
||||
def run
|
||||
self.tags.each do |tag_title, items|
|
||||
tag_name = tag_title.downcase.gsub(" ", "-")
|
||||
metadata = {title: tag_title, timestamp: Time.now}
|
||||
tag = Tag.create(metadata, items)
|
||||
tag.output_path = "output/tags/#{tag_name}.html"
|
||||
end
|
||||
end
|
||||
end
|
6
example/boot.rb
Executable file
6
example/boot.rb
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env ace
|
||||
# encoding: utf-8
|
||||
|
||||
Dir["app/**/*.rb"].each do |file|
|
||||
load file
|
||||
end
|
2
example/config.yml
Normal file
2
example/config.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
title: ""
|
||||
base_url: ""
|
1
example/content/assets/css/style.css
Normal file
1
example/content/assets/css/style.css
Normal file
|
@ -0,0 +1 @@
|
|||
h1 { color: red; }
|
3
example/content/assets/js/application.js
Normal file
3
example/content/assets/js/application.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
window.onload = function () {
|
||||
console.log("I don't do nothing really, I'm just pretending to be a useful asset.");
|
||||
};
|
5
example/content/index.html.haml
Normal file
5
example/content/index.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- extends "base.html"
|
||||
|
||||
- Post.each do |post|
|
||||
%h2= post.title
|
||||
= post.excerpt
|
0
example/content/posts.json.rb
Normal file
0
example/content/posts.json.rb
Normal file
29
example/content/posts/node-js.html
Normal file
29
example/content/posts/node-js.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Node.js Asynchronous JavaScript Framework
|
||||
timestamp: 2010-09-16
|
||||
tags: ["Development", "JavaScript", "Node.js"]
|
||||
---
|
||||
|
||||
<p class="excerpt">
|
||||
Node.js is an evented I/O framework for the V8 JavaScript engine. It is intended for writing scalable network programs such as web servers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Node.js is similar in purpose to Twisted for Python, Perl Object Environment for Perl, and EventMachine for Ruby. Unlike most JavaScript, it is not executed in a web browser, but it is rather related to server-side JavaScript. Node.js implements some CommonJS specifications[1]. Node.js includes a REPL environment for interactive testing.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
var sys = require('sys'),
|
||||
http = require('http');
|
||||
|
||||
http.createServer(function (request, response) {
|
||||
response.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
response.end('Hello World\n');
|
||||
}).listen(8000);
|
||||
|
||||
sys.puts('Server running at http://127.0.0.1:8000/');
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<em>From <a href="http://en.wikipedia.org/wiki/Node.js">Wikipedia.org</em>.
|
||||
</p>
|
21
example/content/posts/ruby.html
Normal file
21
example/content/posts/ruby.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: Ruby Programming Language
|
||||
timestamp: 2010-09-14
|
||||
tags: ["Development", "Ruby"]
|
||||
---
|
||||
|
||||
<p class="excerpt">
|
||||
Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, Pike, and CLU.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The standard 1.8.7 implementation is written in C, as a single-pass interpreted language. There is currently no specification of the Ruby language, so the original implementation is considered to be the de facto reference. As of 2010[update], there are a number of complete or upcoming alternative implementations of the Ruby language, including YARV, JRuby, Rubinius, IronRuby, MacRuby, and HotRuby, each of which takes a different approach, with IronRuby, JRuby and MacRuby providing just-in-time compilation and MacRuby also providing ahead-of-time compilation. The official 1.9 branch uses YARV, as will 2.0 (development), and will eventually supersede the slower Ruby MRI.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>From <a href="http://en.wikipedia.org/wiki/Ruby_%28programming_language%29">Wikipedia.org</em>.
|
||||
</p>
|
5
example/layouts/base.html.haml
Normal file
5
example/layouts/base.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
!!!
|
||||
%html
|
||||
%head
|
||||
%body
|
||||
#main= block(:body)
|
5
example/layouts/post.html.haml
Normal file
5
example/layouts/post.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- extends "base.html"
|
||||
|
||||
- block(:body) do
|
||||
%h1 My Coooooool Bloogiiiiseeeeek!
|
||||
= item.content
|
6
example/layouts/tag.html.haml
Normal file
6
example/layouts/tag.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
- extends "base.html"
|
||||
|
||||
- block(:body) do
|
||||
%h1 My Coooooool Bloogiiiiseeeeek!
|
||||
- item.content.each do |post|
|
||||
= post.metadata[:title]
|
0
example/lib/initializer.rb
Normal file
0
example/lib/initializer.rb
Normal file
1
example/output/assets/css/style.css
Normal file
1
example/output/assets/css/style.css
Normal file
|
@ -0,0 +1 @@
|
|||
h1 { color: red; }
|
3
example/output/assets/js/application.js
Normal file
3
example/output/assets/js/application.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
window.onload = function () {
|
||||
console.log("I don't do nothing really, I'm just pretending to be a useful asset.");
|
||||
};
|
32
example/output/posts/node-js.html
Normal file
32
example/output/posts/node-js.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
<p class="excerpt">
|
||||
Node.js is an evented I/O framework for the V8 JavaScript engine. It is intended for writing scalable network programs such as web servers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Node.js is similar in purpose to Twisted for Python, Perl Object Environment for Perl, and EventMachine for Ruby. Unlike most JavaScript, it is not executed in a web browser, but it is rather related to server-side JavaScript. Node.js implements some CommonJS specifications[1]. Node.js includes a REPL environment for interactive testing.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
var sys = require('sys'),
|
||||
http = require('http');
|
||||
|
||||
http.createServer(function (request, response) {
|
||||
response.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
response.end('Hello World\n');
|
||||
}).listen(8000);
|
||||
|
||||
sys.puts('Server running at http://127.0.0.1:8000/');
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<em>From <a href="http://en.wikipedia.org/wiki/Node.js">Wikipedia.org</em>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
24
example/output/posts/ruby.html
Normal file
24
example/output/posts/ruby.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
<p class="excerpt">
|
||||
Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, Pike, and CLU.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The standard 1.8.7 implementation is written in C, as a single-pass interpreted language. There is currently no specification of the Ruby language, so the original implementation is considered to be the de facto reference. As of 2010[update], there are a number of complete or upcoming alternative implementations of the Ruby language, including YARV, JRuby, Rubinius, IronRuby, MacRuby, and HotRuby, each of which takes a different approach, with IronRuby, JRuby and MacRuby providing just-in-time compilation and MacRuby also providing ahead-of-time compilation. The official 1.9 branch uses YARV, as will 2.0 (development), and will eventually supersede the slower Ruby MRI.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>From <a href="http://en.wikipedia.org/wiki/Ruby_%28programming_language%29">Wikipedia.org</em>.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
example/output/posts/test.html
Normal file
10
example/output/posts/test.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
content
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
11
example/output/tags/development.html
Normal file
11
example/output/tags/development.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
Node.js Asynchronous JavaScript Framework
|
||||
Ruby Programming Language
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
example/output/tags/javascript.html
Normal file
10
example/output/tags/javascript.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
Node.js Asynchronous JavaScript Framework
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
example/output/tags/node.js.html
Normal file
10
example/output/tags/node.js.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
Node.js Asynchronous JavaScript Framework
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
10
example/output/tags/ruby.html
Normal file
10
example/output/tags/ruby.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div id='main'>
|
||||
<h1>My Coooooool Bloogiiiiseeeeek!</h1>
|
||||
Ruby Programming Language
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
8
example/rules.rb
Normal file
8
example/rules.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# encoding: utf-8
|
||||
|
||||
# filters
|
||||
rule Post, "posts/*.html"
|
||||
rule Ace::Asset, "assets/**/*"
|
||||
|
||||
# generators
|
||||
generator TagPagesGenerator#, "/tags/:slug"
|
0
example/tasks.rb
Executable file
0
example/tasks.rb
Executable file
Loading…
Add table
Add a link
Reference in a new issue