rote 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,4 @@
1
- *Rote is a simple page-based template system that was written to make it
2
- easier to author and maintain non-dynamic websites and
3
- offline documentation.* Rote provides a simple commandline or
4
- "Rake":http://rake.rubyforge.org based build for your pages, with page
5
- rendering (optionally supporting RDoc formatting, Textile and Markdown with
6
- "RedCloth":http://redcloth.rubyforge.org/ and ruby code with
7
- "ERB":http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html), layout,
8
- and general documentation / website build tasks.
1
+ *Rote is a simple page-based template system that was written to make it easier to author and maintain non-dynamic websites and offline documentation.* Rote provides a simple commandline or "Rake":http://rake.rubyforge.org based build for your pages, with page rendering (optionally supporting RDoc formatting, Textile and Markdown with "RedCloth":http://redcloth.rubyforge.org/ and ruby code with "ERB":http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html), layout, and general documentation / website build tasks.
9
2
 
10
3
  h3. Features
11
4
 
@@ -15,25 +8,18 @@ Rote offers the following major features:
15
8
  * ERB, Textile, Markdown and RDoc supported out of the box.
16
9
  * Multiple configurable layouts apply boilerplate to your pages.
17
10
  * Apply arbitrary Ruby code across all documentation, a subset, or individual pages.
18
- * Can be used standalone (from the command-line) or within "Rake":http://rake.rubyforge.org
19
- as a custom task library.
20
- * Supports any (text-based) format, while providing utilities and helpers for
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.
26
-
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.
11
+ * Can be used standalone (from the command-line) or within "Rake":http://rake.rubyforge.org as a custom task library.
12
+ * Supports any (text-based) format, while providing utilities and helpers for common formats.
13
+ * Flexible filtering with several standard filters and the ability to implement your own in a few lines of Ruby.
14
+ * Low-overhead monitoring functionality allows documentation to be automatically re-rendered, and custom processing done, whenever the source changes.
15
+
16
+ Rote is somewhat similar to "WebGen":http://webgen.rubyforge.org in intent, though the two are quite different in implementation. WebGen provides a richer environment geared more toward end-user websites and content publishing, whereas Rote's implementation as an extension to Rake reflects a bias toward software documentation and general textual templating.
31
17
 
32
18
  See the "User guide":<%= link_rel '/guide' %> and "RDoc":<%= link_rel '/rdoc' %> for usage information.
33
19
 
34
20
  h3. Download?
35
21
 
36
- You can get Rote via "RubyGems":http://rubyforge.org/projects/rubygems if you have it:
22
+ You can get Rote via "RubyGems":http://rubygems.org if you have it:
37
23
 
38
24
  * <strong><code>gem install -r rote</code></strong>
39
25
 
@@ -41,15 +27,9 @@ Alternatively, you can download tarball / zip packages if you don't:
41
27
 
42
28
  * <strong>"http://rubyforge.org/frs/?group_id=1120":http://rubyforge.org/frs/?group_id=1120</strong>
43
29
 
44
- You can also grab the latest code from "SVN":http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=rote
45
30
 
46
- h4. From Subversion
31
+ h4. From Git
47
32
 
48
- A link to the latest stable release can be found from the "project page":http://rubyforge.org/projects/rote .
33
+ You can also grab the latest code from "our GitHub page":http://github.com/roscopeco/rote .
49
34
 
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.
35
+ The master branch has the most up to date working development code while the latest release can be found on the appropriate tag for that version. Although every effort is made to ensure that this development code works, it cannot of course be guaranteed to be complete or bug free. If that's okay with you (maybe you're pretty happy-go-lucky in general...) then see our "GitHub page":http://github.com/roscopeco/rote for everything you need to get going with the Git version.
@@ -3,7 +3,7 @@
3
3
  <ul>
4
4
  <pre>
5
5
  <code>
6
- Copyright (c) 2005 Ross Bamford (and contributors)
6
+ Copyright (c) 2005-2013 Ross Bamford (and contributors)
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy of
9
9
  this software and associated documentation files (the "Software"), to deal in
@@ -1,6 +1,6 @@
1
1
  # rote.rb - main Rote module
2
- # Copyright (c) 2005, 2006 Ross Bamford (and contributors)
3
- # $Id: rote.rb 192 2009-11-04 12:53:03Z roscopeco $
2
+ # Copyright (c) 2005-2012 Ross Bamford (and contributors)
3
+ # $Id$
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.6'
44
+ ROTEVERSION = '0.4.0'
45
45
 
46
46
  #####
47
47
  ## *Rote* is a Rake (http://rake.rubyforge.org) based build tool for static
@@ -1,8 +1,8 @@
1
1
  # Rote application class
2
- # (c)2005 Ross Bamford (and contributors)
2
+ # (c)2005, 2012 Ross Bamford (and contributors)
3
3
  #
4
4
  # See 'rote.rb' or LICENSE for licence information.
5
- # $Id: app.rb 128 2005-12-12 02:45:24Z roscopeco $
5
+ # $Id$
6
6
  require 'getoptlong'
7
7
 
8
8
  module Rote
@@ -35,7 +35,7 @@ module Rote
35
35
  raise "Missing builtin.rf (expected at '#{@rakefile}')!" unless File.exists?(@rakefile)
36
36
 
37
37
  @rakeopts = ENV['RAKE_OPTS'] || ''
38
- @rake = ENV['RAKE_CMD'] || (PLATFORM =~ /mswin/ ? 'rake.cmd' : 'rake')
38
+ @rake = ENV['RAKE_CMD'] || (RUBY_PLATFORM =~ /mswin/ ? 'rake.cmd' : 'rake')
39
39
 
40
40
  process_args
41
41
 
@@ -90,7 +90,7 @@ module Rote
90
90
  Usage: rote [options] [task1] .. [taskN]
91
91
 
92
92
  Where [taskN] is a valid task or target name for the current project.
93
- Rite generates targets for each page source, and also defines a number
93
+ Rote generates targets for each page source, and also defines a number
94
94
  of top-level tasks for various things. Use the '--tasks' option to get
95
95
  a list of valid tasks.
96
96
 
@@ -1,10 +1,10 @@
1
1
  # Dependency caching / memoize to disk for Rake / Rote
2
2
  # Contributed by Jonathan Paisley (very slightly modified)
3
3
  #--
4
- # (c)2005, 2006 Ross Bamford (and contributors)
4
+ # (c)2005, 2006, 2012 Ross Bamford (and contributors)
5
5
  #
6
6
  # See 'rote.rb' or LICENSE for licence information.
7
- # $Id: cache.rb 190 2009-11-04 12:52:05Z roscopeco $
7
+ # $Id$
8
8
  #++
9
9
  # This file adds dynamic dependency tracking and caching for
10
10
  # incremental builds, by adding methods to the Rake module
@@ -17,14 +17,15 @@
17
17
  #
18
18
  # Eventually this registration may become implicit with layout.
19
19
 
20
- require 'md5'
20
+ require 'digest/md5'
21
21
  require 'yaml'
22
22
  require 'pathname'
23
23
  require 'rake'
24
24
 
25
- module Rake
26
-
25
+ module Rake
27
26
  class << self
27
+ include Rake::DSL
28
+
28
29
  # Directory for storing Rake dependency cache
29
30
  def cache_dir=(val); @cache_dir = val; end
30
31
  def cache_dir; @cache_dir ||= ".rake_cache"; end
@@ -54,7 +55,7 @@ module Rake
54
55
  task = (current_task.name if current_task) unless task
55
56
  if task then
56
57
  file task => deps
57
- (cached_dependencies[task] ||= []) << deps
58
+ (cached_dependencies[task] ||= []) << deps
58
59
  end
59
60
  end
60
61
  end
@@ -74,11 +75,11 @@ module Rake
74
75
 
75
76
  # Execute the task, loading cached dependencies if not already
76
77
  # loaded, and handling the task stack.
77
- define_method(:execute) do
78
+ define_method(:execute) do |*args|
78
79
  begin
79
80
  Rake.task_stack << self
80
81
  Rake.cached_dependencies[name] = [] if Rake.cached_dependencies[name]
81
- old_execute.bind(self).call({ })
82
+ old_execute.bind(self).call(*args)
82
83
  ensure
83
84
  Rake.task_stack.pop
84
85
  end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # Extra bonus Rake tasklibs for Rote and elsewhere
3
- # (c)2005, 2006 Ross Bamford (and contributors)
3
+ # (c)2005, 2006, 2012 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
6
  # $Id$
@@ -49,13 +49,16 @@ module Rote
49
49
  # The color scale range for profiling output (dB) [not used]
50
50
  attr_accessor :range
51
51
 
52
+ # If +false+, the task will emit a warning rather than failing when Rcov command fails. [true]
53
+ attr_accessor :failonerror
54
+
52
55
  # Create a new RCovTask, using the supplied block for configuration,
53
56
  # and define tasks with the specified base-name within Rake.
54
57
  #
55
58
  # Note that the named task just invokes a file task for the output
56
59
  # directory, which is dependent on test (and source, if specified)
57
60
  # file changes.
58
- def initialize(name = :rcov) # :yield: self if block_given?
61
+ def initialize(name = :rcov, failonerror = true) # :yield: self if block_given?
59
62
  @taskname = name
60
63
  @rcov_cmd = 'rcov'
61
64
  @test_files = Rake::FileList.new
@@ -63,6 +66,7 @@ module Rote
63
66
  @load_paths = []
64
67
  @excludes = []
65
68
  @output_dir = './coverage'
69
+ @failonerror = true
66
70
 
67
71
  yield self if block_given?
68
72
 
@@ -93,7 +97,11 @@ module Rote
93
97
 
94
98
  puts cmd
95
99
  unless system(cmd)
96
- fail "RCov command '#{rcov_cmd}' failed (status #{$?.exitstatus})"
100
+ if failonerror
101
+ fail "RCov command '#{rcov_cmd}' failed (status #{$?.exitstatus})"
102
+ else
103
+ warn "RCov command '#{rcov_cmd}' failed (status #{$?.exitstatus})"
104
+ end
97
105
  end
98
106
  end
99
107
 
@@ -3,7 +3,7 @@
3
3
  # (c)2005, 2006 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: filters.rb 163 2006-01-05 21:15:54Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  # Everyone requires this, we need to get it loaded first.
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: base.rb 144 2005-12-14 19:17:21Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
  module Rote
9
9
  module Filters
@@ -3,7 +3,7 @@
3
3
  # (c)2006 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: bluecloth.rb 160 2006-01-05 21:05:44Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  require 'bluecloth'
@@ -3,12 +3,12 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: rdoc.rb 177 2006-02-26 19:59:11Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  require 'rote/filters/base'
10
- require 'rdoc/markup/simple_markup'
11
- require 'rdoc/markup/simple_markup/to_html'
10
+ require 'rdoc/markup'
11
+ require 'rdoc/markup/to_html'
12
12
 
13
13
  module Rote
14
14
  module Filters
@@ -16,10 +16,9 @@ module Rote
16
16
  #####
17
17
  ## Page filter supporting RDoc markup.
18
18
  class RDoc < TextFilter
19
- def initialize(markup = SM::SimpleMarkup.new, output = SM::ToHtml.new)
19
+ def initialize(markup = ::RDoc::Markup::ToHtml.new)
20
20
  @markup = markup
21
- @output = output
22
- self.handler_blk = proc { |text,page| @markup.convert(text, @output) }
21
+ self.handler_blk = proc { |text,page| @markup.convert(text) }
23
22
  end
24
23
  end
25
24
  end
@@ -3,7 +3,7 @@
3
3
  # (c)2005, 2006 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: redcloth.rb 191 2009-11-04 12:52:38Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  require 'redcloth'
@@ -31,10 +31,8 @@ module Rote
31
31
  end
32
32
 
33
33
  def handler(text,page)
34
- rc = ::RedCloth.new(text)
35
- # hack around a RedCloth warning
36
- rc.instance_eval { @lite_mode = false }
37
- rc.to_html(*@redcloth_opts)
34
+ rc = ::RedCloth.new(text, @redcloth_opts)
35
+ rc.to_html
38
36
  end
39
37
  end
40
38
 
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: syntax.rb 170 2006-01-11 23:38:51Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  require 'syntax'
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: tidy.rb 128 2005-12-12 02:45:24Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  module Rote
@@ -25,7 +25,7 @@ module Rote
25
25
  # Create a new filter instance, using the specified output format,
26
26
  # and optionally a custom 'tidy' command and options.
27
27
  def initialize(format = :xhtml, tidycmd = nil, tidyopts = '-q')
28
- @tidycmd = tidycmd || ENV['TIDYCMD'] || (PLATFORM =~ /mswin/ ? 'tidy.exe' : 'tidy')
28
+ @tidycmd = tidycmd || ENV['TIDYCMD'] || (RUBY_PLATFORM =~ /mswin/ ? 'tidy.exe' : 'tidy')
29
29
  # TODO windows 'tidy.exe' correct?
30
30
 
31
31
  @tidyopts = tidyopts
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: toc.rb 170 2006-01-11 23:38:51Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  module Rote
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: format.rb 128 2005-12-12 02:45:24Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  Dir[File.join(File.dirname(__FILE__), 'format/*.rb')].each { |f| require f }
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: html.rb 128 2005-12-12 02:45:24Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
  require 'erb'
9
9
 
@@ -1,9 +1,9 @@
1
1
  #--
2
2
  # Rote page class
3
- # (c)2005, 2006 Ross Bamford (and contributors)
3
+ # (c)2005, 2006, 2012 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: page.rb 170 2006-01-11 23:38:51Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
 
9
9
  require 'erb'
@@ -150,7 +150,7 @@ module Rote
150
150
  #
151
151
  # *Deprecated* This has no knowledge of nested layout,
152
152
  # and operates only on the innermost layout.
153
- attr_reader :layout_text # Deprecated vv0.3.2 v-0.4
153
+ attr_reader :layout_text # layout_text is deprecated (doesn't work with nested layout) vv0.3.2 v-0.4
154
154
 
155
155
  # The basename from which this page's template was read,
156
156
  # relative to the +base_path+.
@@ -389,7 +389,7 @@ module Rote
389
389
  @layout_names.each do |fn|
390
390
  txt = load_layout(fn)
391
391
 
392
- @layout_text ||= txt # legacy support vv0.3.2 v-0.4
392
+ @layout_text ||= txt # layout_text legacy support vv0.3.2 v-0.4
393
393
 
394
394
  # render into the layout if supplied.
395
395
  if txt
@@ -1,7 +1,7 @@
1
1
  # Standard Rakefile for custom Rote build
2
2
  #
3
3
  # Generated from:
4
- # $Id: Rakefile 160 2006-01-05 21:05:44Z roscopeco $
4
+ # $Id$
5
5
  #
6
6
  begin
7
7
  require 'rubygems'
@@ -3,7 +3,7 @@
3
3
  # (c)2005 Ross Bamford (and contributors)
4
4
  #
5
5
  # See 'rote.rb' or LICENSE for licence information.
6
- # $Id: rotetasks.rb 190 2009-11-04 12:52:05Z roscopeco $
6
+ # $Id$
7
7
  #++
8
8
  require 'rake'
9
9
  require 'rake/tasklib'
@@ -230,7 +230,7 @@ module Rote
230
230
  tasks = res_fl.select { |fn| not File.directory?(fn) }.map do |fn|
231
231
  tfn, = target_fn(/^#{res.dir}/, fn)
232
232
 
233
- desc "#{fn} => #{tfn}" #if show_file_tasks?
233
+ desc "#{fn} => #{tfn}" if show_file_tasks?
234
234
  file tfn => [fn] do
235
235
  dn = File.dirname(tfn)
236
236
  mkdir_p dn unless File.exists?(dn)
@@ -250,7 +250,7 @@ module Rote
250
250
  gen_files = pages_fl.select { |fn| not File.directory?(fn) }.map do |fn|
251
251
  tfn, blk = target_fn(/^#{pages.dir}/, fn)
252
252
 
253
- desc "#{fn} => #{tfn}" #if show_file_tasks?
253
+ desc "#{fn} => #{tfn}" if show_file_tasks?
254
254
  file tfn => [fn] do
255
255
  dn = File.dirname(tfn)
256
256
  mkdir_p dn unless File.exists?(dn)
@@ -8,12 +8,15 @@ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
8
8
 
9
9
  require 'rake'
10
10
  require 'rote/cache'
11
+ require 'test/unit'
11
12
 
12
13
  Rake.cache_enabled = false
13
14
 
14
15
  module Rote
15
16
  class TestCache < Test::Unit::TestCase
16
17
 
18
+ include Rake::DSL
19
+
17
20
  def test_rake_cache_dir
18
21
  assert_equal '.rake_cache', Rake.cache_dir
19
22
  Rake.cache_dir = './.cache'
@@ -109,7 +109,7 @@ module Rote
109
109
  t = Filters::RedCloth.new.filter('*Textile* _Test_', nil)
110
110
  assert_equal '<p><strong>Textile</strong> <em>Test</em></p>', t
111
111
 
112
- t = Filters::RedCloth.new(:textile).filter('*Textile* _Test_', nil)
112
+ t = Filters::RedCloth.new.filter('*Textile* _Test_', nil)
113
113
  assert_equal '<p><strong>Textile</strong> <em>Test</em></p>', t
114
114
  end
115
115
 
@@ -135,7 +135,7 @@ module Rote
135
135
  unless defined?(TEST_FROM_GEM)
136
136
  def test_render_rdoc
137
137
  t = Filters::RDoc.new.filter("== RDoc\n=== Markup",nil)
138
- assert_equal "<h2>RDoc</h2>\n<h3>Markup</h3>\n", t
138
+ assert_equal "\n<h2>RDoc</h2>\n\n<h3>Markup</h3>\n", t
139
139
  end
140
140
  end
141
141