rog 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/LICENSE +340 -0
  2. data/README +44 -0
  3. data/Rakefile +123 -0
  4. data/bin/rog +53 -0
  5. data/lib/rog.rb +66 -0
  6. data/lib/rog/app.rb +121 -0
  7. data/lib/rog/blog.rb +283 -0
  8. data/lib/rog/builtin.rf +67 -0
  9. data/lib/rog/page.rb +31 -0
  10. data/lib/rog/post.rb +80 -0
  11. data/lib/rog/project/README +49 -0
  12. data/lib/rog/project/Rakefile +26 -0
  13. data/lib/rog/project/blog/blog.yaml +20 -0
  14. data/lib/rog/project/blog/layouts/post_mini.thtml +14 -0
  15. data/lib/rog/project/blog/layouts/soft_green.thtml +80 -0
  16. data/lib/rog/project/blog/layouts/soft_green_archive.thtml +17 -0
  17. data/lib/rog/project/blog/layouts/soft_green_post.thtml +14 -0
  18. data/lib/rog/project/blog/layouts/soft_green_static.thtml +87 -0
  19. data/lib/rog/project/blog/pages/COMMON.rb +11 -0
  20. data/lib/rog/project/blog/pages/about.rb +7 -0
  21. data/lib/rog/project/blog/pages/about.thtml +3 -0
  22. data/lib/rog/project/blog/pages/archives/README +1 -0
  23. data/lib/rog/project/blog/pages/index.rb +12 -0
  24. data/lib/rog/project/blog/pages/index.thtml +0 -0
  25. data/lib/rog/project/blog/pages/posts/COMMON.rb +1 -0
  26. data/lib/rog/project/blog/pages/posts/README +1 -0
  27. data/lib/rog/project/blog/res/images/cc_powered.png +0 -0
  28. data/lib/rog/project/blog/res/images/copyleft_powered.png +0 -0
  29. data/lib/rog/project/blog/res/images/emacs_powered.png +0 -0
  30. data/lib/rog/project/blog/res/images/gnulinux_powered.png +0 -0
  31. data/lib/rog/project/blog/res/images/header.jpg +0 -0
  32. data/lib/rog/project/blog/res/images/rog_powered.png +0 -0
  33. data/lib/rog/project/blog/res/images/rote-tiny.png +0 -0
  34. data/lib/rog/project/blog/res/images/ruby_powered.png +0 -0
  35. data/lib/rog/project/blog/res/styles.css +171 -0
  36. data/lib/rog/project/blog/templates/archive-month.rb.tpl +9 -0
  37. data/lib/rog/project/blog/templates/archive-month.thtml.tpl +0 -0
  38. data/lib/rog/project/blog/templates/archive-tag.rb.tpl +9 -0
  39. data/lib/rog/project/blog/templates/archive-tag.thtml.tpl +0 -0
  40. data/lib/rog/project/blog/templates/post.rb.tpl +7 -0
  41. data/lib/rog/project/blog/templates/post.thtml.tpl +1 -0
  42. data/lib/rog/rogtasks.rb +143 -0
  43. data/tests/data/blog.yaml +21 -0
  44. data/tests/data/layouts/post_mini.thtml +14 -0
  45. data/tests/data/layouts/soft_green.thtml +87 -0
  46. data/tests/data/layouts/soft_green_archive.thtml +17 -0
  47. data/tests/data/layouts/soft_green_post.thtml +14 -0
  48. data/tests/data/layouts/soft_green_static.thtml +87 -0
  49. data/tests/data/pages/COMMON.rb +11 -0
  50. data/tests/data/pages/about.rb +7 -0
  51. data/tests/data/pages/about.thtml +3 -0
  52. data/tests/data/pages/index.rb +12 -0
  53. data/tests/data/pages/index.thtml +0 -0
  54. data/tests/data/pages/posts/20050603-prova123.rb +3 -0
  55. data/tests/data/pages/posts/20050603-prova123.thtml +0 -0
  56. data/tests/data/templates/archive-month.rb.tpl +9 -0
  57. data/tests/data/templates/archive-month.thtml.tpl +0 -0
  58. data/tests/data/templates/archive-tag.rb.tpl +9 -0
  59. data/tests/data/templates/archive-tag.thtml.tpl +0 -0
  60. data/tests/data/templates/post.rb.tpl +7 -0
  61. data/tests/data/templates/post.thtml.tpl +1 -0
  62. data/tests/tc_rogblog.rb +52 -0
  63. data/tests/tc_rogpost.rb +44 -0
  64. data/tests/tc_rogtasks.rb +35 -0
  65. data/tests/ts_rog.rb +9 -0
  66. metadata +142 -0
@@ -0,0 +1,11 @@
1
+ # Shared code for all pages below this directory.
2
+ #
3
+ # This is executed for every file transformed, in the binding of
4
+ # the appropriate Rote::Page instance. Individual page sources
5
+ # ([pagename].rb) override anything defined here.
6
+ #
7
+ # Any COMMON.rb files found in directories above this will also
8
+ # be loaded.
9
+ @site_title = "$cat /dev/random - ripley's miscellanous debris"
10
+
11
+
@@ -0,0 +1,7 @@
1
+ # Apply the 'page' layout
2
+ layout 'soft_green'
3
+
4
+ # Set a var with page title
5
+ @page_title = 'About'
6
+
7
+ @blog_posts = ""
@@ -0,0 +1,3 @@
1
+ h2. About
2
+
3
+ Questo e' un blog senza pretese... il mio personale /dev/random :-)
@@ -0,0 +1 @@
1
+ In this directory rog read all archives.
@@ -0,0 +1,12 @@
1
+ # Page code for the 'index' page. We call a few methods to
2
+ # set layout and formatting, and then create a custom variable
3
+ # for use in the layout.
4
+
5
+ # Apply the 'archive' layout
6
+ layout 'soft_green_archive'
7
+
8
+ # Set a var with the page title
9
+ @page_title = 'Blog Index'
10
+
11
+ # Get the last posts
12
+ @blog_posts = $blog.get_last_posts
File without changes
@@ -0,0 +1 @@
1
+ page_filter Rote::Filters::Syntax.new
@@ -0,0 +1 @@
1
+ In this directory rog read all the blog posts.
@@ -0,0 +1,171 @@
1
+ body {
2
+ font-family:Verdana, Arial, Helvetica, sans-serif;
3
+ font-size: 0.8em;
4
+ margin: 0;
5
+ padding: 0;
6
+ background-color:#182801;
7
+ }
8
+
9
+ .conteneur {
10
+ margin-top: 10px;
11
+ position: absolute;
12
+ width: 740px;
13
+ left: 50%;
14
+ margin-left: -370px;
15
+ border:0px solid #182801;
16
+ color: #182801;
17
+ background-color:#7A9431;
18
+ }
19
+
20
+
21
+ .header {
22
+ background-image: url("images/header.jpg");
23
+ background-repeat: no-repeat;
24
+ height:160px;
25
+ padding-left:50px;
26
+ padding-top:40px;
27
+ max-width:490px;
28
+ border-bottom:1px solid #182801;
29
+ color: #F5F8EF;
30
+ background-color:#182801;
31
+ }
32
+
33
+ .menu {
34
+ float:right;
35
+ margin: 0px;
36
+ padding:0px;
37
+ margin-left:20px;
38
+ border-left:1px solid #182801;
39
+ }
40
+
41
+ .buttons {
42
+ float:right;
43
+ position:relative;
44
+ margin: 0px;
45
+ padding: 0px;
46
+ margin-left:88%;
47
+ }
48
+
49
+ .buttons img {
50
+ margin: 1px;
51
+ border: 0px;
52
+ }
53
+
54
+ * html .menu {
55
+ margin-left: -3px;
56
+ }
57
+
58
+ .centre {
59
+ padding:20px;
60
+ padding-left:40px;
61
+ }
62
+
63
+ .pied {
64
+ float: right;
65
+ margin-bottom: 0px;
66
+ height: 25px;
67
+ text-align:right;
68
+ position: relative;
69
+ width: 740px;
70
+ background-color:#7A9431;
71
+ }
72
+
73
+ .pied div {
74
+ width: 740px;
75
+ }
76
+
77
+ .pied * {
78
+ margin-right: 4px;
79
+ background-color:#7A9431;
80
+ }
81
+
82
+ .menu-list {
83
+ list-style-type: none;
84
+ margin:0px 0px 0px 0px;
85
+ padding:0px;
86
+ }
87
+
88
+ * html .menu li{
89
+ margin-bottom:-3px;
90
+ }
91
+
92
+ .menu li {
93
+ margin:0px;
94
+ border-bottom:1px solid #182801;
95
+ color: #D9CEB8;
96
+ font-size: 1.1em;
97
+ text-decoration: none;
98
+ background-color:#748F02;
99
+ padding:0px;
100
+ width:199px;
101
+ }
102
+
103
+ .menu li a {
104
+ margin:0px;
105
+ display: block;
106
+ color: #F5F8EF;
107
+ font-size: 1.1em;
108
+ text-decoration: none;
109
+ border-left:5px solid #F5F8EF;
110
+ padding:5px;
111
+ }
112
+
113
+ .menu li a:hover {
114
+ text-decoration: none;
115
+ background-color:#90A000;
116
+ }
117
+
118
+ .menu-section-title {
119
+ background-color: #FFFFFF;
120
+ color: #748F02;
121
+ width: 100%;
122
+ display: block;
123
+ }
124
+
125
+ .p{
126
+
127
+ }
128
+
129
+ h2{
130
+ margin-left:-20px;
131
+ margin-top:15px;
132
+ padding-left:5px;
133
+ font-size: 1.3em;
134
+ color: #F5F8EF;
135
+ font-weight:normal;
136
+ }
137
+
138
+ h1{
139
+ margin-left:-30px;
140
+ margin-top:5px;
141
+ padding-left:5px;
142
+ font-size: 1.6em;
143
+ color: #F5F8EF;
144
+ font-weight:normal;
145
+ }
146
+
147
+ .header-title {
148
+ font-size:2.3em;
149
+ border-top:2px solid #F5F8EF;
150
+ }
151
+
152
+ .header-title-two {
153
+ font-size:1.1em;
154
+ padding-bottom:3px;
155
+ border-bottom:1px solid #F5F8EF;
156
+ }
157
+
158
+ a{
159
+ color:#F5F8EF;
160
+ text-decoration:none;
161
+ }
162
+
163
+ a:hover{
164
+ text-decoration:underline;
165
+ }
166
+
167
+ blockquote{
168
+ background-color:rgb(142, 168, 69);
169
+ padding : 3px;
170
+ border-left:2px solid #F5F8EF;
171
+ }
@@ -0,0 +1,9 @@
1
+ # Apply the 'archive' layout
2
+ layout 'soft_green_archive'
3
+
4
+ # Set a var for title of the archive paget
5
+ @page_title = '<%= @year %>/<%= @month %> Archive'
6
+
7
+ # Select all posts of the defined year and month
8
+ @blog_posts = $blog.posts.select { |post| post.year == "<%= @year %>" and post.month == "<%= @month %>" }
9
+
@@ -0,0 +1,9 @@
1
+ # Apply the 'archive' layout
2
+ layout 'soft_green_archive'
3
+
4
+ # Set a var for tag archive title
5
+ @page_title = '<%= @tag %> Tag Archive'
6
+
7
+ # Select all posts that include the defined tag
8
+ @blog_posts = $blog.posts.select { |post| post.tags.include?("<%= @tag %>") }
9
+
@@ -0,0 +1,7 @@
1
+ # Apply the 'post' layout
2
+ layout "soft_green_post"
3
+
4
+ # Set var for post title and tags
5
+ @page_title = "<%= @postname %>"
6
+ @page_tags = ['<%= @tags.join("','") %>']
7
+
@@ -0,0 +1 @@
1
+ *Inserire testo in textile*
@@ -0,0 +1,143 @@
1
+ # Rog - Static Blog Engine.
2
+ #
3
+ # Copyright (C) 2006 Luca Greco a.k.a. "ripley"
4
+ #
5
+ # This program is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 2 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require 'rake'
20
+ require 'rake/tasklib'
21
+
22
+ require 'rog/page'
23
+ require 'rote'
24
+ require 'rote/rotetasks'
25
+
26
+ module Rog
27
+
28
+ #####
29
+ ## Rake task library that provides a set of tasks to transform documentation
30
+ ## using Rog. To use, create a new instance of this class in your Rakefile,
31
+ ## performing appropriate configuration in a block supplied to +new+.
32
+ ## This will automatically register a set of tasks with names based on the
33
+ ## name you supply. The tasks defined are:
34
+ ##
35
+ ## #{name} - Transform all documentation, copy resources.
36
+ ## #{name}_pages - Transform all pages
37
+ ## #{name}_res - Copy resources
38
+ ## #{name}_monitor - Start watching for changes
39
+ ## #clobber_{name} - Remove output
40
+ ##
41
+ class BlogTask < Rake::TaskLib
42
+
43
+ attr_accessor :blog_path, :pages_path, :archives_path, :posts_path, :output_dir
44
+
45
+ # Create a new BlogTask, using the supplied block for configuration,
46
+ # and define tasks with the specified base-name within Rake.
47
+ def initialize(name = :blog) # :yield: self if block_given?
48
+ @name = name
49
+ @blog_path = 'blog'
50
+ @pages_path = "#{@blog_path}/pages"
51
+ @archives_path = "#{@pages_path}/archives"
52
+ @posts_path = "#{@pages_path}/posts"
53
+ @output_dir = './output'
54
+
55
+ yield self if block_given?
56
+
57
+ define_subtasks
58
+ super()
59
+ end
60
+
61
+ def blog_path=(blog_path)
62
+ @blog_path = blog_path
63
+ @pages_path = "#{@blog_path}/pages"
64
+ @archives_path = "#{@pages_path}/archives"
65
+ @posts_path = "#{@pages_path}/posts"
66
+ end
67
+
68
+ private
69
+ def define_subtasks
70
+ $blog = Blog.new(@blog_path, @pages_path, @archives_path, @posts_path)
71
+
72
+ ws = Rote::DocTask.new(:blog) do |site|
73
+ site.output_dir = @output_dir
74
+ site.layout_dir = "#{@blog_path}/layouts"
75
+
76
+ site.pages.dir = @pages_path
77
+ site.pages.include('**/*')
78
+
79
+ site.res.dir = "#{@blog_path}/res"
80
+ site.res.include('**/*')
81
+
82
+ site.ext_mapping(/thtml|textile/, 'html') do |page|
83
+ page.extend Rote::Format::HTML
84
+ page.page_filter Rote::Filters::RedCloth.new
85
+ end
86
+
87
+ site.ext_mapping(/mhtml|markdown/, 'html') do |page|
88
+ page.extend Rote::Format::HTML
89
+ page.page_filter Rote::Filters::BlueCloth.new
90
+ end
91
+
92
+ site.ext_mapping(/rdhtml|rdoc/, 'html') do |page|
93
+ page.extend Rote::Format::HTML
94
+ page.page_filter Rote::Filters::RDoc.new
95
+ end
96
+
97
+ site.ext_mapping(/html/, 'html') do |page|
98
+ page.extend Rote::Format::HTML
99
+ end
100
+ end
101
+
102
+ task :create_post do
103
+ print "Post name: "
104
+ post_name = STDIN.gets.chomp
105
+
106
+ print "tags: "
107
+ post_tags = STDIN.gets.chomp
108
+
109
+ begin
110
+ BlogUtils.generate_post(post_name, post_tags)
111
+ end if post_name.length > 0
112
+ end
113
+
114
+ task :create_tag_archive do
115
+ print "Tag name: "
116
+ tag_name = STDIN.gets.chomp
117
+
118
+ begin
119
+ BlogUtils.generate_tag_archive(tag_name)
120
+ end
121
+ end
122
+
123
+ task :create_month_archive do
124
+ print "Year: "
125
+ year = STDIN.gets.chomp
126
+
127
+ print "Month: "
128
+ month = STDIN.gets.chomp
129
+
130
+ begin
131
+ BlogUtils.generate_month_archive(year,month)
132
+ end
133
+ end
134
+
135
+ task :publish do
136
+ puts `rsync -avr #{@output_dir + '/'} #{$blog.publish_url}`
137
+ end
138
+
139
+ end
140
+
141
+ end #class
142
+ end #module
143
+
@@ -0,0 +1,21 @@
1
+ blogurl: http://salug.it/~ripley/
2
+ publish_url : ripley@salug.it:/home/ripley/public_html
3
+
4
+ pages:
5
+ - About: about.html
6
+ - Blog: index.html
7
+ - Non Esiste: nonesiste.html
8
+
9
+ buttons:
10
+ - rog_powered.png: http://www.salug.it/~ripley/projects/rog.html
11
+ - ruby_powered.png: http://www.ruby-lang.it
12
+ - emacs_powered.png: http://www.gnu.org/software/emacs
13
+ - gnulinux_powered.png: http://www.gnu.org
14
+
15
+ projects:
16
+ - Rog: http://www.salug.it/~ripley/projects/rog.html
17
+
18
+ links:
19
+ - SaLUG: http://www.salug.it
20
+ - Alca: http://alca.le.it
21
+ - HowTux: http://www.howtux.org
@@ -0,0 +1,14 @@
1
+ <!--a href='<%= "#{@blogurl}/posts/#{@page_name}" %>'>
2
+ <h2 style="display: inline;" ><%= @page_title %> </h2> (<%= @post_date %>)
3
+ </a-->
4
+
5
+ <%# Insert page content #%>
6
+ <%= @content_for_layout %>
7
+
8
+ <div class='post_tags'>
9
+ <b>Tags</b>: <%= @page_tags.join(', ') %>
10
+ </div>
11
+
12
+ <p align='center'><hr width='20%'></p>
13
+
14
+