linkparser 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ ## 1.1.1 [2010-12-30] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * Updated for link-grammar 4.7.1.
4
+ * Fixed some specs that were doing nothing, using old RSpec syntax, etc.
5
+ * Converted to Hoe.
6
+
7
+
8
+ ## 1.1.0 [2010-11-30] Michael Granger <ged@FaerieMUD.org>
9
+
10
+ * Updated to support link-grammar 4.7.0. Note that this breaks compatibility with
11
+ earlier versions, as the model for sentences with conjunctions has changed
12
+ significantly.
13
+ * Use pkgconfig if available.
14
+ * Various memory-management and 1.9.2 fixes.
15
+
16
+
17
+
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2010, The FaerieMUD Consortium
1
+ Copyright (c) 2006-2011, The FaerieMUD Consortium
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,95 +1,107 @@
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/)
1
+ # linkparser
2
+
3
+ * http://deveiate.org/projects/Ruby-LinkParser
4
+
5
+ ## Description
6
+
7
+ This module is a Ruby binding for [the Abiword version][abiword] of CMU's
8
+ [Link Grammar][link-grammar], a syntactic parser of English.
9
+
10
+
11
+ ### Example Usage
12
+
13
+ require 'linkparser'
14
+
15
+ dict = LinkParser::Dictionary.new( :screen_width => 100 )
16
+ sent = dict.parse( "People use Ruby for all kinds of nifty things." )
17
+ # => #<LinkParser::Sentence:0xcf8eb "LEFT-WALL people use Ruby for all kinds
18
+ # of nifty things . RIGHT-WALL"/2 linkages/0 nulls>
19
+
20
+ sent.subject # => "people"
21
+ sent.verb # => "use"
22
+ sent.object # => "Ruby"
23
+
24
+ puts sent.constituent_tree_string
25
+ # =>
26
+ # (S (NP People)
27
+ # (VP use
28
+ # (NP Ruby)
29
+ # (PP for
30
+ # (NP (NP all kinds)
31
+ # (PP of
32
+ # (NP nifty things)))))
33
+ # .)
34
+
35
+ puts sent.diagram
36
+ # =>
37
+ # +-------------------------------Xp------------------------------+
38
+ # | +----MVp---+----Jp----+ +------Jp-----+ |
39
+ # +----Wd---+--Sp--+--Os-+ | +-Dmc-+--Mp-+ +----A---+ |
40
+ # | | | | | | | | | | |
41
+ # LEFT-WALL people.p use.v Ruby for.p all kinds.n of nifty.a things.n .
17
42
 
18
43
 
19
44
  ## Installation
20
45
 
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.
46
+ First, download and install the latest version of the link-grammar
47
+ library from [Abiword's site][abiword-dl].
48
+
49
+ Then install the gem:
25
50
 
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):
51
+ gem install linkparser
28
52
 
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 ..
53
+ You may need to specify the path to the link-grammar library if you
54
+ installed it somewhere that your linker doesn't look by default:
33
55
 
34
- Now build, test, and install the Ruby library:
56
+ gem install linkparser -- --with-link-grammar=/usr/local
35
57
 
36
- $ rake
37
- $ sudo rake install
38
58
 
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:
59
+ ## Contributing
41
60
 
42
- $ rake -- --with-link-grammar-dir=/usr/local
61
+ You can check out the current development source [with Mercurial][hg-repo],
62
+ or if you prefer Git, via [its Github mirror][github-mirror].
43
63
 
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:
64
+ After checking out the source, run:
47
65
 
48
- $ ARCHFLAGS="-arch i386" rake -- --with-link-grammar-dir=/usr/local
66
+ $ rake newb
49
67
 
50
- That's it!
68
+ This task will install any missing dependencies, run the tests/specs,
69
+ and generate the API documentation.
51
70
 
52
71
 
53
- ## Example Usage
72
+ ## License
54
73
 
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 .
74
+ Copyright (c) 2006-2011, The FaerieMUD Consortium
75
+ All rights reserved.
84
76
 
77
+ Redistribution and use in source and binary forms, with or without
78
+ modification, are permitted provided that the following conditions are met:
85
79
 
86
- ## Legal
80
+ * Redistributions of source code must retain the above copyright notice,
81
+ this list of conditions and the following disclaimer.
87
82
 
88
- For licensing information, see the LICENSE file.
83
+ * Redistributions in binary form must reproduce the above copyright notice,
84
+ this list of conditions and the following disclaimer in the documentation
85
+ and/or other materials provided with the distribution.
89
86
 
90
- For copyright and licensing information for link-grammar itself, see the
91
- LICENSE file in that distribution.
87
+ * Neither the name of the author/s, nor the names of the project's
88
+ contributors may be used to endorse or promote products derived from this
89
+ software without specific prior written permission.
92
90
 
93
- $Id$
91
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
92
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
94
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
95
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
96
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
97
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
98
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
99
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
100
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94
101
 
95
102
 
103
+ [abiword]:http://www.abisource.com/projects/link-grammar/
104
+ [link-grammar]:http://www.link.cs.cmu.edu/link/ "Link Grammar"
105
+ [abiword-dl]:http://www.abisource.com/projects/link-grammar/#download
106
+ [hg-repo]:http://repo.deveiate.org/LinkParser
107
+ [github-mirror]:http://github.com/ged/linkparser
data/Rakefile CHANGED
@@ -1,364 +1,94 @@
1
- #!rake -*- ruby -*-
2
- #
3
- # LinkParser rakefile
4
- #
5
- # Based on various other Rakefiles, especially one by Ben Bleything
6
- #
7
- # Copyright (c) 2007-2010 The FaerieMUD Consortium
8
- #
9
- # Authors:
10
- # * Michael Granger <ged@FaerieMUD.org>
11
- #
1
+ #!/usr/bin/env rake
12
2
 
13
- BEGIN {
14
- require 'rbconfig'
15
- require 'pathname'
16
- basedir = Pathname.new( __FILE__ ).dirname
17
-
18
- libdir = basedir + "lib"
19
- extdir = libdir + Config::CONFIG['sitearch']
20
-
21
- $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
22
- $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
23
- $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
24
- }
3
+ require 'rbconfig'
4
+ require 'pathname'
25
5
 
26
6
  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
7
+ require 'hoe'
8
+ rescue LoadError => err
9
+ abort "This Rakefile requires 'hoe' (gem install hoe)."
35
10
  end
36
11
 
37
12
  begin
38
- require 'rubygems'
39
- rescue LoadError
40
- module Gem
41
- class Specification; end
42
- end
43
- end
44
-
45
- require 'pathname'
46
- require 'rbconfig'
47
- require 'rake'
48
- require 'rake/testtask'
49
- require 'rake/packagetask'
50
- require 'rake/clean'
51
- # require 'rake/191_compat.rb'
52
-
53
- $dryrun = false
54
-
55
- ### Config constants
56
- BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
57
- BINDIR = BASEDIR + 'bin'
58
- LIBDIR = BASEDIR + 'lib'
59
- EXTDIR = BASEDIR + 'ext'
60
- DOCSDIR = BASEDIR + 'docs'
61
- PKGDIR = BASEDIR + 'pkg'
62
- DATADIR = BASEDIR + 'data'
63
-
64
- MANUALDIR = DOCSDIR + 'manual'
65
-
66
- PROJECT_NAME = 'LinkParser'
67
- PKG_NAME = PROJECT_NAME.downcase
68
- PKG_SUMMARY = 'a Ruby binding for the link-grammar library'
69
-
70
- # Cruisecontrol stuff
71
- CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
72
- CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
73
-
74
- VERSION_FILE = LIBDIR + 'linkparser.rb'
75
- if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
76
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
77
- elsif VERSION_FILE.exist?
78
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
13
+ require 'rake/extensiontask'
14
+ rescue LoadError => err
15
+ abort "This Rakefile requires 'rake-compiler' (gem install rake-compiler)"
79
16
  end
80
17
 
81
- PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
82
-
83
- PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
84
- GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
85
-
86
- # Universal VCS constants
87
- DEFAULT_EDITOR = 'vi'
88
- COMMIT_MSG_FILE = 'commit-msg.txt'
89
- FILE_INDENT = " " * 12
90
- LOG_INDENT = " " * 3
18
+ # Build constants
19
+ BASEDIR = Pathname( __FILE__ ).dirname
20
+ SPECDIR = BASEDIR + 'spec'
21
+ EXTDIR = BASEDIR + 'ext'
22
+ LIBDIR = BASEDIR + 'lib'
91
23
 
92
- EXTCONF = EXTDIR + 'extconf.rb'
24
+ DLEXT = Config::CONFIG['DLEXT']
93
25
 
94
- ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
26
+ EXTCONF = EXTDIR + 'extconf.rb'
27
+ EXT = LIBDIR + "linkparser_ext.#{DLEXT}"
95
28
 
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}/**/*" )
29
+ # Hoe plugins
30
+ Hoe.plugin :mercurial
31
+ Hoe.plugin :signing
101
32
 
102
- SPECDIR = BASEDIR + 'spec'
103
- SPECLIBDIR = SPECDIR + 'lib'
104
- SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
33
+ Hoe.plugins.delete :rubyforge
105
34
 
106
- TESTDIR = BASEDIR + 'tests'
107
- TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
35
+ # Main gem configuration
36
+ hoespec = Hoe.spec 'linkparser' do
37
+ self.readme_file = 'README.md'
38
+ self.history_file = 'History.md'
108
39
 
109
- RAKE_TASKDIR = BASEDIR + 'rake'
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?
40
+ self.developer 'Michael Granger', 'ged@FaerieMUD.org'
41
+ self.developer 'Martin Chase', 'stillflame@FaerieMUD.org'
113
42
 
114
- RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
43
+ self.extra_deps.push *{
44
+ 'rake-compiler' => '~> 0.7',
45
+ }
46
+ self.extra_dev_deps.push *{
47
+ 'rspec' => '~> 2.4',
48
+ }
115
49
 
116
- LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
50
+ self.spec_extras[:licenses] = ["BSD"]
51
+ self.spec_extras[:extensions] = [ EXTCONF.to_s ]
117
52
 
118
- EXTRA_PKGFILES = Rake::FileList.new
53
+ self.require_ruby_version( '>=1.8.7' )
119
54
 
120
- RELEASE_FILES = TEXT_FILES +
121
- SPEC_FILES +
122
- TEST_FILES +
123
- BIN_FILES +
124
- LIB_FILES +
125
- EXT_FILES +
126
- DATA_FILES +
127
- RAKE_TASKLIBS +
128
- EXTRA_PKGFILES
129
-
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
- ]
136
-
137
- COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
138
- RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
139
- RCOV_OPTS = [
140
- '--exclude', RCOV_EXCLUDES,
141
- '--xrefs',
142
- '--save',
143
- '--callsites',
144
- #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
145
- ]
146
-
147
-
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
164
-
165
- RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
55
+ self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
56
+ self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
166
57
  end
167
58
 
168
- require RAKE_TASKDIR + 'helpers.rb'
169
- include RakefileHelpers
170
-
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'
59
+ ENV['VERSION'] ||= hoespec.spec.version.to_s
60
+
61
+ # Running the tests depends on compilation
62
+ # Need to (re)compile before running specs
63
+ task :spec => :compile
64
+
65
+ # gem-testers support
66
+ task :test do
67
+ # rake-compiler always wants to copy the compiled extension into lib/, but
68
+ # we don't want testers to have to re-compile, especially since that
69
+ # often fails because they can't (and shouldn't have to) write to tmp/ in
70
+ # the installed gem dir. So we clear the task rake-compiler set up
71
+ # to break the dependency between :spec and :compile when running under
72
+ # rubygems-test, and then run :spec.
73
+ Rake::Task[ EXT.to_s ].clear
74
+ Rake::Task[ :spec ].execute
177
75
  end
178
- SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
179
- SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
180
-
181
- # Documentation constants
182
- API_DOCSDIR = DOCSDIR + 'api'
183
- README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
184
- RDOC_OPTIONS = [
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}",
199
- ]
200
-
201
- # Release constants
202
- SMTP_HOST = "mail.faeriemud.org"
203
- SMTP_PORT = 465 # SMTP + SSL
204
-
205
- # Project constants
206
- PROJECT_HOST = 'deveiate.org'
207
- PROJECT_PUBDIR = '/usr/local/www/public/code'
208
- PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
209
- PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
210
- PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
211
-
212
- GEM_PUBHOST = 'rubygems.org'
213
-
214
- # Gem dependencies: gemname => version
215
- DEPENDENCIES = {
216
- }
217
-
218
- # Developer Gem dependencies: gemname => version
219
- DEVELOPMENT_DEPENDENCIES = {
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',
230
- }
231
76
 
232
- # Non-gem requirements: packagename => version
233
- REQUIREMENTS = {
234
- 'link-grammar' => '>= 4.7.0',
235
- }
236
-
237
- # RubyGem specification
238
- GEMSPEC = Gem::Specification.new do |gem|
239
- gem.name = PKG_NAME.downcase
240
- gem.version = PKG_VERSION
241
-
242
- gem.summary = PKG_SUMMARY
243
- gem.description = [
244
- "A Ruby binding for the link-grammar library, a syntactic parser",
245
- "of English. See http://www.link.cs.cmu.edu/link/ for more",
246
- "information about the Link Grammar, and",
247
- "http://www.abisource.org/projects/link-grammar/ for information",
248
- "about the link-grammar library.",
249
- ].join( "\n" )
250
-
251
- gem.authors = ["Martin Chase", "Michael Granger"]
252
- gem.email = ["stillflame@FaerieMUD.org", "ged@FaerieMUD.org"]
253
- gem.homepage = 'http://deveiate.org/projects/Ruby-LinkParser/'
254
- gem.licenses = ["BSD"]
255
-
256
- gem.has_rdoc = true
257
- gem.rdoc_options = RDOC_OPTIONS
258
- gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
259
-
260
- gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
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?
264
-
265
- if EXTCONF.exist?
266
- gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
267
- end
268
-
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
-
279
- DEPENDENCIES.each do |name, version|
280
- version = '>= 0' if version.length.zero?
281
- gem.add_runtime_dependency( name, version )
282
- end
283
-
284
- REQUIREMENTS.each do |name, version|
285
- gem.requirements << [ name, version ].compact.join(' ')
286
- end
287
- end
288
-
289
- $trace = Rake.application.options.trace ? true : false
290
- $dryrun = Rake.application.options.dryrun ? true : false
291
- $include_dev_dependencies = false
292
-
293
- # Load any remaining task libraries
294
- RAKE_TASKLIBS.each do |tasklib|
295
- next if tasklib.to_s =~ %r{/helpers\.rb$}
296
- begin
297
- trace " loading tasklib %s" % [ tasklib ]
298
- import tasklib
299
- rescue ScriptError => err
300
- fail "Task library '%s' failed to load: %s: %s" %
301
- [ tasklib, err.class.name, err.message ]
302
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
303
- rescue => err
304
- log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
305
- [ tasklib, err.class.name, err.message ]
306
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
307
- end
77
+ desc "Turn on warnings and debugging in the build."
78
+ task :maint do
79
+ ENV['MAINTAINER_MODE'] = 'yes'
308
80
  end
309
81
 
310
- # Load any project-specific rules defined in 'Rakefile.local' if it exists
311
- import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
312
-
313
-
314
- #####################################################################
315
- ### T A S K S
316
- #####################################################################
317
-
318
- ### Default task
319
- task :default => [:clean, :local, :spec, :apidocs, :package]
320
-
321
- ### Task the local Rakefile can append to -- no-op by default
322
- task :local
323
-
324
- ### Task: clean
325
- CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
326
- CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
327
-
328
- ### Task: changelog
329
- file 'ChangeLog' do |task|
330
- log "Updating #{task.name}"
331
-
332
- changelog = make_changelog()
333
- File.open( task.name, 'w' ) do |fh|
334
- fh.print( changelog )
335
- end
336
- end
337
-
338
-
339
- ### Task: cruise (Cruisecontrol task)
340
- desc "Cruisecontrol build"
341
- task :cruise => [:clean, 'spec:quiet', :package] do |task|
342
- raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
343
- artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
344
- artifact_dir.mkpath
345
-
346
- coverage = BASEDIR + 'coverage'
347
- if coverage.exist? && coverage.directory?
348
- $stderr.puts "Copying coverage stats..."
349
- FileUtils.cp_r( 'coverage', artifact_dir )
350
- end
351
-
352
- $stderr.puts "Copying packages..."
353
- FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
354
- end
355
-
356
-
357
- desc "Update the build system to the latest version"
358
- task :update_build do
359
- log "Updating the build system"
360
- run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
361
- log "Updating the Rakefile"
362
- sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
82
+ ENV['RUBY_CC_VERSION'] = '1.8.7:1.9.2'
83
+
84
+ # Rake-compiler task
85
+ Rake::ExtensionTask.new do |ext|
86
+ ext.gem_spec = hoespec.spec
87
+ ext.name = 'linkparser_ext'
88
+ ext.ext_dir = 'ext'
89
+ ext.lib_dir = 'lib'
90
+ ext.source_pattern = "*.{c,h}"
91
+ ext.cross_compile = true
92
+ ext.cross_platform = %w[i386-mswin32 i386-mingw32]
363
93
  end
364
94