toto 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -23
- data/TODO +5 -0
- data/VERSION +1 -1
- data/lib/toto.rb +8 -6
- data/toto.gemspec +3 -2
- metadata +3 -2
data/README.md
CHANGED
@@ -58,7 +58,7 @@ synopsis
|
|
58
58
|
|
59
59
|
One would start by installing _toto_, with `sudo gem install toto`, and then forking or
|
60
60
|
cloning the `dorothy` repo, to get a basic skeleton:
|
61
|
-
|
61
|
+
|
62
62
|
$ git clone git://github.com/cloudhead/dorothy.git weblog
|
63
63
|
$ cd weblog/
|
64
64
|
|
@@ -68,7 +68,7 @@ One would then edit the template at will, it has the following structure:
|
|
68
68
|
|
|
69
69
|
+- layout.rhtml # the main site layout, shared by all pages
|
70
70
|
|
|
71
|
-
+-
|
71
|
+
+- index.builder # the builder template for the atom feed
|
72
72
|
|
|
73
73
|
+- pages/ # pages, such as home, about, etc go here
|
74
74
|
|
|
@@ -84,11 +84,11 @@ One could then create a .txt article file in the `articles/` folder, and make su
|
|
84
84
|
author: Lyman Frank Baum
|
85
85
|
date: 1900/05/17
|
86
86
|
|
87
|
-
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry,
|
87
|
+
Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry,
|
88
88
|
who was a farmer, and Aunt Em, who was the farmer's wife.
|
89
|
-
|
89
|
+
|
90
90
|
If one is familiar with webby or aerial, this shouldn't look funny. Basically the top of the file is in YAML format,
|
91
|
-
and the rest of it is the blog post. They are delimited by an empty line `/\n\n/`, as you can see above.
|
91
|
+
and the rest of it is the blog post. They are delimited by an empty line `/\n\n/`, as you can see above.
|
92
92
|
None of the information is compulsory, but it's strongly encouraged you specify it.
|
93
93
|
Note that one can also use `rake` to create an article stub, with `rake new`.
|
94
94
|
|
@@ -106,7 +106,7 @@ Toto is built on top of **Rack**, and hence has a **rackup** file: _config.ru_.
|
|
106
106
|
|
107
107
|
#### on your own server
|
108
108
|
|
109
|
-
Once you have created the remote git repo, and pushed your changes to it, you can run toto with any Rack compliant web server,
|
109
|
+
Once you have created the remote git repo, and pushed your changes to it, you can run toto with any Rack compliant web server,
|
110
110
|
such as **thin**, **mongrel** or **unicorn**.
|
111
111
|
|
112
112
|
With thin, you would do something like:
|
@@ -119,8 +119,8 @@ With unicorn, you can just do:
|
|
119
119
|
|
120
120
|
#### on heroku
|
121
121
|
|
122
|
-
Toto was designed to work well with [heroku](http://heroku.com), it makes the most out of it's state-of-the-art caching,
|
123
|
-
by setting the _Cache-Control_ and _Etag_ HTTP headers. Deploying on Heroku is really easy, just get the heroku gem,
|
122
|
+
Toto was designed to work well with [heroku](http://heroku.com), it makes the most out of it's state-of-the-art caching,
|
123
|
+
by setting the _Cache-Control_ and _Etag_ HTTP headers. Deploying on Heroku is really easy, just get the heroku gem,
|
124
124
|
create a heroku app with `heroku create`, and push with `git push heroku master`.
|
125
125
|
|
126
126
|
$ heroku create weblog
|
@@ -130,20 +130,26 @@ create a heroku app with `heroku create`, and push with `git push heroku master`
|
|
130
130
|
### configuration
|
131
131
|
|
132
132
|
You can configure toto, by modifying the _config.ru_ file. For example, if you want to set the blog author to 'John Galt',
|
133
|
-
you could add `set :author, 'John Galt'` inside the `Toto::Server.new` block. Here are the defaults, to get you started:
|
134
|
-
|
135
|
-
set :author,
|
136
|
-
set :title,
|
137
|
-
set :url,
|
138
|
-
set :
|
139
|
-
set :
|
140
|
-
set :
|
141
|
-
set :
|
142
|
-
set :
|
143
|
-
set :
|
144
|
-
set :
|
145
|
-
set :
|
146
|
-
|
133
|
+
you could add `set :author, 'John Galt'` inside the `Toto::Server.new` block. Here are the defaults, to get you started:
|
134
|
+
|
135
|
+
set :author, ENV['USER'] # blog author
|
136
|
+
set :title, Dir.pwd.split('/').last # site title
|
137
|
+
set :url, 'http://example.com' # site root URL
|
138
|
+
set :prefix, '' # common path prefix for all pages
|
139
|
+
set :root, "index" # page to load on /
|
140
|
+
set :date, lambda {|now| now.strftime("%d/%m/%Y") } # date format for articles
|
141
|
+
set :markdown, :smart # use markdown + smart-mode
|
142
|
+
set :disqus, false # disqus id, or false
|
143
|
+
set :summary, :max => 150, :delim => /~\n/ # length of article summary and delimiter
|
144
|
+
set :ext, 'txt' # file extension for articles
|
145
|
+
set :cache, 28800 # cache site for 8 hours
|
146
|
+
|
147
|
+
set :to_html do |path, page, ctx| # returns an html, from a path & context
|
148
|
+
ERB.new(File.read("#{path}/#{page}.rhtml")).result(ctx)
|
149
|
+
end
|
150
|
+
|
151
|
+
set :error do |code| # The HTML for your error page
|
152
|
+
"<font style='font-size:300%'>toto, we're not in Kansas anymore (#{code})</font>"
|
147
153
|
end
|
148
154
|
|
149
155
|
thanks
|
@@ -153,4 +159,4 @@ To heroku for making this easy as pie.
|
|
153
159
|
To adam wiggins, as I stole a couple of ideas from Scanty.
|
154
160
|
To the developpers of Rack, for making such an awesome platform.
|
155
161
|
|
156
|
-
Copyright (c) 2009 cloudhead. See LICENSE for details.
|
162
|
+
Copyright (c) 2009-2010 cloudhead. See LICENSE for details.
|
data/TODO
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
data/lib/toto.rb
CHANGED
@@ -128,7 +128,7 @@ module Toto
|
|
128
128
|
protected
|
129
129
|
|
130
130
|
def http code
|
131
|
-
|
131
|
+
[@config[:error].call(code), code]
|
132
132
|
end
|
133
133
|
|
134
134
|
def articles
|
@@ -264,14 +264,15 @@ module Toto
|
|
264
264
|
markdown self[:body].sub(@config[:summary][:delim], '') rescue markdown self[:body]
|
265
265
|
end
|
266
266
|
|
267
|
+
def path
|
268
|
+
@config[:prefix] + self[:date].strftime("/%Y/%m/%d/#{slug}/")
|
269
|
+
end
|
270
|
+
|
267
271
|
def title() self[:title] || "an article" end
|
268
272
|
def date() @config[:date].call(self[:date]) end
|
269
|
-
def path() self[:date].strftime("/%Y/%m/%d/#{slug}/") end
|
270
273
|
def author() self[:author] || @config[:author] end
|
271
274
|
def to_html() self.load; super(:article, @config) end
|
272
|
-
|
273
275
|
alias :to_s to_html
|
274
|
-
|
275
276
|
end
|
276
277
|
|
277
278
|
class Config < Hash
|
@@ -279,7 +280,8 @@ module Toto
|
|
279
280
|
:author => ENV['USER'], # blog author
|
280
281
|
:title => Dir.pwd.split('/').last, # site title
|
281
282
|
:root => "index", # site index
|
282
|
-
:url => "http://127.0.0.1",
|
283
|
+
:url => "http://127.0.0.1", # root URL of the site
|
284
|
+
:prefix => "", # common path prefix for the blog
|
283
285
|
:date => lambda {|now| now.strftime("%d/%m/%Y") }, # date function
|
284
286
|
:markdown => :smart, # use markdown
|
285
287
|
:disqus => false, # disqus name
|
@@ -290,7 +292,7 @@ module Toto
|
|
290
292
|
:to_html => lambda {|path, page, ctx| # returns an html, from a path & context
|
291
293
|
ERB.new(File.read("#{path}/#{page}.rhtml")).result(ctx)
|
292
294
|
},
|
293
|
-
:
|
295
|
+
:error => lambda {|code| # The HTML for your error page
|
294
296
|
"<font style='font-size:300%'>toto, we're not in Kansas anymore (#{code})</font>"
|
295
297
|
}
|
296
298
|
}
|
data/toto.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{toto}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["cloudhead"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-02}
|
13
13
|
s.description = %q{the tiniest blog-engine in Oz.}
|
14
14
|
s.email = %q{self@cloudhead.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"LICENSE",
|
23
23
|
"README.md",
|
24
24
|
"Rakefile",
|
25
|
+
"TODO",
|
25
26
|
"VERSION",
|
26
27
|
"lib/ext/ext.rb",
|
27
28
|
"lib/toto.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudhead
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-02 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- LICENSE
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
|
+
- TODO
|
70
71
|
- VERSION
|
71
72
|
- lib/ext/ext.rb
|
72
73
|
- lib/toto.rb
|