bluecloth 2.0.4 → 2.0.5
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/ChangeLog +266 -226
- data/Rakefile +21 -22
- data/lib/bluecloth.rb +9 -4
- data/rake/manual.rb +71 -71
- data/rake/rdoc.rb +9 -19
- data/rake/testing.rb +2 -2
- data/spec/bluecloth_spec.rb +7 -0
- data/spec/bugfix_spec.rb +21 -8
- metadata +63 -54
data/Rakefile
CHANGED
@@ -64,29 +64,29 @@ EXTCONF = EXTDIR + 'extconf.rb'
|
|
64
64
|
|
65
65
|
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
66
66
|
|
67
|
-
TEXT_FILES = %w
|
68
|
-
BIN_FILES =
|
69
|
-
LIB_FILES =
|
70
|
-
EXT_FILES =
|
71
|
-
DATA_FILES =
|
67
|
+
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README LICENSE] )
|
68
|
+
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" ).exclude( /\.svn/ )
|
69
|
+
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" ).exclude( /\.svn/ )
|
70
|
+
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" ).exclude( /\.svn/ )
|
71
|
+
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" ).exclude( /\.svn/ )
|
72
72
|
|
73
73
|
SPECDIR = BASEDIR + 'spec'
|
74
74
|
SPECLIBDIR = SPECDIR + 'lib'
|
75
|
-
SPEC_FILES =
|
76
|
-
Pathname.glob( "#{SPECLIBDIR}/**/*.rb" ).delete_if {|item| item.to_s =~ /\.svn/ }
|
75
|
+
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
77
76
|
|
78
77
|
TESTDIR = BASEDIR + 'tests'
|
79
|
-
TEST_FILES =
|
78
|
+
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" ).exclude( /\.svn/ )
|
80
79
|
|
81
80
|
RAKE_TASKDIR = BASEDIR + 'rake'
|
82
|
-
RAKE_TASKLIBS =
|
81
|
+
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
83
82
|
|
84
83
|
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
85
84
|
|
86
|
-
EXTRA_PKGFILES =
|
87
|
-
EXTRA_PKGFILES.
|
88
|
-
EXTRA_PKGFILES.
|
89
|
-
EXTRA_PKGFILES.
|
85
|
+
EXTRA_PKGFILES = Rake::FileList.new
|
86
|
+
EXTRA_PKGFILES.include "#{BASEDIR}/LICENSE.discount"
|
87
|
+
EXTRA_PKGFILES.include "#{BASEDIR}/spec/data/**/*.{txt,text,html}"
|
88
|
+
EXTRA_PKGFILES.include "#{BASEDIR}/ext/VERSION"
|
89
|
+
EXTRA_PKGFILES.exclude( /\.svn/ )
|
90
90
|
|
91
91
|
RELEASE_FILES = TEXT_FILES +
|
92
92
|
SPEC_FILES +
|
@@ -98,7 +98,7 @@ RELEASE_FILES = TEXT_FILES +
|
|
98
98
|
RAKE_TASKLIBS +
|
99
99
|
EXTRA_PKGFILES
|
100
100
|
|
101
|
-
RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
101
|
+
RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
|
102
102
|
|
103
103
|
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
104
104
|
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
@@ -135,7 +135,7 @@ SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
|
135
135
|
RDOCDIR = DOCSDIR + 'api'
|
136
136
|
RDOC_OPTIONS = [
|
137
137
|
'-w', '4',
|
138
|
-
'-
|
138
|
+
'-HN',
|
139
139
|
'-i', '.',
|
140
140
|
'-m', 'README',
|
141
141
|
'-t', PKG_NAME,
|
@@ -175,6 +175,7 @@ DEVELOPMENT_DEPENDENCIES = {
|
|
175
175
|
'tmail' => '>= 1.2.3.1',
|
176
176
|
'ultraviolet' => '>= 0.10.2',
|
177
177
|
'libxml-ruby' => '>= 0.8.3',
|
178
|
+
'rdoc' => '>= 2.4.3',
|
178
179
|
}
|
179
180
|
|
180
181
|
# Non-gem requirements: packagename => version
|
@@ -204,17 +205,15 @@ GEMSPEC = Gem::Specification.new do |gem|
|
|
204
205
|
gem.extra_rdoc_files = %w[ChangeLog README LICENSE]
|
205
206
|
|
206
207
|
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
207
|
-
gem.executables = BIN_FILES.select {|pn|
|
208
|
-
|
208
|
+
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
209
|
+
collect {|pn| File.basename(pn) }
|
209
210
|
|
210
211
|
if EXTCONF.exist?
|
211
212
|
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
212
213
|
end
|
213
214
|
|
214
|
-
gem.files = RELEASE_FILES
|
215
|
-
|
216
|
-
gem.test_files = SPEC_FILES.
|
217
|
-
collect {|f| f.relative_path_from(BASEDIR).to_s }
|
215
|
+
gem.files = RELEASE_FILES
|
216
|
+
gem.test_files = SPEC_FILES
|
218
217
|
|
219
218
|
DEPENDENCIES.each do |name, version|
|
220
219
|
version = '>= 0' if version.length.zero?
|
@@ -246,7 +245,7 @@ RAKE_TASKLIBS.each do |tasklib|
|
|
246
245
|
next if tasklib.to_s =~ %r{/(helpers|svn|verifytask)\.rb$}
|
247
246
|
begin
|
248
247
|
trace " loading tasklib %s" % [ tasklib ]
|
249
|
-
require tasklib
|
248
|
+
require tasklib
|
250
249
|
rescue ScriptError => err
|
251
250
|
fail "Task library '%s' failed to load: %s: %s" %
|
252
251
|
[ tasklib, err.class.name, err.message ]
|
data/lib/bluecloth.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
#
|
19
19
|
# == Version
|
20
20
|
#
|
21
|
-
# $Id: bluecloth.rb
|
21
|
+
# $Id: bluecloth.rb 132 2009-07-16 00:18:30Z deveiant $
|
22
22
|
#
|
23
23
|
# == License
|
24
24
|
#
|
@@ -29,13 +29,13 @@
|
|
29
29
|
class BlueCloth
|
30
30
|
|
31
31
|
# Release Version
|
32
|
-
VERSION = '2.0.
|
32
|
+
VERSION = '2.0.5'
|
33
33
|
|
34
34
|
# SVN Revision
|
35
|
-
SVNREV = %q$Rev:
|
35
|
+
SVNREV = %q$Rev: 132 $
|
36
36
|
|
37
37
|
# SVN Id tag
|
38
|
-
SVNID = %q$Id: bluecloth.rb
|
38
|
+
SVNID = %q$Id: bluecloth.rb 132 2009-07-16 00:18:30Z deveiant $
|
39
39
|
|
40
40
|
# The defaults for all supported options.
|
41
41
|
DEFAULT_OPTIONS = {
|
@@ -154,3 +154,8 @@ class BlueCloth
|
|
154
154
|
end # class BlueCloth
|
155
155
|
|
156
156
|
require 'bluecloth_ext'
|
157
|
+
|
158
|
+
# Set the top-level 'Markdown' constant if it isn't already set
|
159
|
+
::Markdown = ::BlueCloth unless defined?( ::Markdown )
|
160
|
+
|
161
|
+
|
data/rake/manual.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Manual-generation Rake tasks and classes
|
3
|
-
# $Id: manual.rb
|
3
|
+
# $Id: manual.rb 110 2009-07-06 23:34:04Z deveiant $
|
4
4
|
#
|
5
5
|
# Authors:
|
6
6
|
# * Michael Granger <ged@FaerieMUD.org>
|
@@ -55,7 +55,7 @@ module Manual
|
|
55
55
|
def export_resources( output_dir )
|
56
56
|
# No-op by default
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
|
60
60
|
### Process the +page+'s source with the filter and return the altered content.
|
61
61
|
def process( source, page, metadata )
|
@@ -118,28 +118,28 @@ module Manual
|
|
118
118
|
######
|
119
119
|
public
|
120
120
|
######
|
121
|
-
|
121
|
+
|
122
122
|
# The Manual::PageCatalog to which the page belongs
|
123
123
|
attr_reader :catalog
|
124
|
-
|
124
|
+
|
125
125
|
# The relative path to the base directory, for prepending to page paths
|
126
126
|
attr_reader :basepath
|
127
|
-
|
127
|
+
|
128
128
|
# The Pathname object that specifys the page source file
|
129
129
|
attr_reader :sourcefile
|
130
|
-
|
130
|
+
|
131
131
|
# The configured layouts directory as a Pathname object.
|
132
132
|
attr_reader :layouts_dir
|
133
|
-
|
133
|
+
|
134
134
|
# The page configuration, as read from its YAML header
|
135
135
|
attr_reader :config
|
136
|
-
|
136
|
+
|
137
137
|
# The raw source of the page
|
138
138
|
attr_reader :source
|
139
|
-
|
139
|
+
|
140
140
|
# The filters the page will use to render itself
|
141
141
|
attr_reader :filters
|
142
|
-
|
142
|
+
|
143
143
|
|
144
144
|
### Generate HTML output from the page and return it.
|
145
145
|
def generate( metadata )
|
@@ -156,7 +156,7 @@ module Manual
|
|
156
156
|
# meta-generator propaganda/advertising.
|
157
157
|
html = self.cleanup( html ).sub( %r:<meta name="generator"[^>]*tidy[^>]*/>:im, '' ) if
|
158
158
|
self.config['cleanup']
|
159
|
-
|
159
|
+
|
160
160
|
return html
|
161
161
|
end
|
162
162
|
|
@@ -165,8 +165,8 @@ module Manual
|
|
165
165
|
def title
|
166
166
|
return self.config['title'] || self.sourcefile.basename
|
167
167
|
end
|
168
|
-
|
169
|
-
|
168
|
+
|
169
|
+
|
170
170
|
### Run the various filters on the given input and return the transformed
|
171
171
|
### content.
|
172
172
|
def generate_content( input, metadata )
|
@@ -182,13 +182,13 @@ module Manual
|
|
182
182
|
unless source =~ PAGE_WITH_YAML_HEADER
|
183
183
|
return DEFAULT_CONFIG.dup, source
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
pageconfig = YAML.load( $1 )
|
187
187
|
source = $2
|
188
|
-
|
188
|
+
|
189
189
|
return DEFAULT_CONFIG.merge( pageconfig ), source
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
|
193
193
|
### Clean up and return the given HTML +source+.
|
194
194
|
def cleanup( source )
|
@@ -208,7 +208,7 @@ module Manual
|
|
208
208
|
trace "No cleanup: " + err.message
|
209
209
|
return source
|
210
210
|
end
|
211
|
-
|
211
|
+
|
212
212
|
|
213
213
|
### Get (singleton) instances of the filters named in +filterlist+ and return them.
|
214
214
|
def load_filters( filterlist )
|
@@ -230,7 +230,7 @@ module Manual
|
|
230
230
|
items << %Q{<div class="section">}
|
231
231
|
items << %Q{<h2><a href="#{self.basepath + path}/">#{title}</a></h2>}
|
232
232
|
items << '<ul class="index-section">'
|
233
|
-
|
233
|
+
|
234
234
|
when :current_section
|
235
235
|
items << %Q{<div class="section current-section">}
|
236
236
|
items << %Q{<h2><a href="#{self.basepath + path}/">#{title}</a></h2>}
|
@@ -267,44 +267,44 @@ module Manual
|
|
267
267
|
def initialize( sourcedir, layoutsdir )
|
268
268
|
@sourcedir = sourcedir
|
269
269
|
@layoutsdir = layoutsdir
|
270
|
-
|
270
|
+
|
271
271
|
@pages = []
|
272
272
|
@path_index = {}
|
273
273
|
@uri_index = {}
|
274
274
|
@title_index = {}
|
275
275
|
@hierarchy = {}
|
276
|
-
|
276
|
+
|
277
277
|
self.find_and_load_pages
|
278
278
|
end
|
279
|
-
|
280
|
-
|
279
|
+
|
280
|
+
|
281
281
|
######
|
282
282
|
public
|
283
283
|
######
|
284
284
|
|
285
285
|
# An index of the pages in the catalog by Pathname
|
286
286
|
attr_reader :path_index
|
287
|
-
|
287
|
+
|
288
288
|
# An index of the pages in the catalog by title
|
289
289
|
attr_reader :title_index
|
290
|
-
|
290
|
+
|
291
291
|
# An index of the pages in the catalog by the URI of their source relative to the source
|
292
292
|
# directory
|
293
293
|
attr_reader :uri_index
|
294
|
-
|
294
|
+
|
295
295
|
# The hierarchy of pages in the catalog, suitable for generating an on-page index
|
296
296
|
attr_reader :hierarchy
|
297
|
-
|
297
|
+
|
298
298
|
# An Array of all Manual::Page objects found
|
299
299
|
attr_reader :pages
|
300
300
|
|
301
301
|
# The Pathname location of the .page files.
|
302
302
|
attr_reader :sourcedir
|
303
|
-
|
303
|
+
|
304
304
|
# The Pathname location of look and feel templates.
|
305
305
|
attr_reader :layoutsdir
|
306
306
|
|
307
|
-
|
307
|
+
|
308
308
|
### Traverse the catalog's #hierarchy, yielding to the given +builder+
|
309
309
|
### block for each entry, as well as each time a sub-hash is entered or
|
310
310
|
### exited, setting the +type+ appropriately. Valid values for +type+ are:
|
@@ -361,7 +361,7 @@ module Manual
|
|
361
361
|
trace "Using the path for the sort of directory %p" % [ subpath ]
|
362
362
|
subpath.to_s
|
363
363
|
end
|
364
|
-
|
364
|
+
|
365
365
|
# Page
|
366
366
|
else
|
367
367
|
if subpath == INDEX_PATH
|
@@ -376,7 +376,7 @@ module Manual
|
|
376
376
|
|
377
377
|
end # sort_by
|
378
378
|
end
|
379
|
-
|
379
|
+
|
380
380
|
|
381
381
|
INDEX_PATH = Pathname.new('index')
|
382
382
|
|
@@ -386,7 +386,7 @@ module Manual
|
|
386
386
|
from_current = false
|
387
387
|
trace "Section handler: path=%p, section keys=%p, from=%s" %
|
388
388
|
[ path, section.keys, from.sourcefile ]
|
389
|
-
|
389
|
+
|
390
390
|
# Call the callback with :section -- determine the section title from
|
391
391
|
# the 'index.page' file underneath it, or the directory name if no
|
392
392
|
# index.page exists.
|
@@ -401,10 +401,10 @@ module Manual
|
|
401
401
|
title = File.dirname( path ).gsub( /_/, ' ' )
|
402
402
|
builder.call( :section, title, path )
|
403
403
|
end
|
404
|
-
|
404
|
+
|
405
405
|
# Recurse
|
406
406
|
self.traverse_hierarchy( path, section, from, &builder )
|
407
|
-
|
407
|
+
|
408
408
|
# Call the callback with :section_end
|
409
409
|
if from_current
|
410
410
|
builder.call( :current_section_end, '', path )
|
@@ -412,8 +412,8 @@ module Manual
|
|
412
412
|
builder.call( :section_end, '', path )
|
413
413
|
end
|
414
414
|
end
|
415
|
-
|
416
|
-
|
415
|
+
|
416
|
+
|
417
417
|
### Yield the specified +page+ to the builder
|
418
418
|
def handle_page_callback( path, page, from=nil )
|
419
419
|
if from == page
|
@@ -422,10 +422,10 @@ module Manual
|
|
422
422
|
yield( :entry, page.title, path )
|
423
423
|
end
|
424
424
|
end
|
425
|
-
|
425
|
+
|
426
426
|
|
427
427
|
### Find and store
|
428
|
-
|
428
|
+
|
429
429
|
### Find all .page files under the configured +sourcedir+ and create a new
|
430
430
|
### Manual::Page object for each one.
|
431
431
|
def find_and_load_pages
|
@@ -439,7 +439,7 @@ module Manual
|
|
439
439
|
@path_index[ pagefile ] = page
|
440
440
|
@title_index[ page.title ] = page
|
441
441
|
@uri_index[ hierpath.to_s ] = page
|
442
|
-
|
442
|
+
|
443
443
|
# Place the page in the page hierarchy by using inject to find and/or create the
|
444
444
|
# necessary subhashes. The last run of inject will return the leaf hash in which
|
445
445
|
# the page will live
|
@@ -451,7 +451,7 @@ module Manual
|
|
451
451
|
section[ pagefile.basename('.page') ] = page
|
452
452
|
end
|
453
453
|
end
|
454
|
-
|
454
|
+
|
455
455
|
end
|
456
456
|
|
457
457
|
|
@@ -463,7 +463,7 @@ module Manual
|
|
463
463
|
require 'redcloth'
|
464
464
|
super
|
465
465
|
end
|
466
|
-
|
466
|
+
|
467
467
|
|
468
468
|
### Process the given +source+ as Textile and return the resulting HTML
|
469
469
|
### fragment.
|
@@ -493,7 +493,7 @@ module Manual
|
|
493
493
|
|
494
494
|
### Manual generation task library
|
495
495
|
class GenTask < Rake::TaskLib
|
496
|
-
|
496
|
+
|
497
497
|
# Default values for task config variables
|
498
498
|
DEFAULT_NAME = :manual
|
499
499
|
DEFAULT_BASE_DIR = Pathname.new( 'docs/manual' )
|
@@ -503,7 +503,7 @@ module Manual
|
|
503
503
|
DEFAULT_RESOURCE_DIR = 'resources'
|
504
504
|
DEFAULT_LIB_DIR = 'lib'
|
505
505
|
DEFAULT_METADATA = OpenStruct.new
|
506
|
-
|
506
|
+
|
507
507
|
|
508
508
|
### Define a new manual-generation task with the given +name+.
|
509
509
|
def initialize( name=:manual )
|
@@ -515,13 +515,13 @@ module Manual
|
|
515
515
|
@resource_dir = DEFAULT_RESOURCE_DIR
|
516
516
|
@lib_dir = DEFAULT_LIB_DIR
|
517
517
|
@metadata = DEFAULT_METADATA
|
518
|
-
|
518
|
+
|
519
519
|
yield( self ) if block_given?
|
520
|
-
|
520
|
+
|
521
521
|
self.define
|
522
522
|
end
|
523
|
-
|
524
|
-
|
523
|
+
|
524
|
+
|
525
525
|
######
|
526
526
|
public
|
527
527
|
######
|
@@ -555,7 +555,7 @@ module Manual
|
|
555
555
|
|
556
556
|
load_filter_libraries( libdir )
|
557
557
|
catalog = Manual::PageCatalog.new( sourcedir, layoutsdir )
|
558
|
-
|
558
|
+
|
559
559
|
# Declare the tasks outside the namespace that point in
|
560
560
|
task @name => "#@name:build"
|
561
561
|
task "clobber_#@name" => "#@name:clobber"
|
@@ -563,20 +563,20 @@ module Manual
|
|
563
563
|
namespace( self.name ) do
|
564
564
|
setup_resource_copy_tasks( resourcedir, outputdir )
|
565
565
|
manual_pages = setup_page_conversion_tasks( sourcedir, outputdir, catalog )
|
566
|
-
|
566
|
+
|
567
567
|
desc "Build the manual"
|
568
568
|
task :build => [ :rdoc, :copy_resources, :copy_apidocs, :generate_pages ]
|
569
|
-
|
569
|
+
|
570
570
|
task :clobber do
|
571
571
|
RakeFileUtils.verbose( $verbose ) do
|
572
572
|
rm_f manual_pages.to_a
|
573
573
|
end
|
574
574
|
remove_dir( outputdir ) if ( outputdir + '.buildtime' ).exist?
|
575
575
|
end
|
576
|
-
|
576
|
+
|
577
577
|
desc "Remove any previously-generated parts of the manual and rebuild it"
|
578
578
|
task :rebuild => [ :clobber, self.name ]
|
579
|
-
|
579
|
+
|
580
580
|
desc "Watch for changes to the source files and rebuild when they change"
|
581
581
|
task :autobuild do
|
582
582
|
scope = [ self.name ]
|
@@ -598,8 +598,8 @@ module Manual
|
|
598
598
|
end
|
599
599
|
|
600
600
|
end # def define
|
601
|
-
|
602
|
-
|
601
|
+
|
602
|
+
|
603
603
|
### Load the filter libraries provided in the given +libdir+
|
604
604
|
def load_filter_libraries( libdir )
|
605
605
|
Pathname.glob( libdir + '*.rb' ) do |filterlib|
|
@@ -617,7 +617,7 @@ module Manual
|
|
617
617
|
# dependency that causes the rule to be fired for each one when the task is invoked.
|
618
618
|
manual_sources = FileList[ catalog.path_index.keys.map {|pn| pn.to_s} ]
|
619
619
|
trace " found %d source files" % [ manual_sources.length ]
|
620
|
-
|
620
|
+
|
621
621
|
# Map .page files to their equivalent .html output
|
622
622
|
html_pathmap = "%%{%s,%s}X.html" % [ sourcedir, outputdir ]
|
623
623
|
manual_pages = manual_sources.pathmap( html_pathmap )
|
@@ -636,33 +636,33 @@ module Manual
|
|
636
636
|
proc {|name| name.sub(/\.[^.]+$/, '.page').sub( outputdir, sourcedir) },
|
637
637
|
outputdir.to_s
|
638
638
|
]) do |task|
|
639
|
-
|
639
|
+
|
640
640
|
source = Pathname.new( task.source )
|
641
641
|
target = Pathname.new( task.name )
|
642
642
|
log " #{ source } -> #{ target }"
|
643
|
-
|
643
|
+
|
644
644
|
page = catalog.path_index[ source ]
|
645
645
|
#trace " page object is: %p" % [ page ]
|
646
|
-
|
646
|
+
|
647
647
|
target.dirname.mkpath
|
648
648
|
target.open( File::WRONLY|File::CREAT|File::TRUNC ) do |io|
|
649
649
|
io.write( page.generate(metadata) )
|
650
650
|
end
|
651
651
|
end
|
652
|
-
|
652
|
+
|
653
653
|
# Group all the manual page output files targets into a containing task
|
654
654
|
desc "Generate any pages of the manual that have changed"
|
655
655
|
task :generate_pages => manual_pages
|
656
656
|
return manual_pages
|
657
657
|
end
|
658
|
-
|
659
|
-
|
658
|
+
|
659
|
+
|
660
660
|
### Copy method for resources -- passed as a block to the various file tasks that copy
|
661
661
|
### resources to the output directory.
|
662
662
|
def copy_resource( task )
|
663
663
|
source = task.prerequisites[ 1 ]
|
664
664
|
target = task.name
|
665
|
-
|
665
|
+
|
666
666
|
when_writing do
|
667
667
|
trace " #{source} -> #{target}"
|
668
668
|
mkpath File.dirname( target ), :verbose => $trace unless
|
@@ -670,8 +670,8 @@ module Manual
|
|
670
670
|
install source, target, :mode => 0644, :verbose => $trace
|
671
671
|
end
|
672
672
|
end
|
673
|
-
|
674
|
-
|
673
|
+
|
674
|
+
|
675
675
|
### Set up a rule for copying files from the resources directory to the output dir.
|
676
676
|
def setup_resource_copy_tasks( resourcedir, outputdir )
|
677
677
|
resources = FileList[ resourcedir + '**/*.{js,css,png,gif,jpg,html}' ]
|
@@ -679,7 +679,7 @@ module Manual
|
|
679
679
|
target_pathmap = "%%{%s,%s}p" % [ resourcedir, outputdir ]
|
680
680
|
targets = resources.pathmap( target_pathmap )
|
681
681
|
copier = self.method( :copy_resource ).to_proc
|
682
|
-
|
682
|
+
|
683
683
|
# Create a file task to copy each file to the output directory
|
684
684
|
resources.each_with_index do |resource, i|
|
685
685
|
file( targets[i] => [ outputdir.to_s, resource ], &copier )
|
@@ -696,9 +696,9 @@ module Manual
|
|
696
696
|
log "Copying manual resources"
|
697
697
|
end
|
698
698
|
end
|
699
|
-
|
699
|
+
|
700
700
|
end # class Manual::GenTask
|
701
|
-
|
701
|
+
|
702
702
|
end
|
703
703
|
|
704
704
|
|
@@ -707,7 +707,7 @@ end
|
|
707
707
|
if MANUALDIR.exist?
|
708
708
|
MANUALOUTPUTDIR = MANUALDIR + 'output'
|
709
709
|
trace "Manual will be generated in: #{MANUALOUTPUTDIR}"
|
710
|
-
|
710
|
+
|
711
711
|
begin
|
712
712
|
directory MANUALOUTPUTDIR.to_s
|
713
713
|
|
@@ -740,14 +740,14 @@ else
|
|
740
740
|
log "No manual directory (#{MANUALDIR}) currently exists."
|
741
741
|
ask_for_confirmation( "Create a new manual directory tree from a template?" ) do
|
742
742
|
MANUALDIR.mkpath
|
743
|
-
|
743
|
+
|
744
744
|
%w[layouts lib output resources src].each do |dir|
|
745
745
|
FileUtils.mkpath( MANUALDIR + dir, :mode => 0755, :verbose => true, :noop => $dryrun )
|
746
746
|
end
|
747
|
-
|
747
|
+
|
748
748
|
Pathname.glob( TEMPLATEDIR + '**/*.{rb,css,png,js,erb,page}' ).each do |tmplfile|
|
749
749
|
trace "extname is: #{tmplfile.extname}"
|
750
|
-
|
750
|
+
|
751
751
|
# Render ERB files
|
752
752
|
if tmplfile.extname == '.erb'
|
753
753
|
rname = tmplfile.basename( '.erb' )
|
@@ -762,7 +762,7 @@ else
|
|
762
762
|
target.open( File::WRONLY|File::CREAT|File::EXCL, 0644 ) do |fh|
|
763
763
|
fh.print( html )
|
764
764
|
end
|
765
|
-
|
765
|
+
|
766
766
|
# Just copy anything else
|
767
767
|
else
|
768
768
|
target = MANUALDIR + tmplfile.relative_path_from( TEMPLATEDIR )
|