rote 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c)2005 Ross Bamford (and contributors). All rights reserved.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/README ADDED
@@ -0,0 +1,293 @@
1
+ = ROTE - A static website build tool for Ruby
2
+
3
+ == What is this?
4
+
5
+ Rote is a simple page-based template system for your static website that was
6
+ written to make it easier to author and maintain non-dynamic websites and
7
+ offline documentation. Rote provides a simple commandline or
8
+ Rake [http://rake.rubyforge.org] based build for your pages, with page
9
+ rendering (optionally supporting Textile and Markdown with
10
+ RedCloth [http://redcloth.rubyforge.org/] and ruby code with
11
+ ERB [http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html]), layout,
12
+ and general documentation / website build tasks.
13
+
14
+ == Should I download it?
15
+
16
+ I don't know. Rote offers the following major features:
17
+
18
+ * Simple set-up based on page templates and sections.
19
+ * ERB, Textile, and Markdown supported out of the box.
20
+ * Multiple configurable layouts apply boilerplate to your pages.
21
+ * 'Scoped' Ruby code support allows fine-grained control of data available across
22
+ all documentation, a subset, or individual pages.
23
+ * Can be used standalone (from the command-line) or from within Rake [http://rake.rubyforge.org]
24
+ as a custom task library.
25
+ * Supports any (text-based) format, while providing utilities and helpers for
26
+ common formats (HTML at present).
27
+
28
+ So, should you?
29
+
30
+ == Why 'Rote'
31
+
32
+ The name? I tried to come up with a combination of 'Ruby Site', but couldn't
33
+ get past 'Rite' (it's already taken ;)). So, I changed a letter. I'm short on
34
+ imagination you know. Oh, you mean why the system? Well, to make it easier
35
+ for me to manage roscopeco.co.uk now that I've dumped all the dynamic (JEE)
36
+ stuff and gone back to good old Apache sans CGI. I want something that lets
37
+ me do the disconnected page rendering and some of the 'dynamic' stuff,
38
+ without the dynamic stuff.
39
+
40
+ If you really need a better explanation for the name, I've come up with these
41
+ alternatives:
42
+
43
+ * Something about 'the docs I rote'
44
+ * 'Rake-Oriented Template Extensions'
45
+ * 'Rote Only Talks Erb'
46
+ * 'Really? Ordinary Template Enhancements?'
47
+
48
+ == What else do I need?
49
+
50
+ Rote uses the following (versions are as per my development environment,
51
+ you may find you can use older versions, you may not).
52
+
53
+ * Ruby 1.8.3 ('yum install ruby' on Fedora 4)
54
+ * RubyGems 0.8.11 (http://rubyforge.org/frs/?group_id=126)
55
+ * Rake 0.6.2 ('gem install rake')
56
+ * RedCloth 3.0.4 ('gem install RedCloth')
57
+
58
+ == How do I install it?
59
+
60
+ Set it up somewhere warm. At the moment, the standard install.rb is broken,
61
+ and so disabled - you will need to install Rote into it's own directory
62
+ (I know, I know). DONT modify your path - it's what symlinks are for.
63
+ If you use a symlink you'll probaby need to point ROTE_HOME to the install
64
+ directory as well. With that done, you should be able to run
65
+
66
+ rote --version
67
+
68
+ to verify that the command-line wrapper is working. If you wish to use the
69
+ tasks in your own Rakefiles, you will need to modify the library load path.
70
+ This can be done using the --libdir option to Rake, or alternatively by adding
71
+ something like the following _before_ the +require+ '+rote+' line:
72
+
73
+ $: << "#{ENV['ROTE_HOME']}/lib"
74
+
75
+ This line does of course place restrictions on the build environment, in that
76
+ Rote will have to be properly installed and configured with the ROTE_HOME
77
+ environment variable.
78
+
79
+ Obviously once we get into releases, Rote will of course be distributed via
80
+ RubyGems, allowing much of this to be transparent for the user if you have
81
+ Gems. Fixing the proper installation is a priority, and will come soon.
82
+
83
+ *Note*: Currently, the +rote+ script supports usage with custom Rakefiles as
84
+ well as the built-in command-line setup. If +rote+ is run from a directory
85
+ that contains an existing Rakefile, it will use that instead of the built-in
86
+ one. It will *not* search parent directories for a Rakefile.
87
+
88
+ This feature exists to support custom Rakefiles without libpath twiddling,
89
+ but should be considered a hack that will probably disappear from a (not
90
+ too distant) future version.
91
+
92
+ == How do I use it?
93
+
94
+ === From the command-line
95
+
96
+ If you are generating a standalone documentation set (i.e. not as part of
97
+ some wider build) then you don't need to worry about writing a +Rakefile+ -
98
+ you can use the built-in build via the +rote+ command. This works with
99
+ a standard directory layout, and wraps invocation of +rake+ to handle
100
+ setting up library dependencies and generation of appropriate tasks.
101
+
102
+ You'll need something like the following directory layout:
103
+
104
+ somesite ( <- root, this can be called whatever you like)
105
+ |--> [publish.rf]
106
+ |
107
+ |--> doc
108
+ | |--> [COMMON.rb]
109
+ | |
110
+ | |--> res
111
+ | | |--> (resources)
112
+ | |
113
+ | |--> layouts
114
+ | | |--> one.rhtml
115
+ | | |--> two.rhtml
116
+ | |
117
+ | |--> pages
118
+ | | |--> [COMMON.rb]
119
+ | | |--> apage.txt
120
+ | | |--> [apage.rb]
121
+ | | |--> adir
122
+ | | | |--> [COMMON.rb]
123
+ | | | |--> bpage.html
124
+ | | | |--> [bpage.rb]
125
+
126
+ Template sources under the 'pages' directory may have any extension (except
127
+ +rb+), and will be rendered to that same name under the output directory.
128
+ See the section on Layouts below for details on layout name resolution.
129
+ Set up a simple test site following the above layout, and then run:
130
+
131
+ rote
132
+
133
+ from the top-level directory (+somesite+), you should get a 'target' directory
134
+ created with the (transformed) templates.
135
+
136
+ Now try:
137
+
138
+ rote --tasks
139
+
140
+ to get a list of valid tasks, or
141
+
142
+ rote --usage
143
+
144
+ for further option information.
145
+
146
+ === From your +Rakefile+
147
+
148
+ If you are wanting to build documentation as part of a larger build process, or
149
+ commandline setup, then you'll want to get started on integrating Rote with
150
+ your own (existing) +Rakefile+. Fortunately, this is very easy to do. Try
151
+ something like:
152
+
153
+ # Rakefile
154
+ include 'rote'
155
+
156
+ ws = Rote::DocTask.new(:doc) { |site|
157
+ site.site_dir = 'html'
158
+ site.layout_dir = 'doc/layouts'
159
+
160
+ site.pages.dir = 'doc/pages'
161
+ site.pages.include('**/*')
162
+
163
+ site.res.dir = 'doc/res/'
164
+ site.res.include('**/*.png')
165
+ site.res.include('**/*.gif')
166
+ site.res.include('**/*.jpg')
167
+ site.res.include('**/*.css')
168
+ }
169
+
170
+ Save this as +Rakefile+, and fire up:
171
+
172
+ rake --libdir=$ROTE_HOME/lib doc
173
+
174
+ If all goes well, you should see each command and transformation output to your
175
+ console as Rote runs.
176
+
177
+ *Note* that it's safe to include '**/*' in the +pages+ list, since +rb+
178
+ files are implicitly excluded.
179
+
180
+ == Creating templates
181
+
182
+ As mentioned, templates are simply text files in the doc/pages directory. The
183
+ layout below that directory is retained when transforming pages, and is
184
+ also used to provide simple hierarchical structure to the common page code.
185
+ By default, any file with an extension other than +rb+ will be processed
186
+ as a page template (with it's associated ruby source). The output will have
187
+ the same filename and path, relative to the output directory.
188
+
189
+ === Template code and ERB
190
+
191
+ All templates may contain embedded Ruby code (ERB), delimited by the standard
192
+ <% ... %> (for executed code) and <%= ... %> (for output) tags. Any (valid)
193
+ Ruby code may be placed in the templates, and variables may be defined to
194
+ allow information to be passed into templates. There are four places where
195
+ you might define such variables. The following is in order of evaluation:
196
+
197
+ * This directory's COMMON.rb, or the parent directory's COMMON.rb if
198
+ +inherit_common+ is used.
199
+ * This page's ruby code, _basename_.rb
200
+ * In a block passed to Page.new
201
+ * In the template itself
202
+
203
+ When a Rote::Page instance is created, Rote looks for these, and
204
+ evaluates them, in order, in the same binding as the template is later rendered
205
+ in (i.e. the +Page+ instance binding). Therefore, you can define
206
+ instance variables to pass data around, or even helper methods if you wish.
207
+
208
+ === Text to HTML formatting
209
+
210
+ Rote uses RedCloth (http://redcloth.rubyforge.org) to provide text to HTML
211
+ formatting, supporting both Textile and Markdown. The formatting applied to a
212
+ given page is controlled by that page's +format_opts+ array. Both are disabled
213
+ by default - to enable formatting you must add something like the following
214
+ somewhere appropriate:
215
+
216
+ format_opts << :textile << :markdown
217
+
218
+ Although you can directly assign to +format_opts+, this isn't recommended since
219
+ Ruby often interprets it as a local variable set rather than method call,
220
+ resulting in much head scratching as to why your options are being ignored.
221
+
222
+ Formatting is applied _after_ any ERB has been evaluated.
223
+
224
+ *Note* that the options you supply are passed directly to RedCloth, so you can
225
+ exercise much more control over the formatting by using the feature-specific
226
+ symbols defined by RedCloth, rather than the blanket :textile and :markdown
227
+ symbols.
228
+
229
+ === Layout
230
+
231
+ Layouts are stored under the doc/layouts directory (by default). They may
232
+ be organised into subdirectories, but this hierarchy is not connected to
233
+ the hierarchy in +pages+. To apply a layout to a page, simply call the
234
+ Rote::Page.layout method from code applied to that page, passing the
235
+ base-name (and path, relative to +layouts+, if used). If no extension is
236
+ specified, then the same extension as the page itself is assumed. Examples:
237
+
238
+ layout 'one'
239
+ layout 'main/wide'
240
+ layout 'dark.txt'
241
+ <% layout 'my' %>
242
+
243
+ With that done, Rote would first render the template text (including textile)
244
+ and set the Page instance variable @content_for_layout before rendering
245
+ the layout (in which textile is currently not supported). The layout is
246
+ responsible for inserting the rendered template where appropriate, with
247
+ e.g.:
248
+
249
+ <%= @content_for_layout %>
250
+
251
+ This pattern shouldn't be unfamiliar. Again, note that Rote doesn't mandate
252
+ HTML, despite the appearance from the ERB tags - any (textual) format can
253
+ be templated and laid out.
254
+
255
+ == Resources
256
+
257
+ Of course, you're likely to have resources for your site (images, sounds, etc)
258
+ and you'll need to copy them over to the target too. Such resources should be
259
+ placed under 'res' (with the commandline setup) or in your specified +res+
260
+ directory, and will be copied directly to the output directory after page
261
+ rendering.
262
+
263
+ Of course, the directory layout beneath +res+ should mirror that of the
264
+ output, and will be preserved during the copy.
265
+
266
+ == Publishing
267
+
268
+ Rote does not provide any direct support for publishing your site at present,
269
+ relying on you to configure an appropriate publish task if required, using
270
+ the publishers supplied with Rake (in rake/contrib). This allows maximum
271
+ flexibility, and allows Rote to concentrate on creating your documents.
272
+
273
+ The command-line build will automatically look for a file in the top-level
274
+ directory (above +doc+) named publish.rf. If found, this file will be
275
+ evaluated by Rake, making any tasks defined within it available to your
276
+ build. The most likely use case is to define task that uses an SSH directory
277
+ publisher to publish via SCP.
278
+
279
+ == A final note about command-line mode
280
+
281
+ Currently, there isn't enough checking involved on source resources when
282
+ building pages from the command-line wrapper - Basically, only templates are
283
+ considered when Rake decides what to update. If you change layouts, code or
284
+ resources you'll need to run:
285
+
286
+ rote clean
287
+
288
+ to make sure everything gets updated. It's recommended to always run upload
289
+ as:
290
+
291
+ rote clean upload
292
+
293
+ Please note that this isn't Rake's limitation - it's mine.
data/Rakefile ADDED
@@ -0,0 +1,369 @@
1
+ # Rote Rakefile (run with 'rake' command)
2
+ #
3
+ # Copyright 2005 Ross Bamford (and contributors). All rights reserved.
4
+ # Rote is distributed under an MIT style license. See LICENSE for details.
5
+ #
6
+ # This Rakefile is heavily based on Rake's own Rakefile.
7
+ # Portions copyright (c)2003, 2004 Jim Weirich (jim <AT> weirichhouse.org)
8
+ #
9
+ # $Id: Rakefile,v 1.3 2005/11/25 01:24:39 roscopeco Exp $
10
+ #
11
+
12
+ begin
13
+ require 'rubygems'
14
+ require 'rake/gempackagetask'
15
+ rescue Exception
16
+ nil
17
+ end
18
+
19
+ require 'rake/clean'
20
+ require 'rake/testtask'
21
+ require 'rake/rdoctask'
22
+
23
+ $: << 'lib'
24
+ require 'rote'
25
+
26
+ CLEAN.include('testdata')
27
+ CLOBBER.include('TAGS')
28
+
29
+ def announce(msg='')
30
+ STDERR.puts msg
31
+ end
32
+
33
+ # Determine the current version of the software
34
+
35
+ if `ruby -Ilib ./bin/rote --version` =~ /\S+$/
36
+ CURRENT_VERSION = $&
37
+ else
38
+ CURRENT_VERSION = "0.0.0"
39
+ end
40
+
41
+ if ENV['REL']
42
+ PKG_VERSION = ENV['REL']
43
+ else
44
+ PKG_VERSION = CURRENT_VERSION
45
+ end
46
+
47
+
48
+ SRC_RB = FileList['lib/**/*.rb']
49
+
50
+ # The default task is run if rake is given no explicit arguments.
51
+
52
+ desc "Default Task (All tests)"
53
+ task :default => :alltests
54
+
55
+ # Test Tasks ---------------------------------------------------------
56
+
57
+ task :ta => :alltests
58
+ #task :tf => :funtests
59
+ task :tu => :unittests
60
+ task :test => :unittests
61
+
62
+ Rake::TestTask.new(:alltests) do |t|
63
+ t.test_files = FileList[
64
+ 'test/test*.rb',
65
+ 'test/contrib/test*.rb',
66
+ 'test/fun*.rb'
67
+ ]
68
+ t.warning = true
69
+ t.verbose = true
70
+ end
71
+
72
+ Rake::TestTask.new(:unittests) do |t|
73
+ t.test_files = FileList['test/test*.rb']
74
+ t.warning = true
75
+ t.verbose = false
76
+ end
77
+
78
+ # Rake::TestTask.new(:funtests) do |t|
79
+ # t.test_files = FileList['test/fun*.rb']
80
+ # t.warning = true
81
+ # t.warning = true
82
+ # end
83
+
84
+ directory 'testdata'
85
+ [:alltests, :unittests].each do |t|
86
+ task t => ['testdata']
87
+ end
88
+
89
+ # CVS Tasks ----------------------------------------------------------
90
+
91
+ # Install rote using the standard install.rb script.
92
+ desc "Install the application"
93
+ task :install do
94
+ ruby "install.rb"
95
+ end
96
+
97
+ # Website / Doc tasks ------------------------------------------------
98
+
99
+ # Create a task to build the RDOC documentation tree.
100
+ rd = Rake::RDocTask.new("rdoc") { |rdoc|
101
+ rdoc.rdoc_dir = 'html/rdoc'
102
+ # rdoc.template = 'kilmer'
103
+ # rdoc.template = 'css2'
104
+ rdoc.template = 'doc/jamis.rb'
105
+ rdoc.title = "Rote"
106
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
107
+ rdoc.rdoc_files.include('README', 'LICENSE', 'TODO')
108
+ rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
109
+ rdoc.rdoc_files.exclude(/\bcontrib\b/)
110
+ }
111
+
112
+ # Create a task build the website / docs
113
+ CLOBBER.include('html')
114
+
115
+ ws = Rote::DocTask.new("doc") { |site|
116
+ site.output_dir = 'html'
117
+ site.layout_dir = 'doc/layouts'
118
+
119
+ site.pages.dir = 'doc/pages'
120
+ site.pages.include('**/*')
121
+
122
+ site.res.dir = 'doc/res/'
123
+ site.res.include('**/*.png')
124
+ site.res.include('**/*.gif')
125
+ site.res.include('**/*.jpg')
126
+ site.res.include('**/*.css')
127
+ }
128
+
129
+ # add rdoc dep to doc task
130
+ task :doc => [:rdoc]
131
+
132
+ # ====================================================================
133
+ # Create a task that will package the Rote software into distributable
134
+ # tar, zip and gem files.
135
+
136
+ PKG_FILES = FileList[
137
+ 'install.rb',
138
+ '[A-Z]*',
139
+ 'bin/**/*',
140
+ 'lib/**/*.rb',
141
+ 'test/**/*.rb',
142
+ 'test/**/*.rf',
143
+ 'test/**/*.mf',
144
+ 'test/**/Rakefile',
145
+ 'doc/**/*'
146
+ ]
147
+
148
+ if ! defined?(Gem)
149
+ puts "Package Target requires RubyGEMs"
150
+ else
151
+ spec = Gem::Specification.new do |s|
152
+
153
+ #### Basic information.
154
+
155
+ s.name = 'rote'
156
+ s.version = PKG_VERSION
157
+ s.summary = "Adds template-based doc support to Rake."
158
+ s.description = <<-EOF
159
+ Rote is a set of Rake task libraries and utilities that
160
+ enable easy rendering of textual documentation formats
161
+ (like HTML) for websites and offline documentation.
162
+ EOF
163
+
164
+ #### Dependencies and requirements.
165
+
166
+ #s.add_dependency('log4r', '> 1.0.4')
167
+ #s.requirements << ""
168
+
169
+ #### Which files are to be included in this gem? Everything! (Except CVS directories.)
170
+
171
+ s.files = PKG_FILES.to_a
172
+
173
+ #### C code extensions.
174
+
175
+ #s.extensions << "ext/rmagic/extconf.rb"
176
+
177
+ #### Load-time details: library and application (you will need one or both).
178
+
179
+ s.require_path = 'lib' # Use these for libraries.
180
+
181
+ s.bindir = "bin" # Use these for applications.
182
+ s.executables = ["rote"]
183
+ s.default_executable = "rote"
184
+
185
+ #### Documentation and testing.
186
+
187
+ s.has_rdoc = true
188
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
189
+ s.rdoc_options <<
190
+ '--title' << 'Rote -- Template-based doc support for Rake' <<
191
+ '--main' << 'README' <<
192
+ '--line-numbers' <<
193
+ '-o' << 'html/rdoc'
194
+
195
+ #### Author and project details.
196
+
197
+ s.author = "Ross Bamford"
198
+ s.email = "ross@roscopeco.co.uk"
199
+ s.homepage = "http://rote.rubyforge.org"
200
+ s.rubyforge_project = "rote"
201
+ # if ENV['CERT_DIR']
202
+ # s.signing_key = File.join(ENV['CERT_DIR'], 'gem-private_key.pem')
203
+ # s.cert_chain = [File.join(ENV['CERT_DIR'], 'gem-public_cert.pem')]
204
+ # end
205
+ end
206
+
207
+ package_task = Rake::GemPackageTask.new(spec) do |pkg|
208
+ pkg.need_zip = true
209
+ pkg.need_tar_gz = true
210
+ pkg.package_dir = 'pkg'
211
+ end
212
+ end
213
+
214
+ # Misc tasks =========================================================
215
+
216
+ def count_lines(filename)
217
+ lines = 0
218
+ codelines = 0
219
+ open(filename) { |f|
220
+ f.each do |line|
221
+ lines += 1
222
+ next if line =~ /^\s*$/
223
+ next if line =~ /^\s*#/
224
+ codelines += 1
225
+ end
226
+ }
227
+ [lines, codelines]
228
+ end
229
+
230
+ def show_line(msg, lines, loc)
231
+ printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
232
+ end
233
+
234
+ desc "Count total lines in source"
235
+ task :lines do
236
+ total_lines = 0
237
+ total_code = 0
238
+ show_line("File Name", "LINES", "LOC")
239
+ SRC_RB.each do |fn|
240
+ lines, codelines = count_lines(fn)
241
+ show_line(fn, lines, codelines)
242
+ total_lines += lines
243
+ total_code += codelines
244
+ end
245
+ show_line("TOTAL", total_lines, total_code)
246
+ end
247
+
248
+ ARCHIVEDIR = '/mnt/usb'
249
+
250
+ task :archive => [:package] do
251
+ cp FileList["pkg/*.tar.gz", "pkg/*.zip", "pkg/*.gem"], ARCHIVEDIR
252
+ end
253
+
254
+ # Define an optional publish target in an external file. If the
255
+ # publish.rf file is not found, the publish targets won't be defined.
256
+
257
+ load "publish.rf" if File.exist? "publish.rf"
258
+
259
+ # Support Tasks ------------------------------------------------------
260
+
261
+ desc "Look for TODO and FIXME tags in the code"
262
+ task :todo do
263
+ FileList['**/*.rb'].egrep /#.*(FIXME|TODO|TBD)/
264
+ end
265
+
266
+ desc "Look for Debugging print lines"
267
+ task :dbg do
268
+ FileList['**/*.rb'].egrep /\bDBG|\bbreakpoint\b/
269
+ end
270
+
271
+ desc "List all ruby files"
272
+ task :rubyfiles do
273
+ puts Dir['**/*.rb'].reject { |fn| fn =~ /^pkg/ }
274
+ puts Dir['bin/*'].reject { |fn| fn =~ /CVS|(~$)|(\.rb$)/ }
275
+ end
276
+
277
+ # --------------------------------------------------------------------
278
+ # Creating a release
279
+
280
+ desc "Make a new release"
281
+ task :release => [
282
+ :prerelease,
283
+ :clobber,
284
+ :alltests,
285
+ :update_version,
286
+ :package,
287
+ :tag] do
288
+
289
+ announce
290
+ announce "**************************************************************"
291
+ announce "* Release #{PKG_VERSION} Complete."
292
+ announce "* Packages ready to upload."
293
+ announce "**************************************************************"
294
+ announce
295
+ end
296
+
297
+ # Validate that everything is ready to go for a release.
298
+ task :prerelease do
299
+ announce
300
+ announce "**************************************************************"
301
+ announce "* Making RubyGem Release #{PKG_VERSION}"
302
+ announce "* (current version #{CURRENT_VERSION})"
303
+ announce "**************************************************************"
304
+ announce
305
+
306
+ # Is a release number supplied?
307
+ unless ENV['REL']
308
+ fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
309
+ end
310
+
311
+ # Is the release different than the current release.
312
+ # (or is REUSE set?)
313
+ if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
314
+ fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
315
+ end
316
+
317
+ # Are all source files checked in?
318
+ if ENV['RELTEST']
319
+ announce "Release Task Testing, skipping checked-in file test"
320
+ else
321
+ announce "Checking for unchecked-in files..."
322
+ data = `cvs -q update`
323
+ unless data =~ /^$/
324
+ fail "CVS update is not clean ... do you have unchecked-in files?"
325
+ end
326
+ announce "No outstanding checkins found ... OK"
327
+ end
328
+ end
329
+
330
+ task :update_version => [:prerelease] do
331
+ if PKG_VERSION == CURRENT_VERSION
332
+ announce "No version change ... skipping version update"
333
+ else
334
+ announce "Updating Rote version to #{PKG_VERSION}"
335
+ open("lib/rote.rb") do |rakein|
336
+ open("lib/rote.rb.new", "w") do |rakeout|
337
+ rakein.each do |line|
338
+ if line =~ /^ROTEVERSION\s*=\s*/
339
+ rakeout.puts "ROTEVERSION = '#{PKG_VERSION}'"
340
+ else
341
+ rakeout.puts line
342
+ end
343
+ end
344
+ end
345
+ end
346
+ mv "lib/rote.rb.new", "lib/rote.rb"
347
+ if ENV['RELTEST']
348
+ announce "Release Task Testing, skipping commiting of new version"
349
+ else
350
+ sh %{cvs commit -m "Updated to version #{PKG_VERSION}" lib/rote.rb}
351
+ end
352
+ end
353
+ end
354
+
355
+ desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
356
+ task :tag => [:prerelease] do
357
+ reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
358
+ reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
359
+ announce "Tagging CVS with [#{reltag}]"
360
+ if ENV['RELTEST']
361
+ announce "Release Task Testing, skipping CVS tagging"
362
+ else
363
+ sh %{cvs tag #{reltag}}
364
+ end
365
+ end
366
+
367
+ # Require experimental XForge/Metaproject support.
368
+ # load 'xforge.rf' if File.exist?('xforge.rf')
369
+
data/TODO ADDED
@@ -0,0 +1,12 @@
1
+ = Rote project -- Todo list
2
+
3
+ Most of the following ideas will probably be implemented at some point.
4
+ Send any suggestions (or test-driven patches) to:
5
+
6
+ rosco <at> roscopeco <dot> co <dot> uk
7
+
8
+ * More flexible markup rendering
9
+ * Integration with test reports
10
+ * Automatic navigation / TOC
11
+ * Index and glossary support
12
+ * statistics