toto 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/toto.rb +8 -7
- data/test/templates/about.rhtml +0 -0
- data/test/templates/archives.rhtml +1 -0
- data/test/toto_test.rb +1 -0
- data/toto.gemspec +3 -2
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/toto.rb
CHANGED
@@ -79,21 +79,21 @@ module Toto
|
|
79
79
|
|
80
80
|
def go route, type = :html
|
81
81
|
route << self./ if route.empty?
|
82
|
-
type = type.to_sym
|
82
|
+
type, path = type.to_sym, route.join('/')
|
83
83
|
|
84
84
|
body, status = if Context.new.respond_to?(:"to_#{type}")
|
85
85
|
if route.first =~ /\d{4}/
|
86
86
|
case route.size
|
87
87
|
when 1..3
|
88
|
-
[Context.new(archives(route * '-'), @config).render(:archives, type), 200]
|
88
|
+
[Context.new(archives(route * '-'), @config, path).render(:archives, type), 200]
|
89
89
|
when 4
|
90
|
-
[Context.new(article(route), @config).render(:article, type), 200]
|
90
|
+
[Context.new(article(route), @config, path).render(:article, type), 200]
|
91
91
|
else http 400
|
92
92
|
end
|
93
93
|
elsif respond_to?(route = route.first.to_sym)
|
94
|
-
[Context.new(send(route, type), @config).render(route, type), 200]
|
94
|
+
[Context.new(send(route, type), @config, path).render(route, type), 200]
|
95
95
|
else
|
96
|
-
[Context.new({}, @config).render(route.to_sym, type), 200]
|
96
|
+
[Context.new({}, @config, path).render(route.to_sym, type), 200]
|
97
97
|
end
|
98
98
|
else
|
99
99
|
http 400
|
@@ -118,8 +118,8 @@ module Toto
|
|
118
118
|
class Context
|
119
119
|
include Template
|
120
120
|
|
121
|
-
def initialize ctx = {}, config = {}
|
122
|
-
@config, @ctx = config, ctx
|
121
|
+
def initialize ctx = {}, config = {}, path = "/"
|
122
|
+
@config, @ctx, @path = config, ctx, path
|
123
123
|
ctx.each do |k, v|
|
124
124
|
meta_def(k) { ctx.instance_of?(Hash) ? v : ctx.send(k) }
|
125
125
|
end
|
@@ -200,6 +200,7 @@ module Toto
|
|
200
200
|
def url
|
201
201
|
"http://#{(@config[:url].sub("http://", '') + self.path).squeeze('/')}"
|
202
202
|
end
|
203
|
+
alias :permalink url
|
203
204
|
|
204
205
|
def body
|
205
206
|
markdown self[:body].sub(@config[:summary][:delim], '') rescue markdown self[:body]
|
File without changes
|
data/test/toto_test.rb
CHANGED
@@ -53,6 +53,7 @@ context Toto do
|
|
53
53
|
setup { @toto.get('/2009/12') }
|
54
54
|
asserts("returns a 200") { topic.status }.equals 200
|
55
55
|
should("includes the entries for that month") { topic.body }.includes_elements("li.entry", 2)
|
56
|
+
should("includes the year & month") { topic.body }.includes_html("h1" => /2009\/12/)
|
56
57
|
end
|
57
58
|
|
58
59
|
context "through /archive" 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.
|
8
|
+
s.version = "0.2.3"
|
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-
|
12
|
+
s.date = %q{2010-01-25}
|
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 = [
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"test/articles/2009-12-04-some-random-article.txt",
|
32
32
|
"test/articles/2009-12-11-the-dichotomy-of-design.txt",
|
33
33
|
"test/autotest.rb",
|
34
|
+
"test/templates/about.rhtml",
|
34
35
|
"test/templates/archives.rhtml",
|
35
36
|
"test/templates/article.rhtml",
|
36
37
|
"test/templates/feed.builder",
|
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.
|
4
|
+
version: 0.2.3
|
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-
|
12
|
+
date: 2010-01-25 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- test/articles/2009-12-04-some-random-article.txt
|
77
77
|
- test/articles/2009-12-11-the-dichotomy-of-design.txt
|
78
78
|
- test/autotest.rb
|
79
|
+
- test/templates/about.rhtml
|
79
80
|
- test/templates/archives.rhtml
|
80
81
|
- test/templates/article.rhtml
|
81
82
|
- test/templates/feed.builder
|