ruby-slippers 0.1.2 → 0.1.7
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/README.md +1 -1
- data/VERSION +1 -1
- data/lib/ruby_slippers/config.rb +1 -1
- data/lib/ruby_slippers/site.rb +7 -0
- data/test/fixtures/pages/{about.rhtml → about.html.erb} +0 -0
- data/test/fixtures/pages/{archives.rhtml → archives.html.erb} +0 -0
- data/test/fixtures/pages/{article.rhtml → article.html.erb} +0 -0
- data/test/fixtures/pages/{index.rhtml → index.html.erb} +0 -0
- data/test/fixtures/pages/sitemap.html.erb +0 -0
- data/test/fixtures/pages/{tagged.rhtml → tagged.html.erb} +0 -0
- data/test/fixtures/templates/{layout.rhtml → layout.html.erb} +0 -0
- data/test/fixtures/templates/{repo.rhtml → repo.html.erb} +0 -0
- data/test/fixtures/templates/sitemap.builder +25 -0
- data/test/integration/ruby_slippers_test.rb +1 -1
- data/test/support/test_helper.rb +1 -0
- data/test/unit/site_test.rb +49 -0
- metadata +11 -8
data/README.md
CHANGED
@@ -94,7 +94,7 @@ you could add `set :author, 'John Galt'` inside the `RubySlippers::Engine::App.n
|
|
94
94
|
set :cache, 28800 # cache site for 8 hours
|
95
95
|
|
96
96
|
set :to_html do |path, page, ctx| # returns an html, from a path & context
|
97
|
-
ERB.new(File.read("#{path}/#{page}.
|
97
|
+
ERB.new(File.read("#{path}/#{page}.html.erb")).result(ctx)
|
98
98
|
end
|
99
99
|
|
100
100
|
set :error do |code| # The HTML for your error page
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/ruby_slippers/config.rb
CHANGED
@@ -14,7 +14,7 @@ class RubySlippers::Engine::Config < Hash
|
|
14
14
|
:tag_separator => ', ', # tag separator for articles
|
15
15
|
:github => {:user => "dreamr", :repos => [], :ext => 'md'}, # Github username and list of repos
|
16
16
|
:to_html => lambda {|path, page, ctx| # returns an html, from a path & context
|
17
|
-
ERB.new(File.read("#{path}/#{page}.
|
17
|
+
ERB.new(File.read("#{path}/#{page}.html.erb")).result(ctx)
|
18
18
|
},
|
19
19
|
:error => lambda {|code| # The HTML for your error page
|
20
20
|
"<font style='font-size:300%'>A large house has landed on you. You cannot continue because you are dead. <a href='/'>try again</a> (#{code})</font>"
|
data/lib/ruby_slippers/site.rb
CHANGED
@@ -12,6 +12,13 @@ module RubySlippers
|
|
12
12
|
def []= key, value
|
13
13
|
@config.set key, value
|
14
14
|
end
|
15
|
+
|
16
|
+
def sitemap type = :xml
|
17
|
+
articles = type == :html ? self.articles.reverse : self.articles
|
18
|
+
{:articles => articles.map do |article|
|
19
|
+
Article.new article, @config
|
20
|
+
end}.merge archives
|
21
|
+
end
|
15
22
|
|
16
23
|
def index type = :html
|
17
24
|
articles = type == :html ? self.articles.reverse : self.articles
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.urlset("xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9") do
|
3
|
+
|
4
|
+
xml.url do
|
5
|
+
xml.loc @config[:site_url]
|
6
|
+
xml.changefreq "weekly"
|
7
|
+
end
|
8
|
+
|
9
|
+
xml.url do
|
10
|
+
xml.loc @config[:site_url] + '/about'
|
11
|
+
xml.changefreq "weekly"
|
12
|
+
end
|
13
|
+
|
14
|
+
xml.url do
|
15
|
+
xml.loc @config[:site_url] + '/archives'
|
16
|
+
xml.changefreq "weekly"
|
17
|
+
end
|
18
|
+
|
19
|
+
articles.each do |article|
|
20
|
+
xml.url do
|
21
|
+
xml.loc @config[:site_url] + article.path
|
22
|
+
xml.changefreq "weekly"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -32,7 +32,7 @@ module RubySlippers
|
|
32
32
|
context "with a user-defined to_html" do
|
33
33
|
setup do
|
34
34
|
@config[:to_html] = lambda do |path, page, binding|
|
35
|
-
ERB.new(File.read("#{path}/#{page}.
|
35
|
+
ERB.new(File.read("#{path}/#{page}.html.erb")).result(binding)
|
36
36
|
end
|
37
37
|
@ruby_slippers.get('/')
|
38
38
|
end
|
data/test/support/test_helper.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'support/test_helper'
|
2
|
+
|
3
|
+
context RubySlippers::Engine::Site do
|
4
|
+
setup do
|
5
|
+
@config = RubySlippers::Engine::Config.new(:markdown => true, :author => AUTHOR, :url => URL)
|
6
|
+
end
|
7
|
+
|
8
|
+
context "sitemap(type)" do
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
context "index(type)" do
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
context "archives(filter)" do
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
context "article(route)" do
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
context "tagged(tag)" do
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
context "go(route, env, type)" do
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
context "class methods" do
|
33
|
+
context "self.articles(ext)" do
|
34
|
+
context "privates" do
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "privates" do
|
41
|
+
context "http(code)" do
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
context "articles" do
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ruby-slippers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- dreamr
|
@@ -214,14 +214,16 @@ files:
|
|
214
214
|
- test/fixtures/articles/2010-05-20-dorothy-and-the-wizard-of-oz.txt
|
215
215
|
- test/fixtures/articles/2011-05-18-ozma-of-oz.txt
|
216
216
|
- test/fixtures/images/ozma.png
|
217
|
-
- test/fixtures/pages/about.
|
218
|
-
- test/fixtures/pages/archives.
|
219
|
-
- test/fixtures/pages/article.
|
220
|
-
- test/fixtures/pages/index.
|
221
|
-
- test/fixtures/pages/
|
217
|
+
- test/fixtures/pages/about.html.erb
|
218
|
+
- test/fixtures/pages/archives.html.erb
|
219
|
+
- test/fixtures/pages/article.html.erb
|
220
|
+
- test/fixtures/pages/index.html.erb
|
221
|
+
- test/fixtures/pages/sitemap.html.erb
|
222
|
+
- test/fixtures/pages/tagged.html.erb
|
222
223
|
- test/fixtures/templates/index.builder
|
223
|
-
- test/fixtures/templates/layout.
|
224
|
-
- test/fixtures/templates/repo.
|
224
|
+
- test/fixtures/templates/layout.html.erb
|
225
|
+
- test/fixtures/templates/repo.html.erb
|
226
|
+
- test/fixtures/templates/sitemap.builder
|
225
227
|
- test/integration/article_test.rb
|
226
228
|
- test/integration/atom_test.rb
|
227
229
|
- test/integration/ruby_slippers_test.rb
|
@@ -229,6 +231,7 @@ files:
|
|
229
231
|
- test/unit/archives_test.rb
|
230
232
|
- test/unit/article_test.rb
|
231
233
|
- test/unit/ruby_slippers_test.rb
|
234
|
+
- test/unit/site_test.rb
|
232
235
|
homepage: http://github.com/dreamr/ruby_slippers
|
233
236
|
licenses: []
|
234
237
|
|