postview 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/ABOUT +9 -0
  2. data/HISTORY +27 -1
  3. data/Rakefile +3 -1
  4. data/VERSION +4 -4
  5. data/bin/postview +2 -2
  6. data/lib/postview.rb +64 -13
  7. data/lib/postview/application.rb +34 -21
  8. data/lib/postview/authentication.rb +36 -0
  9. data/lib/postview/cli.rb +10 -0
  10. data/lib/postview/cli/create_command.rb +53 -37
  11. data/lib/postview/cli/server_command.rb +2 -2
  12. data/lib/postview/extensions.rb +10 -0
  13. data/lib/postview/helpers.rb +3 -0
  14. data/lib/postview/settings.rb +19 -17
  15. data/lib/postview/site.rb +13 -1
  16. data/lib/postview/version.rb +1 -1
  17. data/tasks/package.rake +80 -2
  18. data/test/application_test.rb +29 -14
  19. data/test/{extensions.rb → customizations.rb} +1 -0
  20. data/test/fixtures/application/config/settings.yml +4 -1
  21. data/test/fixtures/application/themes/{gemstone → mytheme}/images/banners/banner.jpg +0 -0
  22. data/test/fixtures/application/themes/{gemstone → mytheme}/images/favicon.ico +0 -0
  23. data/test/fixtures/application/themes/{gemstone → mytheme}/images/logo.png +0 -0
  24. data/test/fixtures/application/themes/{gemstone → mytheme}/images/navigation-bar.gif +0 -0
  25. data/test/fixtures/application/themes/{gemstone → mytheme}/images/postview.png +0 -0
  26. data/test/fixtures/application/themes/{gemstone → mytheme}/images/rack.png +0 -0
  27. data/test/fixtures/application/themes/{gemstone → mytheme}/images/ruby.png +0 -0
  28. data/test/fixtures/application/themes/{gemstone → mytheme}/images/sinatra.png +0 -0
  29. data/test/fixtures/application/themes/{gemstone → mytheme}/images/trojan.com +0 -0
  30. data/test/fixtures/application/themes/{gemstone/javascripts/gemstone.js → mytheme/javascripts/postview.js} +0 -0
  31. data/test/fixtures/application/themes/{gemstone → mytheme}/stylesheets/gemstone.css +0 -0
  32. data/test/fixtures/application/themes/{gemstone → mytheme}/stylesheets/postview.css +0 -0
  33. data/test/fixtures/application/themes/mytheme/templates/about.erb +1 -0
  34. data/test/fixtures/application/themes/mytheme/templates/archive/index.erb +3 -0
  35. data/test/fixtures/application/themes/mytheme/templates/archive/show.erb +1 -0
  36. data/test/fixtures/application/themes/mytheme/templates/drafts/index.erb +3 -0
  37. data/test/fixtures/application/themes/mytheme/templates/drafts/show.erb +1 -0
  38. data/test/fixtures/application/themes/mytheme/templates/error.erb +1 -0
  39. data/test/fixtures/application/themes/mytheme/templates/index.erb +3 -0
  40. data/{themes/default → test/fixtures/application/themes/mytheme/templates}/layout.erb +2 -2
  41. data/test/fixtures/application/themes/mytheme/templates/posts/index.erb +3 -0
  42. data/test/fixtures/application/themes/mytheme/templates/posts/show.erb +1 -0
  43. data/test/fixtures/application/themes/mytheme/templates/search.erb +6 -0
  44. data/test/fixtures/application/themes/mytheme/templates/tags/index.erb +3 -0
  45. data/test/fixtures/application/themes/mytheme/templates/tags/show.erb +6 -0
  46. data/test/fixtures/site/blog/config.ru +6 -0
  47. data/test/fixtures/site/blog/config/settings.yml +25 -0
  48. data/test/fixtures/{application/themes/gemstone/error.erb → site/blog/empty.yml} +0 -0
  49. data/test/fixtures/site/blog/posts/20090529-third_article.t1.t2.t3.mkd +4 -0
  50. data/test/fixtures/site/blog/posts/20090602-fourth_article.t1.t2.t3.t4.mkd +4 -0
  51. data/test/fixtures/site/blog/posts/archive/20080529-first_article.t1.mkd +4 -0
  52. data/test/fixtures/site/blog/posts/archive/20080602-second_article.t1.t2.mkd +4 -0
  53. data/test/fixtures/site/blog/posts/drafts/20090730-fifth_article.t1.t2.t3.t4.t5.mkd +4 -0
  54. data/{themes/default/error.erb → test/fixtures/site/themes/mytheme/images/banners/banner.jpg} +0 -0
  55. data/test/fixtures/site/themes/mytheme/images/favicon.ico +0 -0
  56. data/test/fixtures/site/themes/mytheme/images/logo.png +0 -0
  57. data/test/fixtures/site/themes/mytheme/images/navigation-bar.gif +0 -0
  58. data/test/fixtures/site/themes/mytheme/images/postview.png +0 -0
  59. data/test/fixtures/site/themes/mytheme/images/rack.png +0 -0
  60. data/test/fixtures/site/themes/mytheme/images/ruby.png +0 -0
  61. data/test/fixtures/site/themes/mytheme/images/sinatra.png +0 -0
  62. data/test/fixtures/site/themes/mytheme/images/trojan.com +0 -0
  63. data/test/fixtures/site/themes/mytheme/javascripts/postview.js +1 -0
  64. data/test/fixtures/site/themes/mytheme/stylesheets/gemstone.css +1 -0
  65. data/test/fixtures/site/themes/mytheme/stylesheets/postview.css +238 -0
  66. data/test/fixtures/site/themes/mytheme/templates/about.erb +1 -0
  67. data/test/fixtures/site/themes/mytheme/templates/archive/index.erb +3 -0
  68. data/test/fixtures/site/themes/mytheme/templates/archive/show.erb +1 -0
  69. data/test/fixtures/site/themes/mytheme/templates/drafts/index.erb +3 -0
  70. data/test/fixtures/site/themes/mytheme/templates/drafts/show.erb +1 -0
  71. data/test/fixtures/site/themes/mytheme/templates/error.erb +1 -0
  72. data/test/fixtures/site/themes/mytheme/templates/index.erb +3 -0
  73. data/test/fixtures/{application/themes/gemstone → site/themes/mytheme/templates}/layout.erb +20 -14
  74. data/test/fixtures/site/themes/mytheme/templates/posts/index.erb +3 -0
  75. data/test/fixtures/site/themes/mytheme/templates/posts/show.erb +1 -0
  76. data/test/fixtures/site/themes/mytheme/templates/search.erb +6 -0
  77. data/test/fixtures/site/themes/mytheme/templates/tags/index.erb +3 -0
  78. data/test/fixtures/site/themes/mytheme/templates/tags/show.erb +6 -0
  79. data/test/helpers_test.rb +1 -2
  80. data/test/settings_test.rb +12 -3
  81. data/test/site_test.rb +3 -4
  82. data/themes/default/stylesheets/postview.css +1 -0
  83. data/themes/default/{about.erb → templates/about.erb} +1 -1
  84. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/archive/index.erb +0 -0
  85. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/archive/show.erb +0 -0
  86. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/drafts/index.erb +1 -1
  87. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/drafts/show.erb +0 -0
  88. data/themes/default/templates/error.erb +13 -0
  89. data/themes/default/{index.erb → templates/index.erb} +1 -1
  90. data/themes/default/templates/layout.erb +130 -0
  91. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/posts/index.erb +0 -0
  92. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/posts/show.erb +0 -0
  93. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/search.erb +0 -0
  94. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/tags/index.erb +0 -0
  95. data/{test/fixtures/application/themes/gemstone → themes/default/templates}/tags/show.erb +0 -0
  96. metadata +164 -61
  97. data/INFO +0 -14
  98. data/lib/postview/about.rb +0 -34
  99. data/test/fixtures/application/themes/gemstone/about.erb +0 -22
  100. data/test/fixtures/application/themes/gemstone/index.erb +0 -38
  101. data/test/helper.rb +0 -9
  102. data/themes/default/archive/index.erb +0 -21
  103. data/themes/default/archive/show.erb +0 -17
  104. data/themes/default/drafts/index.erb +0 -21
  105. data/themes/default/drafts/show.erb +0 -17
  106. data/themes/default/posts/index.erb +0 -21
  107. data/themes/default/posts/show.erb +0 -17
  108. data/themes/default/search.erb +0 -40
  109. data/themes/default/tags/index.erb +0 -12
  110. data/themes/default/tags/show.erb +0 -40
data/INFO DELETED
@@ -1,14 +0,0 @@
1
- :name: postview
2
- :summary:
3
- Simple blog-engine that render Markdown files.
4
- :description:
5
- Postview is a simple blog-engine written in Ruby using the Sinatra DSL for render files written in Markdown.
6
- :authors:
7
- - Hallison Batista
8
- :email: email@hallisonbatista.com
9
- :homepage: http://postview.rubyforge.org/
10
- :dependencies:
11
- sinatra: >= 0.9.1.1
12
- sinatra-mapping: >= 1.0.5
13
- postage: >= 0.1.4.1
14
-
@@ -1,34 +0,0 @@
1
- module Postview
2
-
3
- # Copyright (c) Hallison Batista
4
- module About #:nodoc: all
5
-
6
- class << self
7
-
8
- def info
9
- @about ||= OpenStruct.new(YAML.load_file(File.join(ROOT, "INFO")))
10
- end
11
-
12
- def to_s
13
- <<-end_info.gsub(/ /,'')
14
- #{Version}
15
-
16
- Copyright (c) #{Version.info.timestamp.year} #{info.authors.join(', ')}
17
-
18
- #{info.description}
19
-
20
- For more information, please see the project homepage <#{info.homepage}>.
21
- Bugs, enhancements and improvements, please send message to <#{info.email}>.
22
- end_info
23
- end
24
-
25
- def to_html
26
- Maruku.new(to_s).to_html
27
- end
28
-
29
- end
30
-
31
- end # module About
32
-
33
- end # module Postview
34
-
@@ -1,22 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= link_to title_path(:about, site.title), :about %></h1>
4
-
5
- <div class="text">
6
-
7
- <%=Postview::About.to_html%>
8
-
9
- <p>
10
- <%=Postview.name%> uses the following libraries/projects:
11
- </p>
12
-
13
- <ul>
14
- <li><%=link_to "#{Sinatra}", "http://www.sinatrarb.com/"%></li>
15
- <li><%=link_to "#{Sinatra::Mapping}", "http://sinatra-mapping.rubyforge.org/"%></li>
16
- <li><%=link_to "#{Postage}", "http://postage.rubyforge.org/"%></li>
17
- </ul>
18
-
19
- </div><!--text-->
20
-
21
- </div><!--entry-->
22
-
@@ -1,38 +0,0 @@
1
- <% unless latest_posts.empty? %>
2
- <% for post in latest_posts %>
3
- <div class="entry">
4
-
5
- <h1><%= link_to post.title, :posts, post %></h1>
6
-
7
- <span class="entry-meta">
8
- Published at <%= post.publish_date.strftime('%A, %B %d, %Y') %>,
9
- tagged with <%= post.tags.map{ |tag| link_to tag.capitalize, :posts, tag, :title => tag.capitalize }.join(', ') %>.
10
- </span>
11
-
12
- <div class="text">
13
-
14
- <%= post.summary %>
15
-
16
- <p>
17
- <%= link_to "Read more ...", :posts, post %>
18
- </p>
19
-
20
- </div><!--text-->
21
-
22
- </div><!--entry-->
23
- <% end %>
24
- <% else %>
25
- <div class="entry">
26
-
27
- <h1>No posts</h1>
28
-
29
- <div class="text">
30
-
31
- <p>
32
- Please, check your posts directory.
33
- </p>
34
-
35
- </div><!--text-->
36
-
37
- </div><!-- entry -->
38
- <% end %>
data/test/helper.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'ruby-debug'
2
-
3
- module Postview
4
- PATH = Pathname.new("test/fixtures/application").expand_path
5
- class Settings
6
- FILE = PATH.join("config/settings.yml").expand_path
7
- end
8
- end
9
-
@@ -1,21 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%=title_path :archive%></h1>
4
-
5
- <div class="text">
6
-
7
- <dl>
8
- <% for post in all_archived_posts %>
9
- <dt>
10
- <b><%=link_to "#{post.publish_date} - #{post.title}", :archive, post, :title => post.title%></b>
11
- (<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)
12
- </dt>
13
-
14
- <dd>
15
- <%=post.summary%>
16
- </dd>
17
- <% end %>
18
- </dl>
19
- </div><!--text-->
20
- </div><!--entry-->
21
-
@@ -1,17 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= link_to current_post.title, :archive, current_post %></h1>
4
-
5
- <span class="entry-meta">
6
- Published at <%= current_post.publish_date.strftime('%A, %B %d, %Y') %>,
7
- tagged with <%= current_post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>.
8
- </span>
9
-
10
- <div class="text">
11
-
12
- <%= current_post.content %>
13
-
14
- </div><!--text-->
15
-
16
- </div><!--entry-->
17
-
@@ -1,21 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%=title_path :drafts%></h1>
4
-
5
- <div class="text">
6
-
7
- <dl>
8
- <% for post in all_drafted_posts %>
9
- <dt>
10
- <b><%=link_to "#{post.publish_date} - #{post.title}", :posts, post%></b>
11
- (<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)
12
- </dt>
13
-
14
- <dd>
15
- <%=post.summary%>
16
- </dd>
17
- <% end %>
18
- </dl>
19
- </div><!--text-->
20
- </div><!--entry-->
21
-
@@ -1,17 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= link_to current_post.title, :drafts, current_post %></h1>
4
-
5
- <span class="entry-meta">
6
- Published at <%= current_post.publish_date.strftime('%A, %B %d, %Y') %>,
7
- tagged with <%= current_post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>.
8
- </span>
9
-
10
- <div class="text">
11
-
12
- <%= current_post.content %>
13
-
14
- </div><!--text-->
15
-
16
- </div><!--entry-->
17
-
@@ -1,21 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%=title_path :posts%></h1>
4
-
5
- <div class="text">
6
-
7
- <dl>
8
- <% for post in all_posts %>
9
- <dt>
10
- <b><%=link_to "#{post.publish_date} - #{post.title}", :posts, post%></b>
11
- (<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)
12
- </dt>
13
-
14
- <dd>
15
- <%=post.summary%>
16
- </dd>
17
- <% end %>
18
- </dl>
19
- </div><!--text-->
20
- </div><!--entry-->
21
-
@@ -1,17 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= link_to current_post.title, :posts, current_post %></h1>
4
-
5
- <span class="entry-meta">
6
- Published at <%= current_post.publish_date.strftime('%A, %B %d, %Y') %>,
7
- tagged with <%= current_post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>.
8
- </span>
9
-
10
- <div class="text">
11
-
12
- <%= current_post.content %>
13
-
14
- </div><!--text-->
15
-
16
- </div><!--entry-->
17
-
@@ -1,40 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= title_path :search %> - Results for <%= params.values.to_s.split.join(', ') %></h1>
4
-
5
- <div class="text">
6
-
7
- <p>
8
- <%= posts_found.size %> found in posts and <%= archived_posts_found.size %> found in archive.
9
- </p>
10
-
11
- <% unless posts_found.empty? %>
12
- <h2><%= title_path :posts %></h2>
13
-
14
- <ul>
15
- <% for post in posts_found %>
16
- <li>
17
- <%= post.publish_date.strftime('%Y-%m-%d') %> - <strong><%= link_to post.title, :posts, post, :title => post.title %></strong>
18
- <span>(<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)</span>
19
- </li>
20
- <% end %>
21
- </ul>
22
- <% end %>
23
-
24
- <% unless archived_posts_found.empty? %>
25
- <h2><%= title_path :archive %></h2>
26
-
27
- <ul>
28
- <% for post in archived_posts_found %>
29
- <li>
30
- <b><%= link_to "#{post.publish_date} - #{post.title}", :archive, post, :title => post.title %></b>
31
- <span>(<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)</span>
32
- </li>
33
- <% end %>
34
- </ul>
35
- <% end %>
36
-
37
- </div><!--text-->
38
-
39
- </div><!--entry-->
40
-
@@ -1,12 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1><%= title_path :tags %></h1>
4
-
5
- <ul>
6
- <% for tag in all_tags %>
7
- <li><%= link_to tag.capitalize, :tags, tag, :title => tag.capitalize %> (<%=count_posts_by_tag(tag)%>)</li>
8
- <% end %>
9
- </ul>
10
-
11
- </div><!--entry-->
12
-
@@ -1,40 +0,0 @@
1
- <div class="entry">
2
-
3
- <h1>Posts tagged with <%= current_tag.capitalize %></h1>
4
-
5
- <div class="text">
6
-
7
- <p>
8
- <%= posts_found.size %> found in posts and <%= archived_posts_found.size %> found in archive.
9
- </p>
10
-
11
- <% unless posts_found.empty? %>
12
- <h2><%= title_path :posts %></h2>
13
-
14
- <ul>
15
- <% for post in posts_found %>
16
- <li>
17
- <b><%= link_to "#{post.publish_date} - #{post.title}", :posts, post, :title => post.title %></b>
18
- <span>(<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)</span>
19
- </li>
20
- <% end %>
21
- </ul>
22
- <% end %>
23
-
24
- <% unless archived_posts_found.empty? %>
25
- <h2><%= title_path :archive %></h2>
26
-
27
- <ul>
28
- <% for post in archived_posts_found %>
29
- <li>
30
- <b><%= link_to "#{post.publish_date} - #{post.title}", :archive, post, :title => post.title %></b>
31
- <span>(<%= post.tags.map{ |tag| link_to tag.capitalize, :tags, tag, :title => tag.capitalize }.join(', ') %>)</span>
32
- </li>
33
- <% end %>
34
- </ul>
35
- <% end %>
36
-
37
- </div><!--text-->
38
-
39
- </div><!--entry-->
40
-