linkparser 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +134 -506
- data/LICENSE +1 -1
- data/README.md +95 -0
- data/Rakefile +145 -95
- data/Rakefile.local +31 -39
- data/ext/dictionary.c +103 -37
- data/ext/extconf.rb +79 -32
- data/ext/linkage.c +245 -210
- data/ext/linkparser.c +3 -2
- data/ext/linkparser.h +21 -17
- data/ext/parseoptions.c +65 -65
- data/ext/sentence.c +75 -64
- data/lib/linkparser.rb +16 -26
- data/lib/linkparser/linkage.rb +68 -50
- data/lib/linkparser/mixins.rb +38 -0
- data/lib/linkparser/sentence.rb +15 -40
- data/rake/dependencies.rb +1 -1
- data/rake/documentation.rb +123 -0
- data/rake/helpers.rb +400 -310
- data/rake/hg.rb +318 -0
- data/rake/manual.rb +84 -79
- data/rake/packaging.rb +33 -37
- data/rake/publishing.rb +166 -146
- data/rake/style.rb +1 -1
- data/rake/svn.rb +577 -549
- data/rake/testing.rb +55 -106
- data/spec/bugfixes_spec.rb +12 -6
- data/spec/linkparser/dictionary_spec.rb +45 -29
- data/spec/linkparser/linkage_spec.rb +90 -94
- data/spec/linkparser/mixins_spec.rb +67 -0
- data/spec/linkparser/parseoptions_spec.rb +19 -22
- data/spec/linkparser/sentence_spec.rb +19 -17
- data/spec/linkparser_spec.rb +11 -5
- metadata +64 -147
- metadata.gz.sig +0 -0
- data/README +0 -61
- data/rake/rdoc.rb +0 -40
- data/rake/win32.rb +0 -186
data/lib/linkparser.rb
CHANGED
@@ -1,38 +1,28 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# The LinkParser top-level namespace.
|
7
|
-
#
|
8
|
-
# == Authors
|
9
|
-
#
|
10
|
-
# * Michael Granger <ged@FaerieMUD.org>
|
11
|
-
# * Martin Chase <stillflame@FaerieMUD.org>
|
12
|
-
#
|
13
|
-
# == Version
|
14
|
-
#
|
15
|
-
# $Id: linkparser.rb 53 2009-06-03 12:52:13Z deveiant $
|
3
|
+
# The LinkParser top-level namespace.
|
16
4
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# :include: LICENSE
|
20
|
-
#--
|
5
|
+
# @author Michael Granger <ged@FaerieMUD.org>
|
6
|
+
# @author Martin Chase <stillflame@FaerieMUD.org>
|
21
7
|
#
|
22
|
-
# See the LICENSE file for copyright/licensing information.
|
23
8
|
module LinkParser
|
24
9
|
|
10
|
+
# Release version
|
11
|
+
VERSION = '1.1.0'
|
12
|
+
|
13
|
+
# Load the correct version if it's a Windows binary gem
|
14
|
+
if RUBY_PLATFORM =~/(mswin|mingw)/i
|
15
|
+
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
|
16
|
+
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
|
17
|
+
require "#{major_minor}/linkparser_ext"
|
18
|
+
else
|
19
|
+
require 'linkparser_ext'
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'linkparser/mixins'
|
25
23
|
require 'linkparser/sentence'
|
26
24
|
require 'linkparser/linkage'
|
27
25
|
|
28
|
-
# Release version
|
29
|
-
VERSION = '1.0.4'
|
30
|
-
|
31
|
-
# SVN Revision
|
32
|
-
SVNRev = %q$Rev: 53 $
|
33
|
-
|
34
|
-
# SVN Id
|
35
|
-
SVNId = %q$Id: linkparser.rb 53 2009-06-03 12:52:13Z deveiant $
|
36
26
|
|
37
27
|
end # class LinkParser
|
38
28
|
|
data/lib/linkparser/linkage.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'linkparser'
|
4
|
+
require 'linkparser/mixins'
|
5
|
+
|
2
6
|
#
|
3
7
|
# Additional high-level functionality for LinkParser::Sentence objects.
|
4
8
|
#
|
@@ -10,44 +14,41 @@
|
|
10
14
|
#
|
11
15
|
# * Michael Granger <ged@FaerieMUD.org>
|
12
16
|
#
|
13
|
-
# == License
|
14
|
-
#
|
15
|
-
# Copyright (c) 2007, 2008 The FaerieMUD Consortium
|
16
|
-
#
|
17
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
18
|
-
# of this software and associated documentation files (the "Software"), to deal
|
19
|
-
# in the Software without restriction, including without limitation the rights
|
20
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
21
|
-
# copies of the Software, and to permit persons to whom the Software is
|
22
|
-
# furnished to do so, subject to the following conditions:
|
23
|
-
#
|
24
|
-
# The above copyright notice and this permission notice shall be included in
|
25
|
-
# all copies or substantial portions of the Software.
|
26
|
-
#
|
27
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
28
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
29
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
30
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
31
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
32
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
33
|
-
# THE SOFTWARE.
|
34
|
-
#
|
35
17
|
# == Version
|
36
18
|
#
|
37
|
-
# $Id: linkage.rb
|
19
|
+
# $Id: linkage.rb,v a5e7d9e3cf5c 2010/11/25 00:50:55 ged $
|
38
20
|
#
|
21
|
+
# == License
|
22
|
+
#
|
23
|
+
# :include: LICENSE
|
24
|
+
#--
|
25
|
+
#
|
26
|
+
# See the LICENSE file for copyright/licensing information.
|
27
|
+
class LinkParser::Linkage
|
28
|
+
extend LinkParser::DeprecationUtilities
|
39
29
|
|
40
|
-
require '
|
30
|
+
require 'linkparser_ext'
|
41
31
|
|
32
|
+
###
|
33
|
+
### Deprecated API
|
34
|
+
### These methods are going to be removed in a future version.
|
35
|
+
###
|
42
36
|
|
43
|
-
###
|
44
|
-
|
37
|
+
### Returns +true+ if the linkage has more than one sublinkage (i.e., the
|
38
|
+
### sentence has a conjunction).
|
39
|
+
def has_conjunction?
|
40
|
+
return self.num_sublinkages > 1
|
41
|
+
end
|
42
|
+
deprecated_method :has_conjunction?
|
45
43
|
|
46
|
-
#
|
47
|
-
|
44
|
+
# These are all defined in the extension
|
45
|
+
deprecated_method :num_sublinkages
|
46
|
+
deprecated_method :current_sublinkage=
|
47
|
+
deprecated_method :current_sublinkage
|
48
|
+
deprecated_method :compute_union
|
49
|
+
|
50
|
+
### End deprecated stuff
|
48
51
|
|
49
|
-
# SVN Id
|
50
|
-
SVNId = %q$Id: linkage.rb 48 2008-12-19 18:30:33Z deveiant $
|
51
52
|
|
52
53
|
# Descriptions of the linkage types, keyed by linkage symbol
|
53
54
|
LINK_TYPES = {
|
@@ -161,7 +162,8 @@ class LinkParser::Linkage
|
|
161
162
|
|
162
163
|
# Link struct (:lword, :rword, :length, :label, :llabel, :rlabel, :desc)
|
163
164
|
Link = Struct.new( "LinkParserLink", :lword, :rword, :length, :label, :llabel, :rlabel, :desc )
|
164
|
-
|
165
|
+
|
166
|
+
|
165
167
|
|
166
168
|
######
|
167
169
|
public
|
@@ -169,10 +171,9 @@ class LinkParser::Linkage
|
|
169
171
|
|
170
172
|
### Return a human-readable representation of the Sentence object.
|
171
173
|
def inspect
|
172
|
-
return %{#<%s:0x%x:
|
174
|
+
return %{#<%s:0x%x: [%d links]>} % [
|
173
175
|
self.class.name,
|
174
176
|
self.object_id / 2,
|
175
|
-
self.current_sublinkage,
|
176
177
|
self.num_links
|
177
178
|
]
|
178
179
|
end
|
@@ -180,7 +181,7 @@ class LinkParser::Linkage
|
|
180
181
|
|
181
182
|
### Return the +index+th link.
|
182
183
|
def link( index )
|
183
|
-
Link.new(
|
184
|
+
Link.new(
|
184
185
|
self.words[ self.link_lword(index) ],
|
185
186
|
self.words[ self.link_rword(index) ],
|
186
187
|
self.link_length(index),
|
@@ -190,25 +191,38 @@ class LinkParser::Linkage
|
|
190
191
|
LINK_TYPES[ self.link_label(index).gsub(/[^A-Z]+/, '').to_sym ]
|
191
192
|
)
|
192
193
|
end
|
193
|
-
|
194
|
+
|
194
195
|
|
195
196
|
### Return the Array of words in the sentence as tokenized by the
|
196
197
|
### parser.
|
197
198
|
def links
|
198
|
-
( 0...self.link_count ).collect do |i|
|
199
|
+
return ( 0...self.link_count ).collect do |i|
|
199
200
|
self.link( i )
|
200
201
|
end
|
201
202
|
end
|
202
203
|
|
203
204
|
|
205
|
+
### Return an Array of parsed (well, just split on whitespace for now) disjunct strings
|
206
|
+
### for the linkage.
|
207
|
+
def disjuncts
|
208
|
+
return self.disjunct_strings.collect do |dstr|
|
209
|
+
if dstr.nil?
|
210
|
+
nil
|
211
|
+
else
|
212
|
+
dstr.split
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
|
204
218
|
### Return the verb word from the linkage.
|
205
219
|
def verb
|
206
220
|
if link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\*]*/ }
|
207
221
|
# $deferr.puts "Picking %s: LL of %p is %s" % [ link.lword, link, link.llabel ]
|
208
|
-
return link.lword.sub( /\.v
|
222
|
+
return link.lword.sub( /\.v(-d)?$/, '' )
|
209
223
|
elsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\*]*/ }
|
210
224
|
# $deferr.puts "Picking %s: RL of %p is %s" % [ link.rword, link, link.rlabel ]
|
211
|
-
return link.rword.sub( /\.v
|
225
|
+
return link.rword.sub( /\.v(-d)?$/, '' )
|
212
226
|
else
|
213
227
|
return nil
|
214
228
|
end
|
@@ -218,14 +232,26 @@ class LinkParser::Linkage
|
|
218
232
|
### Return the subject from the linkage.
|
219
233
|
def subject
|
220
234
|
link = self.links.find {|link| link.llabel[0] == ?S } or return nil
|
221
|
-
return link.lword.sub( /\.[np]
|
235
|
+
return link.lword.sub( /\.[np](?:-\w)?$/, '' )
|
222
236
|
end
|
223
|
-
|
237
|
+
|
224
238
|
|
225
239
|
### Return the object from the linkage.
|
226
240
|
def object
|
227
241
|
link = self.links.find {|link| link.rlabel[0] == ?O } or return nil
|
228
|
-
return link.rword.sub( /\.[np]
|
242
|
+
return link.rword.sub( /\.[np](?:-\w)?$/, '' )
|
243
|
+
end
|
244
|
+
|
245
|
+
|
246
|
+
### Return an Array of all the nouns in the linkage.
|
247
|
+
def nouns
|
248
|
+
nouns = []
|
249
|
+
self.links.each do |link|
|
250
|
+
nouns << $1 if link.lword =~ /^(.*)\.n(?:-\w)?$/
|
251
|
+
nouns << $1 if link.rword =~ /^(.*)\.n(?:-\w)?$/
|
252
|
+
end
|
253
|
+
|
254
|
+
return nouns.uniq
|
229
255
|
end
|
230
256
|
|
231
257
|
|
@@ -235,14 +261,6 @@ class LinkParser::Linkage
|
|
235
261
|
return self.links.find {|link| link.label == 'Wi' && link.rword =~ /\.v$/ } ?
|
236
262
|
true : false
|
237
263
|
end
|
238
|
-
|
239
|
-
|
240
|
-
### Returns +true+ if the linkage has more than one sublinkage (i.e., the
|
241
|
-
### sentence has a conjunction).
|
242
|
-
def has_conjunction?
|
243
|
-
return self.num_sublinkages > 1
|
244
|
-
end
|
245
|
-
|
246
264
|
|
247
265
|
end # class Sentence
|
248
266
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
module LinkParser
|
5
|
+
|
6
|
+
### Functions for marking methods as deprecated.
|
7
|
+
module DeprecationUtilities
|
8
|
+
|
9
|
+
# Hash of which warnings have already been output
|
10
|
+
$lp_deprecation_warnings = {}
|
11
|
+
|
12
|
+
### Make a wrapper for a deprecated method. The wrapper will print a deprecation warning
|
13
|
+
### to STDERR, and then call the method with the same name prefixed with an underscore.
|
14
|
+
### @param [Symbol, #to_sym] name the name of the method to deprecate.
|
15
|
+
def deprecated_method( *names )
|
16
|
+
names.each do |name|
|
17
|
+
method_body = lambda do |*args|
|
18
|
+
source = caller( 1 ).first
|
19
|
+
if $lp_deprecation_warnings.key?( source )
|
20
|
+
$lp_deprecation_warnings[ source ] += 1
|
21
|
+
else
|
22
|
+
$lp_deprecation_warnings[ source ] = 1
|
23
|
+
warn "Use of deprecated method %p from %s." % [ name, source ]
|
24
|
+
end
|
25
|
+
|
26
|
+
return self.method( "_#{name}" ).call( *args )
|
27
|
+
end
|
28
|
+
|
29
|
+
# Install the wrapper after aliasing away the old method
|
30
|
+
alias_method( "_#{name}", name )
|
31
|
+
remove_method( name )
|
32
|
+
define_method( name, &method_body )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end # module DeprecationUtilities
|
37
|
+
|
38
|
+
end # module LinkParser
|
data/lib/linkparser/sentence.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'linkparser'
|
4
|
+
|
2
5
|
#
|
3
6
|
# A Sentence is the API's representation of an input string, tokenized
|
4
7
|
# and interpreted according to a specific Dictionary. After a Sentence
|
@@ -9,46 +12,18 @@
|
|
9
12
|
#
|
10
13
|
# * Michael Granger <ged@FaerieMUD.org>
|
11
14
|
#
|
12
|
-
# == License
|
13
|
-
#
|
14
|
-
# Copyright (c) 2007, 2008 The FaerieMUD Consortium
|
15
|
-
#
|
16
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
17
|
-
# of this software and associated documentation files (the "Software"), to deal
|
18
|
-
# in the Software without restriction, including without limitation the rights
|
19
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
20
|
-
# copies of the Software, and to permit persons to whom the Software is
|
21
|
-
# furnished to do so, subject to the following conditions:
|
22
|
-
#
|
23
|
-
# The above copyright notice and this permission notice shall be included in
|
24
|
-
# all copies or substantial portions of the Software.
|
25
|
-
#
|
26
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
27
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
28
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
29
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
30
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
31
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
32
|
-
# THE SOFTWARE.
|
33
|
-
#
|
34
15
|
# == Version
|
35
16
|
#
|
36
|
-
# $Id
|
17
|
+
# $Id$
|
37
18
|
#
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
19
|
+
# == License
|
20
|
+
#
|
21
|
+
# :include: LICENSE
|
22
|
+
#--
|
23
|
+
#
|
24
|
+
# See the LICENSE file for copyright/licensing information.
|
42
25
|
class LinkParser::Sentence
|
43
26
|
|
44
|
-
# SVN Revision
|
45
|
-
SVNRev = %q$Rev: 53 $
|
46
|
-
|
47
|
-
# SVN Id
|
48
|
-
SVNId = %q$Id: sentence.rb 53 2009-06-03 12:52:13Z deveiant $
|
49
|
-
|
50
|
-
|
51
|
-
|
52
27
|
######
|
53
28
|
public
|
54
29
|
######
|
@@ -78,8 +53,8 @@ class LinkParser::Sentence
|
|
78
53
|
def to_s
|
79
54
|
return self.words.join(" ")
|
80
55
|
end
|
81
|
-
|
82
|
-
|
56
|
+
|
57
|
+
|
83
58
|
#########
|
84
59
|
protected
|
85
60
|
#########
|
@@ -88,7 +63,7 @@ class LinkParser::Sentence
|
|
88
63
|
def singleton_class
|
89
64
|
class << self; self; end
|
90
65
|
end
|
91
|
-
|
66
|
+
|
92
67
|
|
93
68
|
### Proxy method -- auto-delegate calls to the first linkage.
|
94
69
|
def method_missing( sym, *args )
|
@@ -99,10 +74,10 @@ class LinkParser::Sentence
|
|
99
74
|
LinkParser::Linkage.instance_methods.include?( sym )
|
100
75
|
|
101
76
|
linkage = self.linkages.first or raise LinkParser::Error, "sentence has no linkages"
|
102
|
-
|
77
|
+
|
103
78
|
meth = linkage.method( sym )
|
104
79
|
self.singleton_class.send( :define_method, sym, &meth )
|
105
|
-
|
80
|
+
|
106
81
|
meth.call( *args )
|
107
82
|
rescue => err
|
108
83
|
raise err, err.message, err.backtrace[ 0..-2 ]
|
data/rake/dependencies.rb
CHANGED
@@ -0,0 +1,123 @@
|
|
1
|
+
#
|
2
|
+
# Documentation Rake tasks
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
|
8
|
+
# Append docs/lib to the load path if it exists for documentation
|
9
|
+
# helpers.
|
10
|
+
DOCSLIB = DOCSDIR + 'lib'
|
11
|
+
$LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
|
12
|
+
|
13
|
+
# Make relative string paths of all the stuff we need to generate docs for
|
14
|
+
DOCFILES = Rake::FileList[ LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files ]
|
15
|
+
|
16
|
+
# Documentation coverage constants
|
17
|
+
COVERAGE_DIR = BASEDIR + 'coverage'
|
18
|
+
COVERAGE_REPORT = COVERAGE_DIR + 'documentation.txt'
|
19
|
+
|
20
|
+
|
21
|
+
# Prefer YARD, fallback to RDoc
|
22
|
+
begin
|
23
|
+
require 'yard'
|
24
|
+
require 'yard/rake/yardoc_task'
|
25
|
+
|
26
|
+
# Undo the lazy-assed monkeypatch yard/globals.rb installs and
|
27
|
+
# re-install them as mixins as they should have been from the
|
28
|
+
# start
|
29
|
+
# <metamonkeypatch>
|
30
|
+
class Object
|
31
|
+
remove_method :log
|
32
|
+
remove_method :P
|
33
|
+
end
|
34
|
+
|
35
|
+
module YardGlobals
|
36
|
+
def P(namespace, name = nil)
|
37
|
+
namespace, name = nil, namespace if name.nil?
|
38
|
+
YARD::Registry.resolve(namespace, name, false, true)
|
39
|
+
end
|
40
|
+
|
41
|
+
def log
|
42
|
+
YARD::Logger.instance
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class YARD::CLI::Base; include YardGlobals; end
|
47
|
+
class YARD::CLI::Command; include YardGlobals; end
|
48
|
+
class YARD::Parser::SourceParser; extend YardGlobals; include YardGlobals; end
|
49
|
+
class YARD::Parser::CParser; include YardGlobals; end
|
50
|
+
class YARD::CodeObjects::Base; include YardGlobals; end
|
51
|
+
class YARD::Handlers::Base; include YardGlobals; end
|
52
|
+
class YARD::Handlers::Processor; include YardGlobals; end
|
53
|
+
class YARD::Serializers::Base; include YardGlobals; end
|
54
|
+
class YARD::RegistryStore; include YardGlobals; end
|
55
|
+
class YARD::Docstring; include YardGlobals; end
|
56
|
+
module YARD::Templates::Helpers::ModuleHelper; include YardGlobals; end
|
57
|
+
module YARD::Templates::Helpers::HtmlHelper; include YardGlobals; end
|
58
|
+
|
59
|
+
if vvec(RUBY_VERSION) >= vvec("1.9.1")
|
60
|
+
# Monkeypatched to allow more than two '#' characters at the beginning
|
61
|
+
# of the comment line.
|
62
|
+
# Patched from yard-0.5.8
|
63
|
+
require 'yard/parser/ruby/ruby_parser'
|
64
|
+
class YARD::Parser::Ruby::RipperParser < Ripper
|
65
|
+
def on_comment(comment)
|
66
|
+
visit_ns_token(:comment, comment)
|
67
|
+
case comment
|
68
|
+
when /\A# @group\s+(.+)\s*\Z/
|
69
|
+
@groups.unshift [lineno, $1]
|
70
|
+
return
|
71
|
+
when /\A# @endgroup\s*\Z/
|
72
|
+
@groups.unshift [lineno, nil]
|
73
|
+
return
|
74
|
+
end
|
75
|
+
|
76
|
+
comment = comment.gsub(/^\#+\s{0,1}/, '').chomp
|
77
|
+
append_comment = @comments[lineno - 1]
|
78
|
+
|
79
|
+
if append_comment && @comments_last_column == column
|
80
|
+
@comments.delete(lineno - 1)
|
81
|
+
comment = append_comment + "\n" + comment
|
82
|
+
end
|
83
|
+
|
84
|
+
@comments[lineno] = comment
|
85
|
+
@comments_last_column = column
|
86
|
+
end
|
87
|
+
end # class YARD::Parser::Ruby::RipperParser
|
88
|
+
end
|
89
|
+
|
90
|
+
# </metamonkeypatch>
|
91
|
+
|
92
|
+
YARD_OPTIONS = [] unless defined?( YARD_OPTIONS )
|
93
|
+
|
94
|
+
yardoctask = YARD::Rake::YardocTask.new( :apidocs ) do |task|
|
95
|
+
task.files = DOCFILES
|
96
|
+
task.options = YARD_OPTIONS
|
97
|
+
task.options << '--debug' << '--verbose' if $trace
|
98
|
+
end
|
99
|
+
yardoctask.before = lambda {
|
100
|
+
trace "Calling yardoc like:",
|
101
|
+
" yardoc %s" % [ quotelist(yardoctask.options + yardoctask.files).join(' ') ]
|
102
|
+
}
|
103
|
+
|
104
|
+
YARDOC_CACHE = BASEDIR + '.yardoc'
|
105
|
+
CLOBBER.include( YARDOC_CACHE.to_s )
|
106
|
+
|
107
|
+
rescue LoadError
|
108
|
+
require 'rdoc/task'
|
109
|
+
|
110
|
+
desc "Build API documentation in #{API_DOCSDIR}"
|
111
|
+
RDoc::Task.new( :apidocs ) do |task|
|
112
|
+
task.main = "README"
|
113
|
+
task.rdoc_files.include( DOCFILES )
|
114
|
+
task.rdoc_dir = API_DOCSDIR.to_s
|
115
|
+
task.options = RDOC_OPTIONS
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Need the DOCFILES to exist to build the API docs
|
120
|
+
task :apidocs => DOCFILES
|
121
|
+
|
122
|
+
CLEAN.include( API_DOCSDIR.to_s )
|
123
|
+
|