linkparser 1.0.4 → 1.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.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/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Ruby-LinkParser
|
2
|
+
|
3
|
+
This module is a Ruby binding for the link-grammar library, a syntactic parser
|
4
|
+
of English.
|
5
|
+
|
6
|
+
## Authors
|
7
|
+
|
8
|
+
* Michael Granger <ged@FaerieMUD.org>
|
9
|
+
* Martin Chase <stillflame@FaerieMUD.org>
|
10
|
+
|
11
|
+
|
12
|
+
## Requirements
|
13
|
+
|
14
|
+
* Ruby 1.8.7 or 1.9.2
|
15
|
+
* link-grammar (version 4.7.0 or later) from the AbiWord project
|
16
|
+
(http://www.abisource.com/projects/link-grammar/)
|
17
|
+
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
These instructions assume a UNIX or UNIX-like environment. I've built it on
|
22
|
+
MacOS X, FreeBSD, and Ubuntu Linux. I'm not sure how to get this to build
|
23
|
+
under Windows, as I don't have a Windows license with which to test it.
|
24
|
+
Suggestions welcomed.
|
25
|
+
|
26
|
+
First, you'll need to install the Abiword link-grammar library that comes with
|
27
|
+
this source (or download it yourself if you wish):
|
28
|
+
|
29
|
+
$ tar -xvzf link-grammar-4.6.5.tar.gz
|
30
|
+
$ cd link-grammar-4.6.5
|
31
|
+
$ ./configure; make; sudo make install
|
32
|
+
$ cd ..
|
33
|
+
|
34
|
+
Now build, test, and install the Ruby library:
|
35
|
+
|
36
|
+
$ rake
|
37
|
+
$ sudo rake install
|
38
|
+
|
39
|
+
If you've installed the link-grammar library someplace that isn't in your
|
40
|
+
regular include path, you might have to tell the build system where to look:
|
41
|
+
|
42
|
+
$ rake -- --with-link-grammar-dir=/usr/local
|
43
|
+
|
44
|
+
Under MacOS X, unless you've taken extra steps to compile the link-grammar
|
45
|
+
library as a universal binary, you'll probably also have to limit it to
|
46
|
+
your machine's architecture:
|
47
|
+
|
48
|
+
$ ARCHFLAGS="-arch i386" rake -- --with-link-grammar-dir=/usr/local
|
49
|
+
|
50
|
+
That's it!
|
51
|
+
|
52
|
+
|
53
|
+
## Example Usage
|
54
|
+
|
55
|
+
require 'linkparser'
|
56
|
+
|
57
|
+
dict = LinkParser::Dictionary.new( :screen_width => 100 )
|
58
|
+
sent = dict.parse( "People use Ruby for all kinds of nifty things." )
|
59
|
+
# => #<LinkParser::Sentence:0xcf8eb "LEFT-WALL people use Ruby for all kinds
|
60
|
+
# of nifty things . RIGHT-WALL"/2 linkages/0 nulls>
|
61
|
+
|
62
|
+
sent.subject # => "people"
|
63
|
+
sent.verb # => "use"
|
64
|
+
sent.object # => "Ruby"
|
65
|
+
|
66
|
+
puts sent.constituent_tree_string
|
67
|
+
# =>
|
68
|
+
# (S (NP People)
|
69
|
+
# (VP use
|
70
|
+
# (NP Ruby)
|
71
|
+
# (PP for
|
72
|
+
# (NP (NP all kinds)
|
73
|
+
# (PP of
|
74
|
+
# (NP nifty things)))))
|
75
|
+
# .)
|
76
|
+
|
77
|
+
puts sent.diagram
|
78
|
+
# =>
|
79
|
+
# +-------------------------------Xp------------------------------+
|
80
|
+
# | +----MVp---+----Jp----+ +------Jp-----+ |
|
81
|
+
# +----Wd---+--Sp--+--Os-+ | +-Dmc-+--Mp-+ +----A---+ |
|
82
|
+
# | | | | | | | | | | |
|
83
|
+
# LEFT-WALL people.p use.v Ruby for.p all kinds.n of nifty.a things.n .
|
84
|
+
|
85
|
+
|
86
|
+
## Legal
|
87
|
+
|
88
|
+
For licensing information, see the LICENSE file.
|
89
|
+
|
90
|
+
For copyright and licensing information for link-grammar itself, see the
|
91
|
+
LICENSE file in that distribution.
|
92
|
+
|
93
|
+
$Id$
|
94
|
+
|
95
|
+
|
data/Rakefile
CHANGED
@@ -1,33 +1,54 @@
|
|
1
|
-
#!rake
|
1
|
+
#!rake -*- ruby -*-
|
2
2
|
#
|
3
3
|
# LinkParser rakefile
|
4
4
|
#
|
5
5
|
# Based on various other Rakefiles, especially one by Ben Bleything
|
6
6
|
#
|
7
|
-
# Copyright (c) 2007-
|
7
|
+
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
8
8
|
#
|
9
9
|
# Authors:
|
10
10
|
# * Michael Granger <ged@FaerieMUD.org>
|
11
11
|
#
|
12
12
|
|
13
13
|
BEGIN {
|
14
|
+
require 'rbconfig'
|
14
15
|
require 'pathname'
|
15
16
|
basedir = Pathname.new( __FILE__ ).dirname
|
16
17
|
|
17
18
|
libdir = basedir + "lib"
|
18
|
-
extdir =
|
19
|
+
extdir = libdir + Config::CONFIG['sitearch']
|
19
20
|
|
21
|
+
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
20
22
|
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
21
23
|
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
22
24
|
}
|
23
25
|
|
26
|
+
begin
|
27
|
+
require 'readline'
|
28
|
+
include Readline
|
29
|
+
rescue LoadError
|
30
|
+
# Fall back to a plain prompt
|
31
|
+
def readline( text )
|
32
|
+
$stderr.print( text.chomp )
|
33
|
+
return $stdin.gets
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
require 'rubygems'
|
39
|
+
rescue LoadError
|
40
|
+
module Gem
|
41
|
+
class Specification; end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
require 'pathname'
|
24
46
|
require 'rbconfig'
|
25
47
|
require 'rake'
|
26
|
-
require 'rake/rdoctask'
|
27
48
|
require 'rake/testtask'
|
28
49
|
require 'rake/packagetask'
|
29
50
|
require 'rake/clean'
|
30
|
-
require 'rake/191_compat.rb'
|
51
|
+
# require 'rake/191_compat.rb'
|
31
52
|
|
32
53
|
$dryrun = false
|
33
54
|
|
@@ -40,46 +61,61 @@ DOCSDIR = BASEDIR + 'docs'
|
|
40
61
|
PKGDIR = BASEDIR + 'pkg'
|
41
62
|
DATADIR = BASEDIR + 'data'
|
42
63
|
|
64
|
+
MANUALDIR = DOCSDIR + 'manual'
|
65
|
+
|
43
66
|
PROJECT_NAME = 'LinkParser'
|
44
67
|
PKG_NAME = PROJECT_NAME.downcase
|
45
68
|
PKG_SUMMARY = 'a Ruby binding for the link-grammar library'
|
46
69
|
|
70
|
+
# Cruisecontrol stuff
|
71
|
+
CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
|
72
|
+
CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
|
73
|
+
|
47
74
|
VERSION_FILE = LIBDIR + 'linkparser.rb'
|
48
75
|
if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
|
49
76
|
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
|
50
77
|
elsif VERSION_FILE.exist?
|
51
78
|
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
52
|
-
else
|
53
|
-
PKG_VERSION = '0.0.0'
|
54
79
|
end
|
55
80
|
|
81
|
+
PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
|
82
|
+
|
56
83
|
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
57
84
|
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
58
85
|
|
86
|
+
# Universal VCS constants
|
87
|
+
DEFAULT_EDITOR = 'vi'
|
88
|
+
COMMIT_MSG_FILE = 'commit-msg.txt'
|
89
|
+
FILE_INDENT = " " * 12
|
90
|
+
LOG_INDENT = " " * 3
|
91
|
+
|
59
92
|
EXTCONF = EXTDIR + 'extconf.rb'
|
60
93
|
|
61
|
-
ARTIFACTS_DIR = Pathname.new(
|
94
|
+
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
62
95
|
|
63
|
-
TEXT_FILES = %w
|
64
|
-
BIN_FILES =
|
65
|
-
LIB_FILES =
|
66
|
-
EXT_FILES =
|
67
|
-
DATA_FILES =
|
96
|
+
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
|
97
|
+
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
98
|
+
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
99
|
+
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
100
|
+
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
|
68
101
|
|
69
102
|
SPECDIR = BASEDIR + 'spec'
|
70
103
|
SPECLIBDIR = SPECDIR + 'lib'
|
71
|
-
SPEC_FILES =
|
72
|
-
Pathname.glob( SPECLIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ }
|
104
|
+
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
73
105
|
|
74
106
|
TESTDIR = BASEDIR + 'tests'
|
75
|
-
TEST_FILES =
|
107
|
+
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
|
76
108
|
|
77
109
|
RAKE_TASKDIR = BASEDIR + 'rake'
|
78
|
-
RAKE_TASKLIBS =
|
110
|
+
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
111
|
+
PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
|
112
|
+
PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
|
113
|
+
|
114
|
+
RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
|
79
115
|
|
80
116
|
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
81
117
|
|
82
|
-
EXTRA_PKGFILES =
|
118
|
+
EXTRA_PKGFILES = Rake::FileList.new
|
83
119
|
|
84
120
|
RELEASE_FILES = TEXT_FILES +
|
85
121
|
SPEC_FILES +
|
@@ -91,7 +127,12 @@ RELEASE_FILES = TEXT_FILES +
|
|
91
127
|
RAKE_TASKLIBS +
|
92
128
|
EXTRA_PKGFILES
|
93
129
|
|
94
|
-
|
130
|
+
|
131
|
+
RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
|
132
|
+
|
133
|
+
RELEASE_ANNOUNCE_ADDRESSES = [
|
134
|
+
"Ruby-Talk List <ruby-talk@ruby-lang.org>",
|
135
|
+
]
|
95
136
|
|
96
137
|
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
97
138
|
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
@@ -104,39 +145,61 @@ RCOV_OPTS = [
|
|
104
145
|
]
|
105
146
|
|
106
147
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
148
|
+
### Load some task libraries that need to be loaded early
|
149
|
+
if !RAKE_TASKDIR.exist?
|
150
|
+
$stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
|
151
|
+
ans = readline( "for you? [y]" )
|
152
|
+
ans = 'y' if !ans.nil? && ans.empty?
|
153
|
+
|
154
|
+
if ans =~ /^y/i
|
155
|
+
$stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
|
156
|
+
system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
|
157
|
+
if ! $?.success?
|
158
|
+
fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
|
159
|
+
end
|
160
|
+
else
|
161
|
+
$stderr.puts "Then I'm afraid I can't continue. Best of luck."
|
162
|
+
fail "Rake tasklibs not present."
|
163
|
+
end
|
115
164
|
|
165
|
+
RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
|
166
|
+
end
|
116
167
|
|
117
|
-
### Load some task libraries that need to be loaded early
|
118
168
|
require RAKE_TASKDIR + 'helpers.rb'
|
119
|
-
|
120
|
-
require RAKE_TASKDIR + 'verifytask.rb'
|
169
|
+
include RakefileHelpers
|
121
170
|
|
122
|
-
#
|
123
|
-
|
171
|
+
# Set the build ID if the mercurial executable is available
|
172
|
+
if hg = which( 'hg' )
|
173
|
+
id = `#{hg} id -n`.chomp
|
174
|
+
PKG_BUILD = (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
|
175
|
+
else
|
176
|
+
PKG_BUILD = '0'
|
177
|
+
end
|
124
178
|
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
125
179
|
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
126
180
|
|
127
181
|
# Documentation constants
|
128
|
-
|
182
|
+
API_DOCSDIR = DOCSDIR + 'api'
|
183
|
+
README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
|
129
184
|
RDOC_OPTIONS = [
|
130
|
-
'-
|
131
|
-
'-
|
132
|
-
'
|
133
|
-
|
134
|
-
|
135
|
-
|
185
|
+
'--tab-width=4',
|
186
|
+
'--show-hash',
|
187
|
+
'--include', BASEDIR.to_s,
|
188
|
+
"--main=#{README_FILE}",
|
189
|
+
"--title=#{PKG_NAME}",
|
190
|
+
]
|
191
|
+
YARD_OPTIONS = [
|
192
|
+
'--use-cache',
|
193
|
+
'--protected',
|
194
|
+
'-r', README_FILE,
|
195
|
+
'--exclude', 'extconf\\.rb',
|
196
|
+
'--files', 'ChangeLog,LICENSE',
|
197
|
+
'--output-dir', API_DOCSDIR.to_s,
|
198
|
+
'--title', "#{PKG_NAME} #{PKG_VERSION}",
|
136
199
|
]
|
137
200
|
|
138
201
|
# Release constants
|
139
|
-
SMTP_HOST =
|
202
|
+
SMTP_HOST = "mail.faeriemud.org"
|
140
203
|
SMTP_PORT = 465 # SMTP + SSL
|
141
204
|
|
142
205
|
# Project constants
|
@@ -146,9 +209,7 @@ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
|
146
209
|
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
147
210
|
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
148
211
|
|
149
|
-
|
150
|
-
RUBYFORGE_GROUP = 'deveiate'
|
151
|
-
RUBYFORGE_PROJECT = 'linkparser'
|
212
|
+
GEM_PUBHOST = 'rubygems.org'
|
152
213
|
|
153
214
|
# Gem dependencies: gemname => version
|
154
215
|
DEPENDENCIES = {
|
@@ -156,23 +217,21 @@ DEPENDENCIES = {
|
|
156
217
|
|
157
218
|
# Developer Gem dependencies: gemname => version
|
158
219
|
DEVELOPMENT_DEPENDENCIES = {
|
159
|
-
'
|
160
|
-
'
|
161
|
-
'
|
162
|
-
'
|
163
|
-
'RedCloth'
|
164
|
-
'rspec'
|
165
|
-
'
|
166
|
-
'
|
167
|
-
'
|
168
|
-
'
|
169
|
-
'ultraviolet' => '>= 0.10.2',
|
170
|
-
'libxml-ruby' => '>= 0.8.3',
|
220
|
+
'rake' => '~> 0.8.7',
|
221
|
+
'rcodetools' => '~> 0.7.0.0',
|
222
|
+
'rcov' => '~> 0.8.1.2.0',
|
223
|
+
'yard' => '~> 0.6.1',
|
224
|
+
'RedCloth' => '~> 4.2.3',
|
225
|
+
'rspec' => '~> 2.0.1',
|
226
|
+
'ruby-termios' => '~> 0.9.6',
|
227
|
+
'text-format' => '~> 1.0.0',
|
228
|
+
'tmail' => '~> 1.2.3.1',
|
229
|
+
'rake-compiler' => '~> 0.7.1',
|
171
230
|
}
|
172
231
|
|
173
232
|
# Non-gem requirements: packagename => version
|
174
233
|
REQUIREMENTS = {
|
175
|
-
'link-grammar' => '>= 4.
|
234
|
+
'link-grammar' => '>= 4.7.0',
|
176
235
|
}
|
177
236
|
|
178
237
|
# RubyGem specification
|
@@ -189,59 +248,54 @@ GEMSPEC = Gem::Specification.new do |gem|
|
|
189
248
|
"about the link-grammar library.",
|
190
249
|
].join( "\n" )
|
191
250
|
|
192
|
-
gem.authors =
|
193
|
-
gem.email =
|
251
|
+
gem.authors = ["Martin Chase", "Michael Granger"]
|
252
|
+
gem.email = ["stillflame@FaerieMUD.org", "ged@FaerieMUD.org"]
|
194
253
|
gem.homepage = 'http://deveiate.org/projects/Ruby-LinkParser/'
|
195
|
-
gem.
|
254
|
+
gem.licenses = ["BSD"]
|
196
255
|
|
197
256
|
gem.has_rdoc = true
|
198
257
|
gem.rdoc_options = RDOC_OPTIONS
|
199
|
-
gem.extra_rdoc_files =
|
258
|
+
gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
|
200
259
|
|
201
260
|
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
202
|
-
gem.executables = BIN_FILES.select {|pn|
|
203
|
-
|
261
|
+
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
262
|
+
collect {|pn| File.basename(pn) }
|
263
|
+
gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
|
204
264
|
|
205
265
|
if EXTCONF.exist?
|
206
266
|
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
207
267
|
end
|
208
268
|
|
209
|
-
gem.files = RELEASE_FILES
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
269
|
+
gem.files = RELEASE_FILES
|
270
|
+
gem.test_files = SPEC_FILES
|
271
|
+
|
272
|
+
# signing key and certificate chain
|
273
|
+
gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
|
274
|
+
gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
|
275
|
+
|
276
|
+
|
277
|
+
gem.required_ruby_version = '>=1.8.7'
|
278
|
+
|
214
279
|
DEPENDENCIES.each do |name, version|
|
215
280
|
version = '>= 0' if version.length.zero?
|
216
281
|
gem.add_runtime_dependency( name, version )
|
217
282
|
end
|
218
|
-
|
219
|
-
# Developmental dependencies don't work as of RubyGems 1.2.0
|
220
|
-
unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" )
|
221
|
-
DEVELOPMENT_DEPENDENCIES.each do |name, version|
|
222
|
-
version = '>= 0' if version.length.zero?
|
223
|
-
gem.add_development_dependency( name, version )
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
283
|
+
|
227
284
|
REQUIREMENTS.each do |name, version|
|
228
285
|
gem.requirements << [ name, version ].compact.join(' ')
|
229
286
|
end
|
230
287
|
end
|
231
288
|
|
232
|
-
# Manual-generation config
|
233
|
-
MANUALDIR = DOCSDIR + 'manual'
|
234
|
-
|
235
289
|
$trace = Rake.application.options.trace ? true : false
|
236
290
|
$dryrun = Rake.application.options.dryrun ? true : false
|
237
|
-
|
291
|
+
$include_dev_dependencies = false
|
238
292
|
|
239
293
|
# Load any remaining task libraries
|
240
294
|
RAKE_TASKLIBS.each do |tasklib|
|
241
|
-
next if tasklib =~ %r{/
|
295
|
+
next if tasklib.to_s =~ %r{/helpers\.rb$}
|
242
296
|
begin
|
243
297
|
trace " loading tasklib %s" % [ tasklib ]
|
244
|
-
|
298
|
+
import tasklib
|
245
299
|
rescue ScriptError => err
|
246
300
|
fail "Task library '%s' failed to load: %s: %s" %
|
247
301
|
[ tasklib, err.class.name, err.message ]
|
@@ -262,24 +316,20 @@ import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
|
262
316
|
#####################################################################
|
263
317
|
|
264
318
|
### Default task
|
265
|
-
task :default => [:clean, :local, :spec, :
|
319
|
+
task :default => [:clean, :local, :spec, :apidocs, :package]
|
266
320
|
|
267
321
|
### Task the local Rakefile can append to -- no-op by default
|
268
322
|
task :local
|
269
323
|
|
270
|
-
|
271
324
|
### Task: clean
|
272
|
-
CLEAN.include 'coverage'
|
273
|
-
CLOBBER.include 'artifacts', 'coverage.info', PKGDIR
|
274
|
-
|
275
|
-
# Target to hinge on ChangeLog updates
|
276
|
-
file SVN_ENTRIES
|
325
|
+
CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
|
326
|
+
CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
|
277
327
|
|
278
328
|
### Task: changelog
|
279
|
-
file 'ChangeLog'
|
329
|
+
file 'ChangeLog' do |task|
|
280
330
|
log "Updating #{task.name}"
|
281
331
|
|
282
|
-
changelog =
|
332
|
+
changelog = make_changelog()
|
283
333
|
File.open( task.name, 'w' ) do |fh|
|
284
334
|
fh.print( changelog )
|
285
335
|
end
|
@@ -290,15 +340,15 @@ end
|
|
290
340
|
desc "Cruisecontrol build"
|
291
341
|
task :cruise => [:clean, 'spec:quiet', :package] do |task|
|
292
342
|
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
|
293
|
-
artifact_dir = ARTIFACTS_DIR.cleanpath +
|
343
|
+
artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
|
294
344
|
artifact_dir.mkpath
|
295
|
-
|
345
|
+
|
296
346
|
coverage = BASEDIR + 'coverage'
|
297
347
|
if coverage.exist? && coverage.directory?
|
298
348
|
$stderr.puts "Copying coverage stats..."
|
299
349
|
FileUtils.cp_r( 'coverage', artifact_dir )
|
300
350
|
end
|
301
|
-
|
351
|
+
|
302
352
|
$stderr.puts "Copying packages..."
|
303
353
|
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
|
304
354
|
end
|
@@ -307,7 +357,7 @@ end
|
|
307
357
|
desc "Update the build system to the latest version"
|
308
358
|
task :update_build do
|
309
359
|
log "Updating the build system"
|
310
|
-
|
360
|
+
run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
|
311
361
|
log "Updating the Rakefile"
|
312
362
|
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
|
313
363
|
end
|