rote 0.3.2 → 0.3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -2
- data/Rakefile +35 -8
- data/doc/pages/guide/index.html +97 -30
- data/doc/pages/index.html +18 -14
- data/lib/rote.rb +2 -2
- data/lib/rote/app.rb +1 -1
- data/lib/rote/cache.rb +29 -16
- data/lib/rote/filters.rb +1 -1
- data/lib/rote/filters/base.rb +1 -1
- data/lib/rote/filters/rdoc.rb +1 -1
- data/lib/rote/filters/redcloth.rb +1 -1
- data/lib/rote/filters/syntax.rb +20 -6
- data/lib/rote/filters/tidy.rb +1 -1
- data/lib/rote/filters/toc.rb +3 -2
- data/lib/rote/format.rb +1 -1
- data/lib/rote/format/html.rb +1 -1
- data/lib/rote/page.rb +150 -44
- data/lib/rote/project/README +1 -1
- data/lib/rote/project/Rakefile +1 -1
- data/lib/rote/rotetasks.rb +16 -4
- data/test/layouts/nestme.txt +1 -1
- data/test/pages/nested/COMMON.rb +1 -0
- data/test/pages/nested/inner/COMMON.rb +11 -0
- data/test/pages/nested/inner/nested-override.txt +3 -0
- data/test/test_cache.rb +16 -7
- data/test/test_filters.rb +2 -2
- data/test/test_page.rb +65 -10
- metadata +7 -2
data/README
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Rote is a simple page-based template system that was written to make it
|
6
6
|
easier to author and maintain non-dynamic websites and offline documentation.
|
7
7
|
Rote provides a simple commandline or Rake [http://rake.rubyforge.org] based
|
8
|
-
build for your pages, with page rendering (optionally supporting Textile,
|
8
|
+
build for your pages, with page rendering (optionally supporting Textile, RDoc,
|
9
9
|
Markdown, and embedded Ruby code with RedCloth [http://redcloth.rubyforge.org/]
|
10
10
|
and ERB [http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html]),
|
11
11
|
layout, and general documentation / website build tasks.
|
@@ -120,7 +120,7 @@ though, so flame him if it breaks your day ;P
|
|
120
120
|
* Homepage - http://rote.rubyforge.org/
|
121
121
|
* Project - http://rubyforge.org/projects/rote
|
122
122
|
* Issues - http://rubyforge.org/tracker/?group_id=1120
|
123
|
-
*
|
123
|
+
* Lists - rote-users@rubyforge.org, rote-devel@rubyforge.org (http://rubyforge.org/mail/?group_id=1120)
|
124
124
|
|
125
125
|
As you may have guessed, Rote's hosting and development services are provided
|
126
126
|
by http://RubyForge.org .
|
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
|
9
|
+
# $Id: Rakefile 171 2006-01-12 00:16:17 +0000 (Thu, 12 Jan 2006) roscopeco $
|
10
10
|
#
|
11
11
|
|
12
12
|
begin
|
@@ -151,6 +151,20 @@ ws = Rote::DocTask.new(:doc) { |site|
|
|
151
151
|
# add rdoc dep to doc task
|
152
152
|
task :doc => [:rdoc]
|
153
153
|
|
154
|
+
desc "Publish the documentation and web site"
|
155
|
+
task :doc_upload => [ :doc ] do
|
156
|
+
if acct = ENV['RUBYFORGE_ACCT']
|
157
|
+
require 'rake/contrib/sshpublisher'
|
158
|
+
Rake::SshDirPublisher.new(
|
159
|
+
"#{acct}@rubyforge.org",
|
160
|
+
"/var/www/gforge-projects/rote",
|
161
|
+
"html"
|
162
|
+
).upload
|
163
|
+
else
|
164
|
+
raise "Skipping documentation upload - Need to set RUBYFORGE_ACCT to your rubyforge.org user name"
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
154
168
|
# ====================================================================
|
155
169
|
# Create a task that will package the Rote software into distributable
|
156
170
|
# tar, zip and gem files.
|
@@ -370,7 +384,8 @@ task :release => [
|
|
370
384
|
:alltests,
|
371
385
|
:update_version,
|
372
386
|
:package,
|
373
|
-
:tag
|
387
|
+
:tag,
|
388
|
+
:doc_upload] do
|
374
389
|
|
375
390
|
announce
|
376
391
|
announce "**************************************************************"
|
@@ -405,9 +420,9 @@ task :prerelease do
|
|
405
420
|
announce "Release Task Testing, skipping checked-in file test"
|
406
421
|
else
|
407
422
|
announce "Checking for unchecked-in files..."
|
408
|
-
data = `
|
423
|
+
data = `svn status`
|
409
424
|
unless data =~ /^$/
|
410
|
-
fail "
|
425
|
+
fail "SVN status is not clean ... do you have unchecked-in files?"
|
411
426
|
end
|
412
427
|
announce "No outstanding checkins found ... OK"
|
413
428
|
end
|
@@ -433,20 +448,32 @@ task :update_version => [:prerelease] do
|
|
433
448
|
if ENV['RELTEST']
|
434
449
|
announce "Release Task Testing, skipping commiting of new version"
|
435
450
|
else
|
436
|
-
sh %{
|
451
|
+
sh %{svn commit -m "Updated to version #{PKG_VERSION}" lib/rote.rb}
|
437
452
|
end
|
438
453
|
end
|
439
454
|
end
|
440
455
|
|
441
|
-
desc "
|
456
|
+
desc "Create a new SVN tag with the latest release number (REL=x.y.z)"
|
442
457
|
task :tag => [:prerelease] do
|
443
458
|
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
|
444
459
|
reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
|
445
460
|
announce "Tagging CVS with [#{reltag}]"
|
446
461
|
if ENV['RELTEST']
|
447
|
-
announce "Release Task Testing, skipping
|
462
|
+
announce "Release Task Testing, skipping SVN tagging"
|
448
463
|
else
|
449
|
-
|
464
|
+
# need to get current base URL
|
465
|
+
s = `svn info`
|
466
|
+
if s =~ /URL:\s*([^\n]*)\n/
|
467
|
+
svnroot = $1
|
468
|
+
if svnroot =~ /^(.*)\/trunk/
|
469
|
+
svnbase = $1
|
470
|
+
sh %{svn cp #{svnroot} #{svnbase}/tags/#{reltag} -m "Release #{PKG_VERSION}"}
|
471
|
+
else
|
472
|
+
fail "Please merge to trunk before making a release"
|
473
|
+
end
|
474
|
+
else
|
475
|
+
fail "Unable to determine repository URL from 'svn info' - is this a working copy?"
|
476
|
+
end
|
450
477
|
end
|
451
478
|
end
|
452
479
|
|
data/doc/pages/guide/index.html
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
p{color:red}. *The guide is still under construction*
|
4
4
|
|
5
|
-
p. It has not yet been fully updated to cover all new features in 0.3.x.
|
6
|
-
Although most features are mentioned, in some cases the documentation consists
|
7
|
-
soley of a link to the relevant "RDoc":<%= link_rel '/rdoc/index.html' %>
|
8
|
-
|
9
5
|
<a name='top'></a>
|
10
6
|
|
11
7
|
It is assumed that you have installed Rote already. If not, please
|
@@ -167,43 +163,91 @@ though ruby source is implicitly excluded). The directory layout beneath the
|
|
167
163
|
page root is retained when transforming pages, and is also used to provide
|
168
164
|
hierarchical structure to the common page code.
|
169
165
|
|
170
|
-
The default behaviour is to transform all matched
|
166
|
+
The default behaviour is to transform all matched
|
167
|
+
<%= section_link 'template code and erb', 'templates' %> pages with ERB, and
|
171
168
|
optionally apply a second render pass with a <%= section_link 'layout' %>,
|
172
169
|
before writing to the same base filename beneath the output directory.
|
173
170
|
You can customise this behaviour by specifying
|
174
171
|
<%= section_link 'extension mappings' %> for specific file extensions -
|
175
172
|
see the <%= section_link 'Rake task configuration' %> section for details.
|
176
173
|
|
174
|
+
Each page and layout template used by Rote may have associated with it an
|
175
|
+
optional Ruby source file, allowing variables to be defined for use in ERB
|
176
|
+
code, and supporting interaction with Rote via the methods of the
|
177
|
+
"@Rote::Page@":<%= link_rel '/rdoc/classes/Rote/Page.html' %> class. Page
|
178
|
+
and layout code is loaded from a @rb@ file alongside the template itself.
|
179
|
+
Code can also be applied across multiple pages based on filesystem hierarchy
|
180
|
+
by placing it in @COMMON.rb@ files in the *pages* tree. The order of evaluation
|
181
|
+
of these files travels down from the most remote COMMON.rb to the page code
|
182
|
+
itself, and this provides a simple yet fairly powerful way to apply various
|
183
|
+
configuration options, filtering, and user variables across your pages.
|
184
|
+
See <%= section_link 'template code and erb' %> for more information on the
|
185
|
+
search path and evaluation order for page code.
|
186
|
+
|
187
|
+
Rote additionally allows a variety of formatting and postprocessing options
|
188
|
+
thanks to it's support for <%= section_link 'filters' %> - little bits of Ruby
|
189
|
+
that perform some text transformation, macro expansion, or postprocessing
|
190
|
+
during page rendering. Rote provides standard filters to support Textile
|
191
|
+
and Markdown formatting, syntax highlighting, processing with HTMLTidy, and
|
192
|
+
more.
|
193
|
+
|
177
194
|
<%= section 4, 'Template code and ERB' %>
|
178
195
|
|
179
196
|
All templates may contain embedded Ruby code (ERB), delimited by the standard
|
180
197
|
<% ... %> (for executed code) and <%= ... %> (for
|
181
198
|
output) tags. Any (valid) Ruby code may be placed in the templates, and
|
182
199
|
variables may be defined to allow information to be passed into templates.
|
183
|
-
There are
|
200
|
+
There are four places where you might define such variables. The following
|
184
201
|
is in order of evaluation:
|
185
202
|
|
186
203
|
* A block supplied to the <%= section_link 'extension mappings', 'extension mapping' %>
|
187
204
|
that matched this page (if any).
|
188
205
|
* Any COMMON.rb files from the filesystem root down to this directory.
|
189
|
-
* This page's ruby code, _basename_.rb
|
190
|
-
* In the template itself
|
206
|
+
* This page's ruby code, _basename_.rb.
|
207
|
+
* In the template itself (via ERB).
|
191
208
|
|
192
209
|
When a @Page@ instance is created, Rote looks for these, and if found evaluates
|
193
210
|
them, in order, in the same binding as the template is later rendered in (i.e.
|
194
211
|
the @Page@ instance binding). Therefore, you can define instance variables to
|
195
212
|
pass data around, or even helper methods if you wish.
|
196
213
|
|
214
|
+
Additionally, when <%= section_link 'layout' %> is used the following evaluation
|
215
|
+
takes place *after rendering the template text* and can be used to make variables
|
216
|
+
available for the layout pass(es):
|
217
|
+
|
218
|
+
* This layout's ruby code, _layout_basename_.rb.
|
219
|
+
* In the layout itself (again, with ERB).
|
220
|
+
|
197
221
|
Template code is used to support a great deal of flexibility in Rote, from
|
198
222
|
selecting layouts to mixing in format helpers to controlling the filter chain.
|
199
223
|
You can find details of the methods available in the
|
200
224
|
"@Rote::Page@ RDoc":<%= link_rel '/rdoc/classes/Rote/Page.html' %>
|
201
225
|
|
202
|
-
<%= section 4, '
|
226
|
+
<%= section 4, 'Plaintext Formatting' %>
|
227
|
+
|
228
|
+
If you are using Rote to generate HTML, you'll probably want to utilise some
|
229
|
+
kind of _plain-text formatting_. Rote has out-of-the-box support for
|
230
|
+
Textile, Markdown, and RDoc formatting, which can be applied to any page using
|
231
|
+
standard <%= section_link 'filters' %>.
|
232
|
+
|
233
|
+
These filters can be applied to any page directly from page or common code,
|
234
|
+
and if you are using the built-in Rakefile (either using the @rote@ command to
|
235
|
+
build, or with a @rake@ build created with the @rote create@ command) then
|
236
|
+
the following extension mappings are defined by default, allowing the filters
|
237
|
+
to be applied without resorting to page code:
|
238
|
+
|
239
|
+
.mhtml or .markdown => Markdown formatting, .html output
|
240
|
+
.thtml or .textile => Textile formatting, .html output
|
241
|
+
.rdhtml or .rdoc => RDoc formatting, .html output
|
242
|
+
|
243
|
+
Each of these filters is covered (along with further usage instructions) in
|
244
|
+
the <%= section_link 'filters' %> section.
|
203
245
|
|
204
|
-
|
205
|
-
applied across several pages. This is handled via multiple render passes,
|
246
|
+
<%= section 4, 'Layout' %>
|
206
247
|
|
248
|
+
_Layouts_ allow common template to be applied across several pages.
|
249
|
+
This is handled via multiple render passes, with each layout responsible
|
250
|
+
for including the previously rendered content (via ERB).
|
207
251
|
|
208
252
|
Layouts are stored under the @doc/layouts@ directory (by default). They may
|
209
253
|
be organised into subdirectories, but this hierarchy is not connected to
|
@@ -217,7 +261,7 @@ specified, then the same extension as the page itself is assumed. Examples:
|
|
217
261
|
* layout 'dark.txt'
|
218
262
|
* <% layout 'my' %>
|
219
263
|
|
220
|
-
_*Note* the absence of the = sign
|
264
|
+
_*Note* the absence of the = sign in the ERB tag in the last example,_
|
221
265
|
_indicating that this is code to be executed rather than code that should_
|
222
266
|
_generate output._
|
223
267
|
|
@@ -250,6 +294,13 @@ in a further render pass. In all respects this is no different from the
|
|
250
294
|
initial layout pass - layout code is executed, and rendering performed.
|
251
295
|
Obviously, this may result in additional layouts being applied to the page.
|
252
296
|
|
297
|
+
<div class='note'>
|
298
|
+
Layouts can only be nested by calling @layout@ again from *layout code*
|
299
|
+
(or ERB in the layout template itself). Multiple calls to @layout@ from
|
300
|
+
@COMMON.rb@ or page code will result in consistent page code behaviour,
|
301
|
+
i.e. any previously-specified layout will be overriden.
|
302
|
+
</div>
|
303
|
+
|
253
304
|
There are no special requirements for layouts that are used in this way -
|
254
305
|
from the user point of view a layout simply needs to include the
|
255
306
|
<code>@content_for_layout</code> where appropriate.
|
@@ -265,9 +316,10 @@ Along with this ability, a number of filters are provided as standard:
|
|
265
316
|
For example If you're generating HTML, you'll probably want to use some plaintext
|
266
317
|
formatting, rather than writing HTML by hand. Rote directly supports this
|
267
318
|
(thanks to "RedCloth":http://whytheluckystiff.net/ruby/redcloth and
|
268
|
-
"BlueCloth":http://www.deveiate.org/projects/BlueCloth) via _filters_, with
|
269
|
-
Textile and Markdown support out of the box (assuming those libraries are
|
270
|
-
available on your machine).
|
319
|
+
"BlueCloth":http://www.deveiate.org/projects/BlueCloth) via _filters_, with
|
320
|
+
Textile, RDoc and Markdown support out of the box (assuming those libraries are
|
321
|
+
available on your machine). See the <%= section_link 'plaintext formatting' %>
|
322
|
+
for more details on this.
|
271
323
|
|
272
324
|
h5. Filter chaining
|
273
325
|
|
@@ -381,11 +433,11 @@ This is a macro filter, and should be applied in the _page filter chain_:
|
|
381
433
|
|
382
434
|
This filter uses the "Syntax":http://syntax.rubyforge.org/ library, passing the
|
383
435
|
macro argument as the language ('ruby', 'xml' and 'yaml' are supported out of the
|
384
|
-
box). The output is wrapped in
|
436
|
+
box). The output is wrapped in
|
437
|
+
<pre class='[language]'><code> ... </code></pre>
|
385
438
|
for output, with highlighting handled by <span> tags, allowing syntax colours and
|
386
439
|
styles to be applied via CSS. You can find a full list of the Ruby highlight classes
|
387
|
-
in the
|
388
|
-
"Syntax documentation":http://syntax.rubyforge.org/chapter-2.html
|
440
|
+
in the "Syntax documentation":http://syntax.rubyforge.org/chapter-2.html
|
389
441
|
but you will need to experiment with the highlighter to find the XML and YAML
|
390
442
|
classes.
|
391
443
|
|
@@ -396,13 +448,13 @@ Code to be highlighted is inserted into pages like so:
|
|
396
448
|
def amethod
|
397
449
|
"some code"
|
398
450
|
end
|
399
|
-
|
451
|
+
#:code
|
400
452
|
#:code#
|
401
453
|
|
402
454
|
<div class='note'>
|
403
|
-
|
404
|
-
a limitation of the Syntax
|
405
|
-
it's own end
|
455
|
+
Note that the closing tag in the above example is missing a closing '#' - this works
|
456
|
+
around a limitation of the current Syntax filter (and macro implementation in general),
|
457
|
+
which means that a macro cannot contain it's own end-tag.
|
406
458
|
</div>
|
407
459
|
|
408
460
|
Since macros are rendered separately from the page text, you don't have to worry much
|
@@ -778,12 +830,34 @@ from any Ruby code, by calling methods on the @Rake@ module.
|
|
778
830
|
*Note* that this extension is intended, and tested, for Rote - it is not designed
|
779
831
|
to be a general extension (though one could easily be extracted from it). In
|
780
832
|
particular it takes advantage of other extended functionality provided by Rote,
|
781
|
-
and takes no account, for example,
|
833
|
+
and takes no account, for example, of parallel task execution.
|
782
834
|
|
783
835
|
By default, the cache is maintained in the project root, in a directory named
|
784
836
|
@.rake_cache@. This is managed by Rote, so for the most part can be ignored,
|
785
837
|
though you can of course supply an alternate path if you wish (via @Rake.cache_dir=@).
|
786
838
|
|
839
|
+
h6. Caching and clean builds
|
840
|
+
|
841
|
+
When performing a clean build, the cache will also be removed (as part of the
|
842
|
+
@clobber@ task), and all dependencies will be re-evaluated and cached afresh.
|
843
|
+
Caching exists only to allow accurate dependency resolution during incremental
|
844
|
+
builds.
|
845
|
+
|
846
|
+
h6. Disabling the cache
|
847
|
+
|
848
|
+
There may be occasions when you want to disable use of the cache (for example when
|
849
|
+
diagnosing unexpected dependency chains). This can be accomplished by setting
|
850
|
+
an environment variable, NO_RAKE_CACHE prior to invoking Rote (or Rake). For a
|
851
|
+
single invocation, the easiest way to do this is from the command-line:
|
852
|
+
|
853
|
+
<pre><code>
|
854
|
+
rake clobber doc NO_RAKE_CACHE=true
|
855
|
+
</code></pre>
|
856
|
+
|
857
|
+
Specifying this option (or setting the variable) will completely disable use of
|
858
|
+
the cache, causing any existing cache to be ignored and all dependencies determined
|
859
|
+
during the run to be discarded.
|
860
|
+
|
787
861
|
h5. Dependency-based block memoize
|
788
862
|
|
789
863
|
Somewhat related to dependency caching, Rote also provides the ability to memoize
|
@@ -807,13 +881,6 @@ The following (OSX-specific) example illustrates usage of this feature:
|
|
807
881
|
end
|
808
882
|
#:code#
|
809
883
|
|
810
|
-
h6. Caching and clean builds
|
811
|
-
|
812
|
-
When performing a clean build, the cache will also be removed (as part of the
|
813
|
-
@clobber@ task), and all dependencies will be re-evaluated and cached afresh.
|
814
|
-
Caching exists only to allow accurate dependency resolution during incremental
|
815
|
-
builds.
|
816
|
-
|
817
884
|
<%= section 3, 'Final notes' %>
|
818
885
|
|
819
886
|
Rake is a *very* flexible tool, and supports a wide variety of configuration
|
data/doc/pages/index.html
CHANGED
@@ -14,18 +14,20 @@ Rote offers the following major features:
|
|
14
14
|
* Simple set-up based on page templates and sections.
|
15
15
|
* ERB, Textile, Markdown and RDoc supported out of the box.
|
16
16
|
* Multiple configurable layouts apply boilerplate to your pages.
|
17
|
-
*
|
18
|
-
all documentation, a subset, or individual pages.
|
17
|
+
* Apply arbitrary Ruby code across all documentation, a subset, or individual pages.
|
19
18
|
* Can be used standalone (from the command-line) or within "Rake":http://rake.rubyforge.org
|
20
19
|
as a custom task library.
|
21
20
|
* Supports any (text-based) format, while providing utilities and helpers for
|
22
|
-
common formats
|
21
|
+
common formats.
|
22
|
+
* Flexible filtering with several standard filters and the ability to
|
23
|
+
implement your own in a few lines of Ruby.
|
24
|
+
* Low-overhead monitoring functionality allows documentation to be automatically
|
25
|
+
re-rendered, and custom processing done, whenever the source changes.
|
23
26
|
|
24
|
-
Rote is somewhat similar to
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
documentation and general textual templating).
|
27
|
+
Rote is somewhat similar to "WebGen":http://webgen.rubyforge.org in intent, though the two
|
28
|
+
are quite different in implementation. WebGen provides a richer environment geared more
|
29
|
+
toward end-user websites and content publishing, whereas Rote's implementation as an
|
30
|
+
extension to Rake reflects a bias toward software documentation and general textual templating.
|
29
31
|
|
30
32
|
See the "User guide":<%= link_rel '/guide' %> and "RDoc":<%= link_rel '/rdoc' %> for usage information.
|
31
33
|
|
@@ -39,13 +41,15 @@ Alternatively, you can download tarball / zip packages if you don't:
|
|
39
41
|
|
40
42
|
* <strong>"http://rubyforge.org/frs/?group_id=1120":http://rubyforge.org/frs/?group_id=1120</strong>
|
41
43
|
|
42
|
-
You can also grab the latest code from "
|
44
|
+
You can also grab the latest code from "SVN":http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=rote
|
43
45
|
|
44
|
-
h4. From
|
46
|
+
h4. From Subversion
|
45
47
|
|
46
48
|
A link to the latest stable release can be found from the "project page":http://rubyforge.org/projects/rote .
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
You can also grab the latest code from Subversion . The trunk always has the most up to date development code
|
51
|
+
while the latest release, while can be found on the appropriate tag for that version. Although every effort
|
52
|
+
is made to ensure that this development code works, it cannot of course be guaranteed to be complete or bug
|
53
|
+
free. If that’s okay with you (maybe you’re pretty happy-go-lucky in general…) then see our
|
54
|
+
"SCM page":http://rubyforge.org/scm/?group_id=1120 at Rubyforge for everything you need to get going with
|
55
|
+
the SVN version.
|
data/lib/rote.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# rote.rb - main Rote module
|
2
2
|
# Copyright (c) 2005 Ross Bamford (and contributors)
|
3
|
-
# $Id: rote.rb
|
3
|
+
# $Id: rote.rb 172 2006-01-12 00:21:40 +0000 (Thu, 12 Jan 2006) roscopeco $
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -41,7 +41,7 @@ end
|
|
41
41
|
require 'rake'
|
42
42
|
|
43
43
|
# Master Rote version. Manage this from the Rake release support.
|
44
|
-
ROTEVERSION = '0.3.2'
|
44
|
+
ROTEVERSION = '0.3.2.2'
|
45
45
|
|
46
46
|
#####
|
47
47
|
## *Rote* is a Rake (http://rake.rubyforge.org) based build tool for static
|
data/lib/rote/app.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# (c)2005 Ross Bamford (and contributors)
|
3
3
|
#
|
4
4
|
# See 'rote.rb' or LICENSE for licence information.
|
5
|
-
# $Id: app.rb
|
5
|
+
# $Id: app.rb 121 2005-12-11 06:18:12 +0000 (Sun, 11 Dec 2005) roscopeco $
|
6
6
|
require 'getoptlong'
|
7
7
|
|
8
8
|
module Rote
|
data/lib/rote/cache.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# (c)2005, 2006 Ross Bamford (and contributors)
|
5
5
|
#
|
6
6
|
# See 'rote.rb' or LICENSE for licence information.
|
7
|
-
# $Id: cache.rb
|
7
|
+
# $Id: cache.rb 170 2006-01-11 23:38:51 +0000 (Wed, 11 Jan 2006) roscopeco $
|
8
8
|
#++
|
9
9
|
# This file adds dynamic dependency tracking and caching for
|
10
10
|
# incremental builds, by adding methods to the Rake module
|
@@ -23,6 +23,7 @@ require 'pathname'
|
|
23
23
|
require 'rake'
|
24
24
|
|
25
25
|
module Rake
|
26
|
+
|
26
27
|
class << self
|
27
28
|
# Directory for storing Rake dependency cache
|
28
29
|
def cache_dir=(val); @cache_dir = val; end
|
@@ -33,15 +34,27 @@ module Rake
|
|
33
34
|
# Array representing current tasks being executed
|
34
35
|
def task_stack; @tasks ||= []; end
|
35
36
|
# Reference to current task being executed
|
36
|
-
def current_task; task_stack.last; end
|
37
|
+
def current_task; task_stack.last; end
|
38
|
+
# Determine whether dependency caching is enabled
|
39
|
+
def cache_enabled?
|
40
|
+
if @cache_enabled.nil?
|
41
|
+
@cache_enabled = !ENV['NO_RAKE_CACHE']
|
42
|
+
else
|
43
|
+
@cache_enabled
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Enable or disable dependency caching.
|
48
|
+
def cache_enabled=(b); @cache_enabled = b; end
|
37
49
|
|
38
50
|
# Use this method to dynamically register one or more files
|
39
|
-
# as dependencies of the currently executing task
|
40
|
-
|
41
|
-
|
42
|
-
if
|
43
|
-
|
44
|
-
|
51
|
+
# as dependencies of the currently executing task (or the
|
52
|
+
# specified task if non-nil).
|
53
|
+
def register_dependency(deps, task = nil)
|
54
|
+
task = (current_task.name if current_task) unless task
|
55
|
+
if task then
|
56
|
+
file task => deps
|
57
|
+
(cached_dependencies[task] ||= []) << deps
|
45
58
|
end
|
46
59
|
end
|
47
60
|
end
|
@@ -53,17 +66,14 @@ module Rake
|
|
53
66
|
# loaded, and handling the task stack. The argument controls
|
54
67
|
# whether or not cached dependencies are loaded and should not
|
55
68
|
# be set false except in testing.
|
56
|
-
def invoke
|
69
|
+
def invoke
|
57
70
|
# Invoke patched to record task stack and
|
58
71
|
# load cached dependencies on first go.
|
59
|
-
Rake.load_cached_dependencies if
|
72
|
+
Rake.load_cached_dependencies if Rake.cache_enabled?
|
60
73
|
|
61
74
|
begin
|
62
|
-
Rake.task_stack << self
|
63
|
-
|
64
|
-
# TODO what's going on here?
|
65
|
-
# Rake.cached_dependencies[name] = [] if Rake.cached_dependencies[name]
|
66
|
-
|
75
|
+
Rake.task_stack << self
|
76
|
+
Rake.cached_dependencies[name] = [] if Rake.cached_dependencies[name]
|
67
77
|
pre_autodep_invoke
|
68
78
|
ensure
|
69
79
|
Rake.task_stack.pop
|
@@ -110,6 +120,8 @@ module Rake
|
|
110
120
|
# An at_exit handler is installed to save the dependencies
|
111
121
|
# when rake exits.
|
112
122
|
def self.load_cached_dependencies
|
123
|
+
return if $CACHEDEPS_LOADED
|
124
|
+
|
113
125
|
at_exit { self.save_cached_dependencies }
|
114
126
|
|
115
127
|
return unless File.exists?(dependencies_file)
|
@@ -123,7 +135,8 @@ module Rake
|
|
123
135
|
end
|
124
136
|
|
125
137
|
def self.save_cached_dependencies
|
126
|
-
return if cached_dependencies.empty?
|
138
|
+
return if cached_dependencies.empty? || !Rake.cache_enabled?
|
139
|
+
|
127
140
|
mkdir_p cache_dir unless File.exists?(cache_dir)
|
128
141
|
deps = {}
|
129
142
|
cached_dependencies.each do |k,v|
|