rote 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -71,7 +71,12 @@ With that done, you should be able to run
71
71
 
72
72
  to verify that the command-line wrapper is working. You should of course see
73
73
  the version number of your Rote installation.
74
-
74
+
75
+ *NOTE* Windows users - you may experience problems at this point, with Rote
76
+ complaining that 'rake' is an invalid command. To fix this, simply set an
77
+ environment variable, RAKE_CMD, with the command to execute for rake
78
+ (e.g. rake.bat).
79
+
75
80
  == How do I use it?
76
81
 
77
82
  Please see the user guide for usage information. The latest version can be
@@ -101,8 +106,9 @@ packages from escaping into the wild.
101
106
 
102
107
  === Further information
103
108
 
104
- Rote is developed by Ross Bamford (ross <at> roscopeco.co.uk). Flame him if
105
- it breaks your day ;P
109
+ Rote is developed by Ross Bamford (rosco <at> roscopeco.co.uk), with help from
110
+ the developers listed in CONTRIBUTORS. Any bugs are probably down to Ross,
111
+ though, so flame him if it breaks your day ;P
106
112
 
107
113
  * Homepage - http://rote.rubyforge.org/
108
114
  * Project - http://rubyforge.org/projects/rote
@@ -111,3 +117,9 @@ it breaks your day ;P
111
117
 
112
118
  As you may have guessed, Rote's hosting and development services are provided
113
119
  by http://RubyForge.org .
120
+
121
+ Thanks to Yukihiro Matsumoto for a remarkable platform, Masatoshi Seki for
122
+ embedding it in text, Jim Weirich for an elegant build tool, and Dean Allen
123
+ for making markup easy in Ruby. Thanks too to the many people who've contributed
124
+ and improved these things over the years - as ever, we stand on the shoulders
125
+ of giants.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@
6
6
  # This Rakefile is heavily based on Rake's own Rakefile.
7
7
  # Portions copyright (c)2003, 2004 Jim Weirich (jim <AT> weirichhouse.org)
8
8
  #
9
- # $Id: Rakefile,v 1.10 2005/12/02 20:07:16 roscopeco Exp $
9
+ # $Id: Rakefile,v 1.11 2005/12/05 14:45:15 roscopeco Exp $
10
10
  #
11
11
 
12
12
  begin
@@ -141,6 +141,7 @@ PKG_FILES = FileList[
141
141
  'bin/**/*',
142
142
  'lib/**/*.rb',
143
143
  'lib/rote/builtin.rf',
144
+ 'lib/rote/project/**/*',
144
145
  'test/**/*',
145
146
  'doc/**/*'
146
147
  ]
@@ -289,6 +290,57 @@ task :rubyfiles do
289
290
  puts Dir['bin/*'].reject { |fn| fn =~ /CVS|(~$)|(\.rb$)/ }
290
291
  end
291
292
 
293
+ desc "Show deprecation notes"
294
+ task :deprecated do
295
+ Dir['lib/**/*.r?'].each do |fn|
296
+ File.open(fn) do |f|
297
+ [*f].each_with_index do |line,i|
298
+ if line =~ /#(.*)vv([0-9\.]+)(?:[\s\t]*)v-([0-9\.]+)/
299
+ cmnt = $~[1].strip
300
+ cmnt = '<No comment>' if (cmnt.nil? or cmnt.empty?)
301
+ printf "%s:%d\n%-60s %5s %5s\n\n", fn, i+1, cmnt, $~[2].strip, $~[3].strip
302
+ end #if splits okay
303
+ end #each_w_idx
304
+ end #fopen
305
+ end #dir
306
+ end
307
+
308
+ desc "Find features deprecated at VER"
309
+ task :deprecated_by do
310
+ fail "\nYou must specify the version to check (VER=x.y.z)\n\n" unless ver = ENV['VER']
311
+ Dir['lib/**/*.r?'].each do |fn|
312
+ File.open(fn) do |f|
313
+ [*f].each_with_index do |line,i|
314
+ if line =~ /vv#{ver}/
315
+ if line =~ /#(.*)vv([0-9\.]+)(?:[\s\t]*)v-([0-9\.]+)/
316
+ cmnt = $~[1].strip
317
+ cmnt = '<No comment>' if (cmnt.nil? or cmnt.empty?)
318
+ printf "%s:%d\n%-60s %5s %5s\n\n", fn, i+1, cmnt, $~[2].strip, $~[3].strip
319
+ end #if splits okay
320
+ end #if line is dep remove
321
+ end #each_w_idx
322
+ end #fopen
323
+ end #dir
324
+ end
325
+
326
+ desc "Find deprecated features to be removed by VER"
327
+ task :deprecated_due do
328
+ fail "\nYou must specify the version to check (VER=x.y.z)\n\n" unless ver = ENV['VER']
329
+ Dir['lib/**/*.r?'].each do |fn|
330
+ File.open(fn) do |f|
331
+ [*f].each_with_index do |line,i|
332
+ if line =~ /v-#{ver}/
333
+ if line =~ /#(.*)vv([0-9\.]+)(?:[\s\t]*)v-([0-9\.]+)/
334
+ cmnt = $~[1].strip
335
+ cmnt = '<No comment>' if (cmnt.nil? or cmnt.empty?)
336
+ printf "%s:%d\n%-60s %5s %5s\n\n", fn, i+1, cmnt, $~[2].strip, $~[3].strip
337
+ end #if splits okay
338
+ end #if line is dep remove
339
+ end #each_w_idx
340
+ end #fopen
341
+ end #dir
342
+ end
343
+
292
344
  # --------------------------------------------------------------------
293
345
  # Creating a release
294
346
 
data/TODO CHANGED
@@ -1,16 +1,20 @@
1
1
  = Rote project -- Todo list
2
2
 
3
3
  Most of the following ideas will probably be implemented at some point.
4
- Send any suggestions (or test-driven patches) to:
4
+ Send any suggestions or patches (preferably as/with tests) to:
5
5
 
6
6
  rosco <at> roscopeco <dot> co <dot> uk
7
7
 
8
8
  * More flexible markup rendering
9
9
  * Nested layouts
10
+ * Better COMMON.rb handling
10
11
  * Find and Integrate test run / coverage reports
11
12
  * Ability to have multiple views of a section, e.g. user guide (separate
12
13
  pages) and user guide (one page) generated from same source.
14
+ * Auto-link within section
13
15
  * Index and glossary support
14
16
  * statistics
15
17
  * (maybe?) Automatic navigation / TOC
16
18
  * (maybe?) Rant integration
19
+ * Ability to define rules for input.ext -> output.ext
20
+ * Support ruby source templates (.rbt, auto rename to .rb on output).
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/xhtml1-strict.dtd">
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
3
  <html>
4
4
 
5
5
  <head>
data/doc/man/rote.1.gz CHANGED
Binary file
@@ -1,7 +1,18 @@
1
- # This is a hack that exists currently to inherit COMMON.rb
2
- # from above. Of course, we can still define extra stuff
3
- # here.
4
- #
5
- # This will be made implicit soon.
6
-
1
+ # inherit common.rb from above
7
2
  inherit_common
3
+
4
+ def section_anchor(name)
5
+ name.downcase.gsub(/\s/,'_')
6
+ end
7
+
8
+ def section_link(name, text = name)
9
+ %Q{"#{text}":\##{section_anchor(name)}}
10
+ end
11
+
12
+ def section(level, name, toplink = true)
13
+ %Q{
14
+ #{"[#{section_link('Top')}]" if toplink}
15
+ <a name='#{section_anchor(name)}'></a>
16
+ h#{level}. #{name}
17
+ }
18
+ end
@@ -6,25 +6,26 @@ It is assumed that you have installed Rote already. If not, please
6
6
  consult the <a href="<%= link_rel '/rdoc/files/README.html' %>">README</a>
7
7
  for installation instructions.
8
8
 
9
- <a name='top'/>
9
+ <a name='top'></a>
10
10
  h3. Contents
11
11
 
12
- * "Conventions":#conventions
13
- * "Getting started with Rote":#getting_started
14
- ** "Documentation source layout":#getting_started_source_layout
15
- ** "From the command-line":#getting_started_command_line
16
- ** "From your Rakefile":#getting_started_rakefile
17
- * "Creating templates":#create_templates
18
- ** "Basics":#create_templates_basics
19
- ** "Formatting":#create_templates_formatting
20
- ** "Template code & ERB":#create_templates_erb
21
- ** "Applying layout":#create_templates_layout
22
- * "Resources":#resources
23
- * "Source monitoring":#monitor
24
- * "Publishing":#publishing
12
+ * <%= section_link 'Conventions' %>
13
+ * <%= section_link 'Starting out with Rote' %>
14
+ ** <%= section_link 'Creating a project' %>
15
+ ** <%= section_link 'From the command-line' %>
16
+ ** <%= section_link 'From your Rakefile' %>
17
+ * <%= section_link 'Creating templates' %>
18
+ ** <%= section_link 'Basics' %>
19
+ ** <%= section_link 'Formatting' %>
20
+ ** <%= section_link 'Template code and ERB' %>
21
+ ** <%= section_link 'Applying layout' %>
22
+ * <%= section_link 'Resources' %>
23
+ * <%= section_link 'Source monitoring' %>
24
+ ** <%= section_link 'Auto-refresh Task' %>
25
+ * <%= section_link 'Definining additional tasks' %>
26
+ * <%= section_link 'Publishing' %>
25
27
 
26
- <a name='conventions'/>
27
- h3. Conventions used in this document
28
+ <%= section 3, 'Conventions', false %>
28
29
 
29
30
  *Task names* - Rote's standard tasks are always referred to with the base-name
30
31
  _doc_ , e.g. @doc_pages@, @doc_clean@, and just plain @doc@. This is the prefix
@@ -32,40 +33,38 @@ used by the built-in Rakefile, but since it can be changed when using Rote in
32
33
  your own Rake builds you should of course substitute whatever is appropriate
33
34
  if you have chosen to modify it.
34
35
 
35
- <a name='getting_started'/>
36
- h3. Getting started with Rote
36
+ <%= section 3, 'Starting out with Rote' %>
37
37
 
38
- <a name='getting_started_source_layout'/>
39
- h4. Documentation source layout
38
+ <%= section 4, 'Creating a project', false %>
40
39
 
41
- To get started quickly, we'll use the standard Rote directory layout, which
42
- can be used immediately with the command-line wrapper, and fits well with
43
- Rakefile usage too. Basically, Rote expects your documentation source to
44
- be laid out as follows:
40
+ To get started quickly, we'll use the built-in project template, which provides
41
+ a standard Rote directory tree with a single page, and Rakefile ready for
42
+ customisation. The template gives a convenient way to get started on a new
43
+ Rote project. To invoke it, just type:
44
+
45
+ <p><pre><code> rote create someproject</code></pre></p>
46
+
47
+ If all goes well, you should see a single line (@cp_r ...@) indicating that
48
+ Rote copied the template to your specified directory (@someproject@ in this
49
+ case). This directory will have the following layout:
45
50
 
46
51
  <p><code><pre>
47
- project_root ( <- root, this can be called whatever you like)
52
+ someproject
48
53
  |
49
- |--> [publish.rf]
54
+ |--> Rakefile
50
55
  |
51
56
  |--> doc
52
- | |--> [COMMON.rb]
53
- | |
54
57
  | |--> res
55
- | | |--> (resources)
58
+ | | |--> images
59
+ | | |--> rote-tiny.png
56
60
  | |
57
61
  | |--> layouts
58
- | | |--> one.txt
59
- | | |--> two.html
62
+ | | |--> normal.html
60
63
  | |
61
64
  | |--> pages
62
- | | |--> [COMMON.rb]
63
- | | |--> apage.txt
64
- | | |--> [apage.rb]
65
- | | |--> adir
66
- | | | |--> [COMMON.rb]
67
- | | | |--> bpage.html
68
- | | | |--> [bpage.rb]
65
+ | |--> COMMON.rb
66
+ | |--> index.html
67
+ | |--> index.rb
69
68
 
70
69
  </pre></code></p>
71
70
 
@@ -75,17 +74,18 @@ See the section on Layouts below for details on layout name resolution.
75
74
 
76
75
  Ruby source is optional, and allows you to define instance variables and
77
76
  methods on a Page instance. COMMON.rb is applied to all pages in a given
78
- directory. See "the section on templates":#create_templates for more
79
- information on the specifics.
77
+ directory. See <%= section_link 'creating templates', 'the section on templates' %>
78
+ for more information on the specifics.
80
79
 
81
- If you've downloaded Rote, then you can see the canonical example site by
82
- looking in the @doc/@ directory (where you'll find the source for this
83
- site).
80
+ To build the sample page, simply type @rote@ or @rake@ from the top-level
81
+ directory. This will start the default @doc@ task to transform all
82
+ modified pages / resources (everything, in this case).
84
83
 
85
- ["top":#top]
84
+ The README included with the project template has further information
85
+ about build options and available tasks, as well as pointers to possible
86
+ next steps.
86
87
 
87
- <a name='getting_started_command_line'/>
88
- h4. From the command-line
88
+ <%= section 4, 'From the command-line' %>
89
89
 
90
90
  If you are generating a standalone documentation set (i.e. not as part of
91
91
  some wider build) then you don't need to worry about writing a @Rakefile@ -
@@ -107,7 +107,7 @@ individual file task for each page in your doc set. For example, running
107
107
  the 'rote' command again with no options will cause it to exit almost
108
108
  immediately, since all output is up to date. If you change a file, and run
109
109
  rote again, then just that file will be updated. There are a few caveats
110
- with this (see "the notes section":#final_notes).
110
+ with this (see <%= section_link 'Final notes', 'the notes section' %>).
111
111
 
112
112
  The file tasks are named for the target files, so for example to generate
113
113
  just the top-level index.html (regardless of whether it's been modified)
@@ -128,13 +128,10 @@ Further command-line usage information is available with:
128
128
 
129
129
  <p><pre><code> rote --usage</code></pre></p>
130
130
 
131
- and Unix installations performed with =install.rb= should also make a
131
+ and Unix installations performed with @install.rb@ should also make a
132
132
  manpage available for the @rote@ command.
133
133
 
134
- ["top":#top]
135
-
136
- <a name='getting_started_rakefile'/>
137
- h4. From your @Rakefile@
134
+ <%= section 4, 'From your Rakefile' %>
138
135
 
139
136
  If you are wanting to build documentation as part of a larger build process, or
140
137
  commandline setup, then you'll want to get started on integrating Rote with
@@ -146,7 +143,7 @@ something like:
146
143
  require 'rote'
147
144
 
148
145
  ws = Rote::DocTask.new(:doc) { |site|
149
- site.site_dir = 'html'
146
+ site.output_dir = 'html'
150
147
  site.layout_dir = 'doc/layouts'
151
148
 
152
149
  site.pages.dir = 'doc/pages'
@@ -157,8 +154,7 @@ something like:
157
154
  site.res.include('**/*.gif')
158
155
  site.res.include('**/*.jpg')
159
156
  site.res.include('**/*.css')
160
- }
161
-
157
+ }
162
158
  </code></pre>
163
159
 
164
160
  Save this as @Rakefile@, and fire up:
@@ -168,16 +164,12 @@ Save this as @Rakefile@, and fire up:
168
164
  If all goes well, you should see each command and transformation output to your
169
165
  console as Rote runs.
170
166
 
171
- *Note* that it's safe to include '**/*' in the @pages@ list, since @rb@
172
- files are implicitly excluded.
173
-
174
- ["top":#top]
167
+ *Note* that it's safe to include all files in the @pages@ list, since @rb@
168
+ files are implicitly excluded (as page code).
175
169
 
176
- <a name='create_templates'/>
177
- h3. Creating templates
170
+ <%= section 3, 'Creating templates' %>
178
171
 
179
- <a name='create_templates_basics'/>
180
- h4. The basics
172
+ <%= section 4, 'The Basics', false %>
181
173
 
182
174
  As mentioned, templates are simply text files in the @doc/pages@ directory. The
183
175
  layout below that directory is retained when transforming pages, and is
@@ -187,10 +179,7 @@ By default, any file with an extension other than @rb@ will be processed
187
179
  as a page template (with it's associated ruby source). The output will have
188
180
  the same filename and path, relative to the output directory.
189
181
 
190
- ["top":#top]
191
-
192
- <a name='create_templates_formatting'/>
193
- h4. Applying formatting
182
+ <%= section 4, 'Applying formatting' %>
194
183
 
195
184
  If you're generating HTML, you'll probably want to use some plaintext
196
185
  formatting, rather than writing HTML by hand. Rote directly supports
@@ -202,10 +191,10 @@ appropriate symbols to the array, for example in page code or COMMON.rb:
202
191
  <p><pre><code> format_opts << :textile << :markdown << :rdoc</code></pre></p>
203
192
 
204
193
  This can be done in page code, COMMON.rb, or even inside the template itself.
205
- See "the section on template code":#create_templates_erb for more information
206
- on adding code to your templates. Obviously you don't have to use all three,
207
- and order isn't significant - formatting is applied as Textile, then Markdown,
208
- then Rdoc.
194
+ See <%= section_link 'template code and erb', 'the section on template code' %>
195
+ for more information on adding code to your templates. Obviously you don't have
196
+ to use all three, and order isn't significant - formatting is applied as Textile,
197
+ then Markdown, then Rdoc.
209
198
 
210
199
  *Some additional notes on formatting*
211
200
 
@@ -215,22 +204,22 @@ then Rdoc.
215
204
  being ignored. Always use the << :opt syntax.
216
205
 
217
206
  * Note that *Formatting is applied _after_ any ERB has been evaluated.*
207
+ This allows you to output formatting from your code and have it rendered
208
+ properly.
218
209
 
219
210
  * that the options you supply are passed directly to RedCloth, so you can
220
211
  exercise much more control over the formatting by using the feature-specific
221
212
  symbols defined by RedCloth, rather than the blanket :textile and :markdown
222
213
  symbols.
223
214
 
224
- ["top":#top]
225
-
226
- <a name='create_templates_erb'/>
227
- h4. Template code and ERB
215
+ <%= section 4, 'Template code and ERB' %>
228
216
 
229
217
  All templates may contain embedded Ruby code (ERB), delimited by the standard
230
- &lt;% ... %&gt; (for executed code) and &lt;%= ... %&gt; (for output) tags. Any
231
- (valid) Ruby code may be placed in the templates, and variables may be defined to
232
- allow information to be passed into templates. There are four places where
233
- you might define such variables. The following is in order of evaluation:
218
+ &lt;&#37; ... &#37;&gt; (for executed code) and &lt;&#37;= ... &#37;&gt; (for
219
+ output) tags. Any (valid) Ruby code may be placed in the templates, and
220
+ variables may be defined to allow information to be passed into templates.
221
+ There are four places where you might define such variables. The following
222
+ is in order of evaluation:
234
223
 
235
224
  * This directory's COMMON.rb, or the parent directory's COMMON.rb if
236
225
  @inherit_common@ is used.
@@ -243,10 +232,7 @@ evaluates them, in order, in the same binding as the template is later rendered
243
232
  in (i.e. the @Page@ instance binding). Therefore, you can define
244
233
  instance variables to pass data around, or even helper methods if you wish.
245
234
 
246
- ["top":#top]
247
-
248
- <a name='create_templates_layout'/>
249
- h4. Layout
235
+ <%= section 4, 'Layout' %>
250
236
 
251
237
  Layouts are stored under the @doc/layouts@ directory (by default). They may
252
238
  be organised into subdirectories, but this hierarchy is not connected to
@@ -258,7 +244,7 @@ specified, then the same extension as the page itself is assumed. Examples:
258
244
  * layout 'one'
259
245
  * layout 'main/wide'
260
246
  * layout 'dark.txt'
261
- * <&#37; layout 'my' &#37;>
247
+ * &lt;&#37; layout 'my' &#37;&gt;
262
248
 
263
249
  _*Note* the absence of the = sign in the ERB tag in the last example,_
264
250
  _indicating that this is code to be executed rather than code that should_
@@ -270,16 +256,13 @@ the layout (in which textile is currently not supported). The layout is
270
256
  responsible for inserting the rendered template where appropriate, with
271
257
  e.g.:
272
258
 
273
- * <&#37;= @content_for_layout &#37;>
259
+ * &lt;&#37;= @content_for_layout &#37;&gt;
274
260
 
275
261
  This pattern shouldn't be unfamiliar. Again, note that Rote doesn't mandate
276
262
  HTML, despite the appearance from the ERB tags - any (textual) format can
277
263
  be templated and laid out.
278
264
 
279
- ["top":#top]
280
-
281
- <a name='resources'/>
282
- h3. Resources
265
+ <%= section 3, 'Resources' %>
283
266
 
284
267
  Of course, you're likely to have resources for your site (images, sounds, etc)
285
268
  and you'll need to copy them over to the target too. Such resources should be
@@ -291,10 +274,7 @@ output, and will be preserved during the copy. Resources are copied only if
291
274
  necessary (determined by existence and last-modified timestamp), in a similar
292
275
  way to pages.
293
276
 
294
- ["top":#top]
295
-
296
- <a name='monitor'/>
297
- h3. Source monitoring
277
+ <%= section 3, 'Source monitoring' %>
298
278
 
299
279
  When making changes to a documentation set, you frequently need to render out
300
280
  your changes to check formatting or ensure something works correctly. In this
@@ -330,8 +310,38 @@ because it just might make me reconsider.
330
310
  When you're done with Rote simply hit CTRL-C (or use @kill@) to stop monitoring
331
311
  and exit.
332
312
 
333
- <a name='publishing'/>
334
- h3. Publishing
313
+ <%= section 4, 'Auto-refresh task' %>
314
+
315
+ When using Source monitoring, it's often handy to be able to inform some other
316
+ program that something has changed. For example, you may want to automatically
317
+ refresh your browser after changed HTML is rendered. Rote supports this via
318
+ the @doc_refresh@ task, which is triggered whenever @doc_monitor@ finds changes
319
+ in your source set (_after_ rendering, of course).
320
+
321
+ The following (Mac) example uses OSA script to refresh the Safari browser when
322
+ your rendered documentation changes:
323
+ <pre><code>
324
+ require 'osx/aeosa'
325
+
326
+ task :doc_refresh do
327
+ OSX.do_osascript('tell application "Safari" to do javascript "window.location.reload();" in document 1')
328
+ end
329
+ </code></pre>
330
+
331
+ As with all rake tasks, multiple actions can be associated, and you can of course
332
+ add prerequisites to the @refresh@ task as with any other Rake task.
333
+
334
+ <%= section 3, 'Defining additional tasks' %>
335
+
336
+ The command-line build will automatically look for a file in the top-level
337
+ directory (above @doc@) named @local.rf@. If found, this file will be
338
+ evaluated by Rake, making any tasks defined within it available to your
339
+ build. This can be used to define an <%= section_link 'auto-refresh task' %>
340
+ for the <%= section_link 'source monitoring', 'monitor' %> feature, for example,
341
+ or to define tasks to publish your site (most likely using one of Rake's
342
+ directory publishers).
343
+
344
+ <%= section 3, 'Publishing' %>
335
345
 
336
346
  Rote does not provide any direct support for publishing your site at present,
337
347
  relying on you to configure an appropriate publish task if required, using
@@ -339,29 +349,20 @@ the publishers supplied with Rake (in @rake/contrib@), or your own. This
339
349
  allows maximum flexibility, and allows Rote to concentrate on creating your
340
350
  documents.
341
351
 
342
- The command-line build will automatically look for a file in the top-level
343
- directory (above @doc@) named @publish.rf@. If found, this file will be
344
- evaluated by Rake, making any tasks defined within it available to your
345
- build. The most likely use case is to define a task that uses an SSH directory
346
- publisher to publish via SCP.
347
-
348
- ["top":#top]
349
-
350
- <a name='final_notes'/>
351
- h3. Final notes
352
+ <%= section 3, 'Final notes' %>
352
353
 
353
354
  Currently, there isn't enough checking involved on source resources when
354
355
  building pages - Basically, only templates are considered when Rake decides
355
- what to update. If you change layouts, code or resources you'll need to run:
356
+ what to update. If you change common or page code you'll need to run:
356
357
 
357
358
  <p><pre><code> rote clobber</code></pre></p>
358
359
 
359
- to make sure everything gets updated. It's recommended to always run upload
360
- as:
361
-
362
- <p><pre><code> rote clobber upload</code></pre></p>
363
-
364
- Please note that this isn't Rake's limitation - it's mine. It will be fixed
365
- in a later version of Rote.
366
-
367
- ["top":#top]
360
+ to make sure everything gets updated. This will also apply if you have
361
+ interdependencies between pages and resources, but in that situation you
362
+ _could_ work around it if you wished by manually (!) specifying the
363
+ appropriate resources as dependencies to the appropriate page task.
364
+ Such configuration is beyond the scope of this manual - see
365
+ "Rake's Documentation":http://rake.rubyforge.org/ for information on
366
+ dependency configuration and resolution in Rake.
367
+
368
+ [<%= section_link 'Top' %>]
data/lib/rote.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # rote.rb - main Rote module
2
2
  # Copyright (c) 2005 Ross Bamford (and contributors)
3
+ # $Id: rote.rb,v 1.18 2005/12/05 14:55:22 roscopeco Exp $
3
4
  #
4
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
6
  # this software and associated documentation files (the "Software"), to deal in
@@ -41,23 +42,29 @@ require 'net/ftp'
41
42
  require 'rake'
42
43
 
43
44
  # Master Rote version. Manage this from the Rake release support.
44
- ROTEVERSION = '0.2.2'
45
+ ROTEVERSION = '0.2.4'
45
46
 
46
47
  #####
47
- ## *Rote* is a Rake (http://rake.rubyforge.org) based build tool for page-based
48
- ## static websites that enables layout, textile formatting, and ERB to be used
49
- ## to automatically generate your site, and can handle uploading the site
50
- ## to your (host's) server.
48
+ ## *Rote* is a Rake (http://rake.rubyforge.org) based build tool for static
49
+ ## page-based documentation, websites, and general textual templates.
50
+ ## It enables embedded Ruby code, layout, and optionally plain-text formatting
51
+ ## (HTML-only at present) to be used to automatically generate output in any
52
+ ## (textual) format from a directory tree containing template files.
51
53
  ##
52
- ## Rote was created for my personal site, but is general enough to be applied
53
- ## to many different types of website, including basic blog-plus sites,
54
- ## slower-moving news and information sites, and software documentation.
54
+ ## Rote was created for my personal website, but has become a fairly flexible
55
+ ## tool, general enough to be applied to many different types of templating.
56
+ ## Rote can handle your software documentation, blog-plus sites,
57
+ ## and even (slower-moving) news and information sites.
55
58
  ##
56
- ## See +README+ for general usage information. +Rote::DocTask+ documents the
57
- ## Rake task integration, while +Rote::Page+ has information useful to template
59
+ ## Rote can be used from the command-line, or in your own +Rakefile+. It
60
+ ## supports both manual and automatic rendering of modified resources, and
61
+ ## can be configured to monitor your source tree for changes.
62
+ ##
63
+ ## See +README+ for general usage information. Rote::DocTask documents the
64
+ ## Rake task integration, while Rote::Page has information useful to template
58
65
  ## writers.
59
66
  ##
60
- ## Rote is (c)2005 Ross Bamford. See +LICENSE+ for details.
67
+ ## Rote is (c)2005 Ross Bamford (and contributors). See +LICENSE+ for details.
61
68
  module Rote
62
69
 
63
70
  # this space intentionally left blank
data/lib/rote/app.rb CHANGED
@@ -1,3 +1,8 @@
1
+ # Rote application class
2
+ # (c)2005 Ross Bamford (and contributors)
3
+ #
4
+ # See 'rote.rb' or LICENSE for licence information.
5
+ # $Id: app.rb,v 1.4 2005/12/05 14:44:32 roscopeco Exp $
1
6
  require 'getoptlong'
2
7
 
3
8
  module Rote
@@ -30,7 +35,7 @@ module Rote
30
35
  raise "Missing builtin.rf (expected at '#{@rakefile}')!" unless File.exists?(@rakefile)
31
36
 
32
37
  @rakeopts = ENV['RAKE_OPTS'] || ''
33
- @rake = ENV['RAKE_CMD'] || 'rake'
38
+ @rake = ENV['RAKE_CMD'] || (PLATFORM =~ /mswin/ ? 'rake.bat' : 'rake')
34
39
 
35
40
  process_args
36
41
 
@@ -98,11 +103,14 @@ Recognised options are:
98
103
  --help -h Synonym for --usage
99
104
  --version -V Display Rote's version and quit
100
105
 
101
- The 'rote' command is implemented as a wrapper around Rake, and
102
- requires the 'rake' command be in your path. You can circumvent this
103
- by setting the RAKE_CMD environment variable appropriately.
104
- Additional options can be passed to Rake via the RAKE_OPTS variable.
105
-
106
+ In addition to the standard doc_XXX tasks and those provided by any
107
+ local configuration, the following 'special' tasks are recognised:
108
+
109
+ create <project> Create a blank project from the built-in template.
110
+
111
+ Note that these 'special' tasks are implemented as part of the command-
112
+ line wrapper for Rote, and will not be available from custom Rakefiles.
113
+
106
114
  In non-standard environments, it may be necessary to set the ROTE_LIB
107
115
  variable to point to the location of Rote's libraries.
108
116
 
data/lib/rote/builtin.rf CHANGED
@@ -1,35 +1,84 @@
1
+ # Built-in Rote rakefile
1
2
  #
2
- # Built-in Rakefile for Rote, (c)2005 Ross Bamford
3
-
3
+ # This is effectively a copy of the template rakefile,
4
+ # but with extra tasks for the command-line wrapper.
5
+ #
6
+ # (c)2005 Ross Bamford (and contributors)
7
+ #
8
+ begin
9
+ require 'rubygems'
10
+ rescue LoadError
11
+ nil # optional
12
+ end
4
13
  require 'rake'
5
14
  require 'rake/clean'
6
15
  require 'rote'
7
16
 
8
- # Create tasks to build the doc tree
9
- #
10
- # Creates the following tasks
17
+ # Create a set of tasks with the prefix 'doc' to build the
18
+ # documentation set. The directory layout is as for the
19
+ # command-line wrapper (but can be changed of course).
20
+ #
21
+ # This creates the following tasks:
11
22
  #
12
- # doc - Everything
13
- # doc-pages - Transform all modified pages
14
- # doc-res - Copy all resources
15
- # doc-clean - Remove generated documentation
16
- # html/[filename] - Transform single [filename] unconditionally
17
- # doc-monitor - Start monitor mode on doc source
23
+ # * doc - transform/copy all modified pages / resources
24
+ # * doc_pages - transform all modified pages
25
+ # * doc_res - copy all modified resources
26
+ # * doc_monitor - Start monitor mode, transform changed files automatically
18
27
  #
28
+ # * [html/**/*] - Transform single page / resource unconditionally
29
+ #
30
+ # * clobber_doc - Remove output (hooks into main 'clobber' task)
31
+ #
32
+ # In addition to these tasks, you may also wish to define a 'doc_refresh' task
33
+ # to be run whenever modified resources are processed in monitor mode.
19
34
  ws = Rote::DocTask.new(:doc) { |site|
20
35
  site.output_dir = 'html'
21
36
  site.layout_dir = 'doc/layouts'
22
-
37
+
23
38
  site.pages.dir = 'doc/pages'
24
39
  site.pages.include('**/*')
25
40
 
26
41
  site.res.dir = 'doc/res'
27
- site.res.include('**/*.png')
28
- site.res.include('**/*.gif')
29
- site.res.include('**/*.jpg')
30
- site.res.include('**/*.css')
42
+ site.res.include('**/*')
31
43
  }
32
44
 
33
45
  task :default => [:doc]
34
46
 
47
+ #################### CREATE NEW PROJECT FROM TEMPLATE ###############
48
+ #
49
+ # This works in a slightly odd way. The 'create' task simply sets up
50
+ # a rule that catches anything. This rule will then be triggered by
51
+ # the task that follows on the command-line, and taken as the
52
+ # target directory name.
53
+ #
54
+ # So instead of 'rote create NAME=foo' we have 'rote create foo'
55
+ #
56
+ # Note that this does preclude having other tasks on the same
57
+ # invocation (after the create at least) but does also allow
58
+ # multiple projects to be created at once.
59
+ #
60
+ # Also need a way to display error message if the rule isn't
61
+ # invoked at least once...
62
+ task :create do
63
+ rule '' do |t|
64
+ fail "'#{t.name}' already exists" if File.exists?(t.name)
65
+
66
+ src = 'rote/project'
67
+ src_dir = $:.detect { |it| File.exists?(File.join(it,src)) }
68
+ fail "Cannot locate project template" unless src_dir
69
+
70
+ # For now, just copy. Later, maybe we'll do some transformation on the
71
+ # sources as they're copied.
72
+ cp_r File.join(src_dir, src), t.name
73
+ end
74
+ end
75
+
76
+ # import user-level tasks
77
+ import "#{ENV['HOME']}/.rotetasks.rf" if File.exists?("#{ENV['HOME']}/.rotetasks.rf")
78
+ import 'local.rf' if File.exists?('local.rf')
79
+
80
+ # DEPRECATED - publish.rf will be unsupported. vv0.2.3 v-0.5 1
35
81
  import 'publish.rf' if File.exists?('publish.rf')
82
+
83
+
84
+
data/lib/rote/page.rb CHANGED
@@ -1,3 +1,8 @@
1
+ # Rote page class
2
+ # (c)2005 Ross Bamford (and contributors)
3
+ #
4
+ # See 'rote.rb' or LICENSE for licence information.
5
+ # $Id: page.rb,v 1.9 2005/12/05 14:44:32 roscopeco Exp $
1
6
  require 'erb'
2
7
  require 'rdoc/markup/simple_markup'
3
8
  require 'rdoc/markup/simple_markup/to_html'
@@ -12,9 +17,9 @@ end
12
17
  module Rote
13
18
 
14
19
  #####
15
- ## A +Page+ object represents an individual page, taking input from a
16
- ## template and (optionally) some ruby code, and producing rendered
17
- ## ('merged') output as a +String+.
20
+ ## A +Page+ object represents an individual template source file, taking
21
+ ## input from that file and (optionally) some ruby code, and producing
22
+ ## rendered (or 'merged') output as a +String+.
18
23
  ## When a page is created, ruby source will be found alongside the
19
24
  ## file, with same basename and an '.rb' extension. If found it will
20
25
  ## run through +instance_eval+. That source can call methods
@@ -0,0 +1,49 @@
1
+ This is the auto-generated Rote documentation source.
2
+
3
+ To render it using Rote's command-line wrapper (ignoring the included
4
+ Rakefile), type:
5
+
6
+ rote doc
7
+
8
+ from the top-level directory (this one).
9
+
10
+ To render using the included Rakefile (the result is the same in either
11
+ case) type instead:
12
+
13
+ rake doc
14
+
15
+ If you prefer, you can omit the 'doc' task, since it is configured
16
+ as the default.
17
+
18
+ In either case, you should see some output as the pages are rendered
19
+ and resources copied, and get output in a (created) 'html' directory.
20
+ Once you have rendered the site, running the command again will appear
21
+ to do nothing, because only changed resources are re-rendered. To
22
+ start over:
23
+
24
+ (rote|rake) clobber
25
+
26
+ Alternatively, modify the page or resource files, and rerun the first
27
+ command to transform only the modified resource.
28
+
29
+ WHAT NEXT?
30
+
31
+ + See what else you can do by typing:
32
+
33
+ (rote|rake) --tasks
34
+
35
+ rote --usage ( with the command-line wrapper )
36
+
37
+ + Modify the included page template and layout to suit your needs.
38
+
39
+ + Edit the included Rakefile to add or change tasks, or delete it
40
+ if you're sticking with the command-line wrapper.
41
+
42
+ + Add more pages and layouts.
43
+
44
+ + Start Rote in monitor mode, and have your changes rendered as
45
+ you work:
46
+
47
+ (rote|rake) monitor
48
+
49
+
@@ -0,0 +1,51 @@
1
+ # Standard Rakefile for custom Rote build
2
+ #
3
+ # Generated from:
4
+ # $Id: Rakefile,v 1.1 2005/12/05 14:43:22 roscopeco Exp $
5
+ #
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ nil # optional
10
+ end
11
+ require 'rake'
12
+ require 'rake/clean'
13
+ require 'rote'
14
+
15
+ # Create a set of tasks with the prefix 'doc' to build the
16
+ # documentation set. The directory layout is as for the
17
+ # command-line wrapper (but can be changed of course).
18
+ #
19
+ # This creates the following tasks:
20
+ #
21
+ # * doc - transform/copy all modified pages / resources
22
+ # * doc_pages - transform all modified pages
23
+ # * doc_res - copy all modified resources
24
+ # * doc_monitor - Start monitor mode, transform changed files automatically
25
+ #
26
+ # * [html/**/*] - Transform single page / resource unconditionally
27
+ #
28
+ # * clobber_doc - Remove output (hooks into main 'clobber' task)
29
+ #
30
+ # In addition to these tasks, you may also wish to define a 'doc_refresh' task
31
+ # to be run whenever modified resources are processed in monitor mode.
32
+ ws = Rote::DocTask.new(:doc) { |site|
33
+ site.output_dir = 'html'
34
+ site.layout_dir = 'doc/layouts'
35
+
36
+ site.pages.dir = 'doc/pages'
37
+ site.pages.include('**/*')
38
+
39
+ site.res.dir = 'doc/res'
40
+ site.res.include('**/*')
41
+ }
42
+
43
+ task :default => [:doc]
44
+
45
+ # import user-level tasks
46
+ import "#{ENV['HOME']}/.rotetasks.rf" if File.exists?("#{ENV['HOME']}/.rotetasks.rf")
47
+ import 'local.rf' if File.exists?('local.rf')
48
+
49
+ # TODO Define your custom tasks here
50
+
51
+
@@ -0,0 +1,38 @@
1
+ <%
2
+ # This is the 'normal' layout. It can be selected with:
3
+ #
4
+ # layout 'normal'
5
+ #
6
+ # in page code. If the page itself doesn't have an '.html'
7
+ # extension, you will need to use:
8
+ #
9
+ # layout 'normal.html'
10
+ #
11
+ # instead.
12
+ #
13
+ # Here we just add basic HTML wrap-up, use the custom var
14
+ # (@page_title) to get the title, and insert content where
15
+ # we want it with @content_for_layout.
16
+ %>
17
+ <html>
18
+ <head>
19
+ <%# Use our custom vars for the title %>
20
+ <title><%= @page_title + ' - ' + @site_title %></title>
21
+ </head>
22
+
23
+ <body>
24
+ <h1><%= @page_title %></h1>
25
+
26
+ <%# Insert page content #%>
27
+ <%= @content_for_layout %>
28
+
29
+ <p align='center'><hr width='80%'></p>
30
+ <p align='right'>
31
+ <span style='font-size: 8pt; color: #7c7c90'>Generated with</span><br/>
32
+
33
+ <%# use the link_rel helper to make absolute links relative to current page #%>
34
+ <a href='http://rote.rubyforge.org/' target='_blank'><img src='<%= link_rel '/images/rote-tiny.png' %>' alt='Rote'/></a>
35
+ </p>
36
+ </body>
37
+ </html>
38
+
@@ -0,0 +1,7 @@
1
+ # Shared code for all pages in 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
+ @site_title = "My site"
@@ -0,0 +1,12 @@
1
+ This is a *sample* page.
2
+
3
+ <%# insert an image with relative path, using Textile !img! markup #%>
4
+ It has a very small image:
5
+ !<%= link_rel '/images/rote-tiny.png' %>!
6
+
7
+ (Which is the same as the one at the bottom)
8
+
9
+ * You should
10
+ * Replace this
11
+ * With your doc.
12
+
@@ -0,0 +1,13 @@
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
+ # This page uses Textile
6
+ format_opts << :textile
7
+
8
+ # Apply the 'normal' layout
9
+ layout 'normal'
10
+
11
+ # Set a custom var for use in our layout
12
+ @page_title = 'A sample page'
13
+
@@ -1,3 +1,8 @@
1
+ # Rake tasklib for Rote
2
+ # (c)2005 Ross Bamford (and contributors)
3
+ #
4
+ # See 'rote.rb' or LICENSE for licence information.
5
+ # $Id: rotetasks.rb,v 1.8 2005/12/05 14:44:32 roscopeco Exp $
1
6
  require 'rake'
2
7
  require 'rake/tasklib'
3
8
 
@@ -57,8 +62,10 @@ module Rote
57
62
  ## name you supply. The tasks defined are:
58
63
  ##
59
64
  ## #{name} - Transform all documentation, copy resources.
60
- ## #{name}-pages - Transform all pages
61
- ## #{name}-res - Copy resources
65
+ ## #{name}_pages - Transform all pages
66
+ ## #{name}_res - Copy resources
67
+ ## #{name}_monitor - Start watching for changes
68
+ ## #clobber_{name} - Remove output
62
69
  ##
63
70
  class DocTask < Rake::TaskLib
64
71
  # Default exclusion patterns for the page sources. These are
@@ -94,8 +101,8 @@ module Rote
94
101
  alias :show_file_tasks? :show_file_tasks
95
102
  alias :show_file_tasks= :show_file_tasks=
96
103
 
97
- # *Deprecated* alias for +show_file_tasks+. It will be removed.
98
- alias :show_page_tasks? :show_file_tasks # vv0.3.0 v-0.5
104
+ # *Deprecated* alias for +show_file_tasks+. vv0.2.2 v-0.5
105
+ alias :show_page_tasks? :show_file_tasks
99
106
  alias :show_page_tasks= :show_file_tasks=
100
107
 
101
108
  # The approximate number of seconds between update checks when running
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rote
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.2
7
- date: 2005-12-03 00:00:00 +00:00
6
+ version: 0.2.4
7
+ date: 2005-12-05 00:00:00 +00:00
8
8
  summary: Adds template-based doc support to Rake.
9
9
  require_paths:
10
10
  - lib
@@ -39,7 +39,19 @@ files:
39
39
  - lib/rote/rotetasks.rb
40
40
  - lib/rote/page.rb
41
41
  - lib/rote/app.rb
42
+ - lib/rote/project/doc/pages/COMMON.rb
43
+ - lib/rote/project/doc/pages/index.rb
42
44
  - lib/rote/builtin.rf
45
+ - lib/rote/project/Rakefile
46
+ - lib/rote/project/doc
47
+ - lib/rote/project/README
48
+ - lib/rote/project/doc/res
49
+ - lib/rote/project/doc/pages
50
+ - lib/rote/project/doc/layouts
51
+ - lib/rote/project/doc/res/images
52
+ - lib/rote/project/doc/res/images/rote-tiny.png
53
+ - lib/rote/project/doc/pages/index.html
54
+ - lib/rote/project/doc/layouts/normal.html
43
55
  - test/test_page.rb
44
56
  - test/pages
45
57
  - test/layouts