toto 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,13 +6,20 @@ the tiniest blogging engine in Oz!
6
6
  introduction
7
7
  ------------
8
8
 
9
- toto is a git-powered, minimalist blog engine for the hackers of Oz. The engine weights around ~200 sloc at its worse.
9
+ toto is a git-powered, minimalist blog engine for the hackers of Oz. The engine weights around ~300 sloc at its worse.
10
10
  There is no toto client, at least for now; everything goes through git.
11
11
 
12
12
  philosophy
13
13
  ----------
14
14
 
15
15
  Everything that can be done better with another tool should be, but one should not have too much pie to stay fit.
16
+ In other words, toto does away with web frameworks or DSLs such as sinatra, and is built right on top of **rack**.
17
+ There is no database or ORM either, we use plain text files.
18
+
19
+ Toto was designed to be used with a reverse-proxy cache, such as [Varnish](http://varnish-cache.org).
20
+ This makes it an ideal candidate for [heroku](http://heroku.com).
21
+
22
+ Oh, and everything that can be done with git, _is_.
16
23
 
17
24
  how it works
18
25
  ------------
@@ -22,6 +29,8 @@ how it works
22
29
  - articles are processed through a markdown converter (rdiscount) by default.
23
30
  - templating is done through **ERB**.
24
31
  - toto is built right on top of **Rack**.
32
+ - toto was built to take advantage of _HTTP caching_.
33
+ - toto was built with heroku in mind.
25
34
  - comments are handled by [disqus](http://disqus.com)
26
35
  - individual articles can be accessed through urls such as _/2009/11/21/blogging-with-toto_
27
36
  - the archives can be accessed by year, month or day, wih the same format as above.
@@ -118,4 +127,11 @@ you could add `set :author, 'John Galt'` inside the `Toto::Server.new` block. He
118
127
  set :summary, :max => 150, :delim => /~\n/ # length of article summary and delimiter
119
128
  set :ext, 'txt' # file extension for articles
120
129
 
130
+ thanks
131
+ ------
132
+
133
+ To heroku for making this easy as pie.
134
+ To adam wiggins, as I stole a couple of ideas from Scanty.
135
+ To the developpers of Rack, for making such an awesome platform.
136
+
121
137
  Copyright (c) 2009 cloudhead. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
data/lib/toto.rb CHANGED
@@ -112,7 +112,11 @@ module Toto
112
112
  end
113
113
 
114
114
  def articles
115
- Dir["#{Paths[:articles]}/*.#{self[:ext]}"]
115
+ self.class.articles self[:ext]
116
+ end
117
+
118
+ def self.articles ext
119
+ Dir["#{Paths[:articles]}/*.#{ext}"]
116
120
  end
117
121
 
118
122
  class Context
@@ -120,6 +124,10 @@ module Toto
120
124
 
121
125
  def initialize ctx = {}, config = {}, path = "/"
122
126
  @config, @ctx, @path = config, ctx, path
127
+ @articles = Site.articles(@config[:ext]).reverse.map do |a|
128
+ Article.new(File.new(a), @config)
129
+ end
130
+
123
131
  ctx.each do |k, v|
124
132
  meta_def(k) { ctx.instance_of?(Hash) ? v : ctx.send(k) }
125
133
  end
@@ -283,9 +291,6 @@ module Toto
283
291
  @response['Etag'] = Digest::SHA1.hexdigest(response[:body])
284
292
 
285
293
  @response.status = response[:status]
286
- rescue
287
- return [500, {}, []]
288
- else
289
294
  @response.finish
290
295
  end
291
296
  end
@@ -0,0 +1 @@
1
+ <span id="count"><%= @articles.length %></span>
data/test/toto_test.rb CHANGED
@@ -33,6 +33,7 @@ context Toto do
33
33
  setup { @toto.get('/about') }
34
34
  asserts("returns a 200") { topic.status }.equals 200
35
35
  asserts("body is not empty") { not topic.body.empty? }
36
+ should("have access to @articles") { topic.body }.includes_html("#count" => /5/)
36
37
  end
37
38
 
38
39
  context "GET a single article" do
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.2.5"
8
+ s.version = "0.2.6"
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-01-26}
12
+ s.date = %q{2010-02-04}
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 = [
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.2.5
4
+ version: 0.2.6
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-01-26 00:00:00 -05:00
12
+ date: 2010-02-04 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency