serious 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,207 @@
1
- = serious
1
+ = Serious
2
2
 
3
- TODO...
3
+ Serious is a blog engine inspired by other filesystem-based engines like jekyll (http://jekyllrb.com/)
4
+ and toto (http://cloudhead.io/toto), but is based upon Sinatra and rack and thus can be hosted
5
+ very easily (and for free) on heroku (http://heroku.com).
6
+
7
+ The articles are stored in plain text files with an opinionated naming scheme which is used for
8
+ getting the date and permalink of your article: <code>articles/2010-02-14-will-you-be-my-valentine.txt</code>
9
+
10
+ The actual content of the article is lazy-loaded only when accessed, so things don't get messy when a lot
11
+ of articles has to be maintained. Articles consist of a YAML front, an optional summary and the body,
12
+ so a basic article looks something like this:
13
+
14
+ title: My shiny article
15
+ author: Christoph Olszowka
16
+
17
+ Some nice summary.
18
+ ~
19
+ ## Some content. You can use markdown in your articles, and also <%= "erb" %>
20
+ <% highlight do %>
21
+ puts 'it will also syntax-highlight your codes'
22
+ <% end %>
23
+
24
+ There are quite a few assumptions made by this format: You have to specify your title in yaml format
25
+ upfront. You can also specify an author for this article. If you don't, it will fall-back to the
26
+ default one (see configuration). Then two newlines must follow to seperate the yaml from the actual
27
+ content. After this, you can type your blog post. If you want a summary, add in the summary/body
28
+ delimiter "~", so Serious knows what you want.
29
+
30
+ Serious makes use of StupidFormatter (http://github.com/colszowka/stupid_formatter) for formatting
31
+ your articles, so you get ERb, Markdown and Coderay syntax highlighting for free and can customize
32
+ the processing chain to your liking, add custom ERb helpers and so on. See the documentation of
33
+ stupid_formatter (http://rdoc.info/projects/colszowka/stupid_formatter) to learn how to
34
+ customize the formatting.
35
+
36
+ == Getting started
37
+
38
+ Install the gem:
39
+
40
+ sudo gem install serious
41
+
42
+ Since a basic template and css are provided inside the gem, all you've got to do is set up a directory
43
+ for your new blog, create an articles folder, a config.ru and (for heroku), a .gems file.
44
+
45
+ The directory structure would be something like:
46
+
47
+ serious_blog/
48
+ - articles
49
+ - articles/2010-02-14-will-you-be-my-valentine.txt
50
+ - config.ru
51
+ - .gems
52
+
53
+ The config.ru is pretty straight-forward if you want to stick to the defaults:
54
+
55
+ require 'serious'
56
+ Serious.set :title, "My Sweet Little Blog"
57
+ Serious.set :author, "Christoph Olszowka"
58
+ Serious.set :url, 'http://mysweetlittleblog.heroku.com'
59
+ run Serious
60
+
61
+ The .gems file if you want to host on heroku:
62
+
63
+ stupid_formatter --version '>= 0.2.0'
64
+ serious --version '>= 0.1.2'
65
+
66
+ Note that sinatra is not included in the gemfile since heroku has it installed by default, but serious
67
+ will install it as a gem dependency on other systems as well.
68
+
69
+ Assuming you've got the heroku gem installed and set up and you've set up git for your blog with
70
+ <code>git init</code>, you can now do:
71
+
72
+ heroku create mysweetlittleblog
73
+ git push heroku master
74
+
75
+ Point your browser to the url, and bang, you're ready!
76
+
77
+ You might also want to test your blog locally. Use thin (<code>sudo gem install thin</code>) with:
78
+
79
+ thin -R config.ru start
80
+
81
+ Go to <code>localhost:3000</code> and enjoy.
82
+
83
+ == Configuration
84
+
85
+ Inside your config.ru, you can customize the settings for your Serious site.
86
+
87
+ === Custom view templates or public folder
88
+
89
+ ==== Changing the path to the public folder
90
+
91
+ Say you want to stick with the default view templates, but are willing to customize the css
92
+ to make things prettier. You can do so. Get the provided css from <code>lib/serious/site/public</code>
93
+ and point Serious to your new public folder, which assumingly lies in the current working directory
94
+ (which is where your config.ru file is)
95
+
96
+ Serious.set :public, File.join(Dir.getwd, 'public')
97
+
98
+ Serious will now serve the public directory from your custom location, but still get the views
99
+ provided with the gem.
100
+
101
+ ==== Changing the path to the views
102
+
103
+ Accordingly, if you want to stick with the default css, but want to customize the templates (would anyone
104
+ want to do this?), specify the views path and get the provided ones from the gem as a starting point.
105
+
106
+ Serious.set :views, File.join(Dir.getwd, 'views')
107
+
108
+ ==== Setting the root
109
+
110
+ The most likely case though will surely be that you want to move both <code>public</code> and
111
+ <code>views</code> into your site. Again, just copy over the provided assets from the gems
112
+ <code>lib/serious/site/</code> folder into your own site and modify them to your liking.
113
+ You'll have to specify a new root for your site, set to the current working directory, where
114
+ your config.ru resides:
115
+
116
+ Serious.set :root, Dir.getwd
117
+
118
+ Note that you do not have to specify the views and public folders separately, they'll be hosted
119
+ from the roots views and public subdirectory.
120
+
121
+ === Setting the articles path
122
+
123
+ You want your articles hosted from your home directory or fancy a different folder name?
124
+ Use the :article property, which defaults to the articles subdirectory of the current
125
+ working dir (a.k.a. where your config.ru sits)
126
+
127
+ Serious.set :articles, '/home/youruser/myblogposts'
128
+
129
+ === The title
130
+
131
+ The title is used for your atom feed, the site name and so on. It defaults to 'Serious' and you
132
+ can specify it with:
133
+
134
+ Serious.set :title, "My Sweet Little Blog"
135
+
136
+ === The author
137
+
138
+ If you don't want to specify the author for each article separately in the YAML front matter,
139
+ you can define the blog author, which will be used as a fall-back when no custom article author
140
+ is given in the YAML. It defaults to 'unknown'
141
+
142
+ Serious.set :author, "Christoph Olszowka"
143
+
144
+ === The url
145
+
146
+ Well, your site has to know where it lives to provide proper links in your atom feed. Configure this
147
+ with the url setting, which defaults to 'http://localhost:3000'
148
+
149
+ Serious.set :url, 'http://localhost:3000'
150
+
151
+ === Displayed items
152
+
153
+ You can specify how many items you want displayed across your site:
154
+
155
+ ==== Amount of feed items
156
+
157
+ To customize the amount of items in your atom feed (living under /atom.xml), set the
158
+ items_in_feed property to an integer. This defaults to 25.
159
+
160
+ Serious.set :items_in_feed, 50
161
+
162
+ ==== Amount of items with summary on index
163
+
164
+ On your index page, the most recent items will be displayed including the summary (or the whole
165
+ post if you did not use the summary/body delimiter). This defaults to 3 items, but can be customized:
166
+
167
+ Serious.set :items_on_index, 5
168
+
169
+ ==== Amount of archive items on index
170
+
171
+ Below the items with summaries on your main page, there's also a list of 'archived' items, which
172
+ only includes the title and date. This defaults to 10 items, but can be customized as well:
173
+
174
+ Serious.set :archived_on_index, 10
175
+
176
+ === Cache timeout
177
+
178
+ All pages served are automatically getting a Cache-Control header, so they get cached in your
179
+ visitor's browsers as well as in Varnish on Heroku (http://docs.heroku.com/http-caching)
180
+ (or some similar tool when you host yourself). The timeout is set to 300 seconds by default, but
181
+ can be customized with:
182
+
183
+ Serious.set :cache_timeout, 300
184
+
185
+ === Article formatting
186
+
187
+ You can define the formatting chain for StupidFormatter with:
188
+
189
+ StupidFormatter.chain = [StupidFormatter::RDiscount]
190
+
191
+ You'll surely want to read the documentation of StupidFormatter (http://github.com/colszowka/stupid_formatter)
192
+ to learn how to add your own formatters or erb helpers.
193
+
194
+ == TODO
195
+
196
+ * static pages
197
+ * make summary delim configurable
198
+ * make caching better
199
+ * valid xhtml in demo setup
200
+ * generator for basic app?
201
+ * rake tasks for generating new posts and validating existing
202
+ * disqus (optional)
203
+ * google analytics (optional)
204
+ * allow for choice between erb/haml templates
4
205
 
5
206
  == Note on Patches/Pull Requests
6
207
 
data/Rakefile CHANGED
@@ -10,11 +10,14 @@ begin
10
10
  gem.email = "christoph at olszowka dot de"
11
11
  gem.homepage = "http://github.com/colszowka/serious"
12
12
  gem.authors = ["Christoph Olszowka"]
13
+
13
14
  gem.add_dependency 'sinatra', ">= 0.9.4"
14
- gem.add_dependency 'stupid_formatter', '>= 0.1.1'
15
- gem.add_development_dependency "shoulda", ">= 0"
16
- gem.add_development_dependency "hpricot", ">= 0"
17
- gem.add_development_dependency "rack-test", ">= 0"
15
+ gem.add_dependency 'stupid_formatter', '>= 0.2.0'
16
+ gem.add_dependency 'builder', ">= 2.1.2"
17
+
18
+ gem.add_development_dependency "shoulda", ">= 2.10.0"
19
+ gem.add_development_dependency "hpricot", ">= 0.8.0"
20
+ gem.add_development_dependency "rack-test", ">= 0.5.0"
18
21
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
22
  end
20
23
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/lib/serious.rb CHANGED
@@ -3,6 +3,7 @@ gem 'sinatra', '~> 0.9.4'
3
3
  require 'sinatra/base'
4
4
  require 'stupid_formatter'
5
5
  require 'yaml'
6
+ require 'builder'
6
7
 
7
8
  class Serious < Sinatra::Base
8
9
 
@@ -13,6 +14,10 @@ class Serious < Sinatra::Base
13
14
  erb :"404"
14
15
  end
15
16
 
17
+ before do
18
+ headers['Cache-Control'] = "public, max-age=#{Serious.cache_timeout}"
19
+ end
20
+
16
21
  helpers do
17
22
  def format(text)
18
23
  StupidFormatter.result(text)
@@ -30,11 +35,16 @@ class Serious < Sinatra::Base
30
35
 
31
36
  # Index page
32
37
  get '/' do
33
- @recent = Article.all(:limit => 3)
34
- @archived = Article.all(:limit => 10, :offset => 3)
38
+ @recent = Article.all(:limit => Serious.items_on_index)
39
+ @archived = Article.all(:limit => Serious.archived_on_index, :offset => Serious.items_on_index)
35
40
  erb :index
36
41
  end
37
42
 
43
+ get '/atom.xml' do
44
+ @articles = Article.all(:limit => Serious.items_in_feed)
45
+ builder :atom
46
+ end
47
+
38
48
  # Specific article route
39
49
  get %r{^/(\d{4})/(\d{1,2})/(\d{1,2})/([^\\]+)} do
40
50
  halt 404 unless @article = Article.first(*params[:captures])
@@ -59,9 +69,15 @@ require 'serious/article'
59
69
  # Set up default stupid_formatter chain
60
70
  StupidFormatter.chain = [StupidFormatter::Erb, StupidFormatter::RDiscount]
61
71
 
62
- # Set up defaults for sinatra
72
+ # Set up defaults for app
63
73
  Serious.set :root, File.join(File.dirname(__FILE__), 'site')
64
74
  Serious.set :title, "Serious"
75
+ Serious.set :author, "unknown"
76
+ Serious.set :url, 'http://localhost:3000'
77
+ Serious.set :items_in_feed, 25 # Number of items to display in atom feed
78
+ Serious.set :items_on_index, 3 # Number of items to display with summary on main page
79
+ Serious.set :archived_on_index, 10 # Number of items to display small (title only) on main page
80
+ Serious.set :cache_timeout, 300
65
81
  Serious.set :run, false
66
82
  Serious.set :environment, :production
67
83
 
@@ -52,6 +52,11 @@ class Serious::Article
52
52
  @title ||= yaml["title"]
53
53
  end
54
54
 
55
+ # Lazy-loading author accessor with fallback to Serious.author
56
+ def author
57
+ @author ||= yaml["author"] || Serious.author
58
+ end
59
+
55
60
  # Cached lazy-loading of summary
56
61
  def summary
57
62
  return @summary if @summary
@@ -66,7 +71,12 @@ class Serious::Article
66
71
 
67
72
  # Compiles the url for this article
68
73
  def url
69
- "/#{date.year}/#{"%02d" % date.month}/#{"%02d" % date.day}/#{permalink}"
74
+ @url ||= "/#{date.year}/#{"%02d" % date.month}/#{"%02d" % date.day}/#{permalink}"
75
+ end
76
+
77
+ # url combined with Serious.url
78
+ def full_url
79
+ @full_url ||= File.join(Serious.url, url)
70
80
  end
71
81
 
72
82
  # Equality comparison
@@ -25,6 +25,10 @@ h1, h2, h3, h4 {
25
25
  float: right;
26
26
  }
27
27
 
28
+ .author {
29
+ color: #666;
30
+ }
31
+
28
32
  #header {
29
33
  margin: 25px 0px 50px 0px;
30
34
  }
@@ -2,6 +2,12 @@
2
2
  <span class="date right"><%= article.date %></span>
3
3
  <h2><a href="<%= article.url %>"><%= article.title %></a></h2>
4
4
  <div class="body">
5
- <%= format summary_only ? article.summary : article.body %>
5
+ <% if summary_only %>
6
+ <%= format article.summary %>
7
+ <% else %>
8
+ <%= format article.body %>
9
+ <span class="author right">Written by <%= article.author %></span>
10
+ <% end %>
6
11
  </div>
12
+
7
13
  </div>
@@ -0,0 +1,21 @@
1
+ xml.instruct!
2
+ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
3
+ xml.title Serious.title
4
+ xml.id Serious.url
5
+ xml.updated @articles.first.date.to_s unless @articles.empty?
6
+ xml.author { xml.name Serious.author }
7
+
8
+ @articles.each do |article|
9
+ xml.entry do
10
+ xml.title article.title
11
+ xml.link "rel" => "alternate", "href" => article.full_url
12
+ xml.id article.full_url
13
+ xml.published article.date.to_s
14
+ xml.updated article.date.to_s
15
+ xml.author { xml.name article.author }
16
+ xml.summary format(article.summary), "type" => "html"
17
+ xml.content format(article.body), "type" => "html"
18
+ end
19
+ end
20
+ end
21
+
@@ -5,5 +5,5 @@
5
5
  </li>
6
6
  <% end %>
7
7
  </ul>
8
- <h3><a href="/archives">Archives</a></h3>
8
+ <h3><a href="/archives">Older posts</a></h3>
9
9
  <%= render_archived @archived %>
data/serious.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{serious}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
12
- s.date = %q{2010-02-12}
12
+ s.date = %q{2010-02-13}
13
13
  s.description = %q{Serious is a simple, file-driven blog engine inspired by toto and driven by sinatra}
14
14
  s.email = %q{christoph at olszowka dot de}
15
15
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "lib/site/views/_archives.erb",
32
32
  "lib/site/views/_article.erb",
33
33
  "lib/site/views/archives.erb",
34
+ "lib/site/views/atom.builder",
34
35
  "lib/site/views/index.erb",
35
36
  "lib/site/views/layout.erb",
36
37
  "serious.gemspec",
@@ -59,23 +60,26 @@ Gem::Specification.new do |s|
59
60
 
60
61
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
62
  s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
62
- s.add_runtime_dependency(%q<stupid_formatter>, [">= 0.1.1"])
63
- s.add_development_dependency(%q<shoulda>, [">= 0"])
64
- s.add_development_dependency(%q<hpricot>, [">= 0"])
65
- s.add_development_dependency(%q<rack-test>, [">= 0"])
63
+ s.add_runtime_dependency(%q<stupid_formatter>, [">= 0.2.0"])
64
+ s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
65
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.0"])
66
+ s.add_development_dependency(%q<hpricot>, [">= 0.8.0"])
67
+ s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
66
68
  else
67
69
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
68
- s.add_dependency(%q<stupid_formatter>, [">= 0.1.1"])
69
- s.add_dependency(%q<shoulda>, [">= 0"])
70
- s.add_dependency(%q<hpricot>, [">= 0"])
71
- s.add_dependency(%q<rack-test>, [">= 0"])
70
+ s.add_dependency(%q<stupid_formatter>, [">= 0.2.0"])
71
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
72
+ s.add_dependency(%q<shoulda>, [">= 2.10.0"])
73
+ s.add_dependency(%q<hpricot>, [">= 0.8.0"])
74
+ s.add_dependency(%q<rack-test>, [">= 0.5.0"])
72
75
  end
73
76
  else
74
77
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
75
- s.add_dependency(%q<stupid_formatter>, [">= 0.1.1"])
76
- s.add_dependency(%q<shoulda>, [">= 0"])
77
- s.add_dependency(%q<hpricot>, [">= 0"])
78
- s.add_dependency(%q<rack-test>, [">= 0"])
78
+ s.add_dependency(%q<stupid_formatter>, [">= 0.2.0"])
79
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
80
+ s.add_dependency(%q<shoulda>, [">= 2.10.0"])
81
+ s.add_dependency(%q<hpricot>, [">= 0.8.0"])
82
+ s.add_dependency(%q<rack-test>, [">= 0.5.0"])
79
83
  end
80
84
  end
81
85
 
@@ -1,4 +1,5 @@
1
1
  title: Merry Christmas!
2
+ author: Christoph Olszowka
2
3
 
3
4
  Merry christmas, dear reader!
4
5
  ~
data/test/helper.rb CHANGED
@@ -12,6 +12,8 @@ class Test::Unit::TestCase
12
12
  include Rack::Test::Methods
13
13
  Serious.set :title, "Serious Test Blog"
14
14
  Serious.set :articles, File.join(File.dirname(__FILE__), 'articles')
15
+ Serious.set :author, "TheDeadSerious"
16
+ Serious.set :url, 'http://example.com'
15
17
  StupidFormatter.chain = [StupidFormatter::Erb, StupidFormatter::RDiscount]
16
18
 
17
19
  def app
@@ -44,4 +46,10 @@ class Test::Unit::TestCase
44
46
  assert_no_match /#{text}/, (doc/selector).inner_html
45
47
  end
46
48
  end
49
+
50
+ def self.should_set_cache_control_to(seconds)
51
+ should "set Cache-Control header with timeout of #{seconds} seconds" do
52
+ assert_equal "public, max-age=#{Serious.cache_timeout}", last_response.headers['Cache-Control']
53
+ end
54
+ end
47
55
  end
data/test/test_article.rb CHANGED
@@ -96,6 +96,10 @@ class TestArticle < Test::Unit::TestCase
96
96
  should "return '/2010/01/15/foo-bar' as url" do
97
97
  assert_equal '/2010/01/15/foo-bar', @article.url
98
98
  end
99
+
100
+ should "return 'http://example.com/2010/01/15/foo-bar' as full_url" do
101
+ assert_equal 'http://example.com/2010/01/15/foo-bar', @article.full_url
102
+ end
99
103
  end
100
104
 
101
105
  # Making sure one-digit month and day work as well
@@ -216,6 +220,10 @@ class TestArticle < Test::Unit::TestCase
216
220
  assert_nil @article.instance_variable_get(:@content)
217
221
  end
218
222
 
223
+ should "have 'Christoph Olszowka' as author" do
224
+ assert_equal 'Christoph Olszowka', @article.author
225
+ end
226
+
219
227
  context "after getting the article's title" do
220
228
  setup { @title = @article.title }
221
229
 
@@ -249,6 +257,7 @@ class TestArticle < Test::Unit::TestCase
249
257
  should("have title 'Foo Bar'") { assert_equal 'Foo Bar', @article.title }
250
258
  should('have summary "Baz!"') { assert_equal "Baz!\n", @article.summary }
251
259
  should('have body "Baz!"') { assert_equal "Baz!\n", @article.body }
260
+ should("have 'TheDeadSerious' as author") { assert_equal 'TheDeadSerious', @article.author }
252
261
  should('have summary equal to body') { assert_equal @article.summary, @article.body}
253
262
  end
254
263
 
data/test/test_serious.rb CHANGED
@@ -9,6 +9,7 @@ class TestSerious < Test::Unit::TestCase
9
9
  setup { get '/' }
10
10
 
11
11
  should_respond_with 200
12
+ should_set_cache_control_to 300
12
13
 
13
14
  should_contain_text "Serious Test Blog", "#header h1 a"
14
15
 
@@ -35,6 +36,7 @@ class TestSerious < Test::Unit::TestCase
35
36
  setup { get '/2009' }
36
37
 
37
38
  should_respond_with 200
39
+ should_set_cache_control_to 300
38
40
  should_contain_text "Archives for 2009", "#container h2:first"
39
41
  should_contain_elements 3, "ul.archives li"
40
42
  should_contain_text "Merry Christmas!", "ul.archives li:first"
@@ -46,6 +48,7 @@ class TestSerious < Test::Unit::TestCase
46
48
  setup { get '/2009/12' }
47
49
 
48
50
  should_respond_with 200
51
+ should_set_cache_control_to 300
49
52
  should_contain_text "Archives for 2009-12", "#container h2:first"
50
53
  should_contain_elements 2, "ul.archives li"
51
54
  should_contain_text "Merry Christmas!", "ul.archives li:first"
@@ -56,6 +59,7 @@ class TestSerious < Test::Unit::TestCase
56
59
  setup { get '/2009/12/11' }
57
60
 
58
61
  should_respond_with 200
62
+ should_set_cache_control_to 300
59
63
  should_contain_text "Archives for 2009-12-11", "#container h2:first"
60
64
  should_contain_elements 1, "ul.archives li"
61
65
  should_contain_text "Ruby is the shit!", "ul.archives li:first"
@@ -65,6 +69,7 @@ class TestSerious < Test::Unit::TestCase
65
69
  setup { get '/2000' }
66
70
 
67
71
  should_respond_with 200
72
+ should_set_cache_control_to 300
68
73
  should_contain_text "Archives for 2000", "#container h2:first"
69
74
  should_contain_elements 1, "ul.archives li"
70
75
  should_contain_text "Disco 2000", "ul.archives li:first"
@@ -74,6 +79,7 @@ class TestSerious < Test::Unit::TestCase
74
79
  setup { get '/2005' }
75
80
 
76
81
  should_respond_with 200
82
+ should_set_cache_control_to 300
77
83
  should_contain_text "Archives for 2005", "#container h2:first"
78
84
  should_contain_elements 0, "ul.archives li"
79
85
  end
@@ -82,6 +88,7 @@ class TestSerious < Test::Unit::TestCase
82
88
  setup { get '/2000/1' }
83
89
 
84
90
  should_respond_with 200
91
+ should_set_cache_control_to 300
85
92
  should_contain_text "Archives for 2000-01", "#container h2:first"
86
93
  should_contain_elements 1, "ul.archives li"
87
94
  should_contain_text "Disco 2000", "ul.archives li:first"
@@ -91,6 +98,7 @@ class TestSerious < Test::Unit::TestCase
91
98
  setup { get '/2000/1/01' }
92
99
 
93
100
  should_respond_with 200
101
+ should_set_cache_control_to 300
94
102
  should_contain_text "Archives for 2000-01-01", "#container h2:first"
95
103
  should_contain_elements 1, "ul.archives li"
96
104
  should_contain_text "Disco 2000", "ul.archives li:first"
@@ -100,6 +108,7 @@ class TestSerious < Test::Unit::TestCase
100
108
  setup { get '/archives' }
101
109
 
102
110
  should_respond_with 200
111
+ should_set_cache_control_to 300
103
112
  should_contain_text "Archives", "#container h2:first"
104
113
  should_contain_elements 4, "ul.archives li"
105
114
  should_contain_text "Merry Christmas!", "ul.archives li:first"
@@ -116,6 +125,7 @@ class TestSerious < Test::Unit::TestCase
116
125
  setup { get '/2009/12/24/merry-christmas' }
117
126
 
118
127
  should_respond_with 200
128
+ should_set_cache_control_to 300
119
129
  should_contain_text "Merry Christmas!", "#container h2:first"
120
130
  should_contain_text "Merry Christmas! - Serious Test Blog", "head title"
121
131
  should_contain_text "Merry christmas, dear reader!", ".article .body"
@@ -126,6 +136,7 @@ class TestSerious < Test::Unit::TestCase
126
136
  setup { get '/2009/12/11/ruby-is-the-shit' }
127
137
 
128
138
  should_respond_with 200
139
+ should_set_cache_control_to 300
129
140
  should_contain_text "Ruby is the shit!", "#container h2:first"
130
141
  should_contain_text "Some kind of introduction and summary", ".article .body"
131
142
  # Erb should evaluate properly
@@ -136,6 +147,7 @@ class TestSerious < Test::Unit::TestCase
136
147
  setup { get '/2000/1/1/disco-2000' }
137
148
 
138
149
  should_respond_with 200
150
+ should_set_cache_control_to 300
139
151
  should_contain_text "Disco 2000", "#container h2:first"
140
152
  should_contain_text "Well we were born within one hour of each other.", ".article .body"
141
153
  # Markdown should evaluate properly
@@ -146,6 +158,7 @@ class TestSerious < Test::Unit::TestCase
146
158
  setup { get '/2009/1/1/disco-2000' }
147
159
 
148
160
  should_respond_with 404
161
+ should_set_cache_control_to 300
149
162
  should_contain_text "The requested page could not be found!", "#container h2:first"
150
163
  should_not_contain_text "Well we were born within one hour of each other.", ".article .body"
151
164
  end
@@ -162,4 +175,16 @@ class TestSerious < Test::Unit::TestCase
162
175
  setup { get '/foobar.baz' }
163
176
  should_respond_with 404
164
177
  end
178
+
179
+ # ===================================================================
180
+ # Tests for the atom feed
181
+ # ===================================================================
182
+ context "GET /atom.xml" do
183
+ setup { get '/atom.xml' }
184
+ should_respond_with 200
185
+ should_set_cache_control_to 300
186
+
187
+ should_contain_text "Merry Christmas!", "feed entry:first title"
188
+ should_contain_text "Christoph Olszowka", "feed entry:first author name:first"
189
+ end
165
190
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-12 00:00:00 +01:00
12
+ date: 2010-02-13 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,17 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: 0.2.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: builder
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 2.1.2
34
44
  version:
35
45
  - !ruby/object:Gem::Dependency
36
46
  name: shoulda
@@ -40,7 +50,7 @@ dependencies:
40
50
  requirements:
41
51
  - - ">="
42
52
  - !ruby/object:Gem::Version
43
- version: "0"
53
+ version: 2.10.0
44
54
  version:
45
55
  - !ruby/object:Gem::Dependency
46
56
  name: hpricot
@@ -50,7 +60,7 @@ dependencies:
50
60
  requirements:
51
61
  - - ">="
52
62
  - !ruby/object:Gem::Version
53
- version: "0"
63
+ version: 0.8.0
54
64
  version:
55
65
  - !ruby/object:Gem::Dependency
56
66
  name: rack-test
@@ -60,7 +70,7 @@ dependencies:
60
70
  requirements:
61
71
  - - ">="
62
72
  - !ruby/object:Gem::Version
63
- version: "0"
73
+ version: 0.5.0
64
74
  version:
65
75
  description: Serious is a simple, file-driven blog engine inspired by toto and driven by sinatra
66
76
  email: christoph at olszowka dot de
@@ -86,6 +96,7 @@ files:
86
96
  - lib/site/views/_archives.erb
87
97
  - lib/site/views/_article.erb
88
98
  - lib/site/views/archives.erb
99
+ - lib/site/views/atom.builder
89
100
  - lib/site/views/index.erb
90
101
  - lib/site/views/layout.erb
91
102
  - serious.gemspec