Commits

Michael Granger committed 10f0010

* Updated build system.
* Fixed copyright years in the LICENSE file
* Cleanup of the wordnet integration source.

Comments (0)

Files changed (4)

-Copyright (c) 2008, Michael Granger
+Copyright (c) 2003-2008, Michael Granger
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 	$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
 }
 
+require 'rubygems'
+gem 'rake', '>= 0.8.3'
 
 require 'rbconfig'
-require 'rubygems'
 require 'rake'
 require 'rake/rdoctask'
 require 'rake/testtask'
 EXTDIR        = BASEDIR + 'ext'
 DOCSDIR       = BASEDIR + 'docs'
 PKGDIR        = BASEDIR + 'pkg'
+DATADIR       = BASEDIR + 'data'
 
 PROJECT_NAME  = 'Linguistics'
 PKG_NAME      = PROJECT_NAME.downcase
 PKG_SUMMARY   = 'a framework for building linguistic utilities for Ruby objects'
+
 VERSION_FILE  = LIBDIR + 'linguistics.rb'
-PKG_VERSION   = VERSION_FILE.read[ /VERSION = '(\d+\.\d+\.\d+)'/, 1 ]
+if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
+	PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
+elsif VERSION_FILE.exist?
+	PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
+else
+	PKG_VERSION = '0.0.0'
+end
+
 PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
 GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
 
+EXTCONF       = EXTDIR + 'extconf.rb'
+
 ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || 'artifacts' )
 
 TEXT_FILES    = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename }
 BIN_FILES     = Pathname.glob( BINDIR + '*' ).delete_if {|item| item =~ /\.svn/ }
 LIB_FILES     = Pathname.glob( LIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ }
 EXT_FILES     = Pathname.glob( EXTDIR + '**/*.{c,h,rb}' ).delete_if {|item| item =~ /\.svn/ }
+DATA_FILES    = Pathname.glob( DATADIR + '**/*' ).delete_if {|item| item =~ /\.svn/ }
 
 SPECDIR       = BASEDIR + 'spec'
 SPECLIBDIR    = SPECDIR + 'lib'
 	BIN_FILES +
 	LIB_FILES + 
 	EXT_FILES + 
+	DATA_FILES + 
 	RAKE_TASKLIBS +
 	EXTRA_PKGFILES
 
 	'-SHN',
 	'-i', '.',
 	'-m', 'README',
-	'-W', 'http://deveiate.org/projects/Linguistics//browser/trunk/'
+	'-t', PKG_NAME,
+	'-W', 'http://deveiate.org/projects/Linguistics/browser/trunk/'
   ]
 
 # Release constants
 SMTP_PORT = 465 # SMTP + SSL
 
 # Project constants
-PROJECT_HOST = 'deveiate.org'
-PROJECT_PUBDIR = "/usr/local/www/public/code"
+PROJECT_HOST = 'deveiate'
+PROJECT_PUBDIR = '/usr/local/www/public/code'
 PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
 PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
 PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
 	'tmail'       => '>= 1.2.3.1',
 	'ultraviolet' => '>= 0.10.2',
 	'libxml-ruby' => '>= 0.8.3',
-	'wordnet' => '>=1.0.5',
-	'linkparser' => '>=1.0.2',
+	'wordnet' => '>=0.0.5',
+	'linkparser' => '>=1.0.3',
 }
 
 # Non-gem requirements: packagename => version
 	gem.version           = PKG_VERSION
 
 	gem.summary           = PKG_SUMMARY
-	gem.description       = <<-EOD
-	in any language. It includes a generic language-independant front end, a
-	module for mapping language codes into language names, and a module which
-	contains various English-language utilities.
-	EOD
+	gem.description       = [
+		"in any language. It includes a generic language-independant front end, a",
+		"module for mapping language codes into language names, and a module which",
+		"contains various English-language utilities.",
+  	  ].join( "\n" )
 
 	gem.authors           = 'Michael Granger'
 	gem.email             = 'ged@FaerieMUD.org'
 
 	gem.has_rdoc          = true
 	gem.rdoc_options      = RDOC_OPTIONS
+	gem.extra_rdoc_files  = %w[ChangeLog README LICENSE]
 
 	gem.bindir            = BINDIR.relative_path_from(BASEDIR).to_s
-	
+	gem.executables       = BIN_FILES.select {|pn| pn.executable? }.
+		collect {|pn| pn.relative_path_from(BINDIR).to_s }
+
+	if EXTCONF.exist?
+		gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
+	end
 
 	gem.files             = RELEASE_FILES.
 		collect {|f| f.relative_path_from(BASEDIR).to_s }
 		gem.add_runtime_dependency( name, version )
 	end
 	
-	DEVELOPMENT_DEPENDENCIES.each do |name, version|
-		version = '>= 0' if version.length.zero?
-		gem.add_development_dependency( name, version )
+	# Developmental dependencies don't work as of RubyGems 1.2.0
+	unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" )
+		DEVELOPMENT_DEPENDENCIES.each do |name, version|
+			version = '>= 0' if version.length.zero?
+			gem.add_development_dependency( name, version )
+		end
 	end
 	
 	REQUIREMENTS.each do |name, version|
 
 ### Task: cruise (Cruisecontrol task)
 desc "Cruisecontrol build"
-task :cruise => [:clean, :spec, :package] do |task|
+task :cruise => [:clean, 'spec:quiet', :package] do |task|
 	raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
-	artifact_dir = ARTIFACTS_DIR.cleanpath
+	artifact_dir = ARTIFACTS_DIR.cleanpath + ENV['CC_BUILD_LABEL']
 	artifact_dir.mkpath
 	
 	coverage = BASEDIR + 'coverage'

lib/linguistics/en/wordnet.rb

 #!/usr/bin/ruby
-# 
+
+require 'linguistics/en'
+
 # This file contains functions for finding relations for English words. It
 # requires the Ruby-WordNet module to be installed; if it is not installed,
 # calling the functions defined by this file will raise NotImplemented
 # * Michael Granger <ged@FaerieMUD.org>
 # 
 # == Copyright
-#
-# Copyright (c) 2003 The FaerieMUD Consortium. All rights reserved.
 # 
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the terms of the Perl Artistic License. (See
-# http://language.perl.com/misc/Artistic.html)
+# :include: LICENSE
 # 
 # == Version
 #
 #  $Id$
 # 
-
 module Linguistics::EN
 
-	@has_wordnet		= false
+	@has_wordnet	= false
 	@wn_error		= nil
 	@wn_lexicon		= nil
 
 --- 
-rubyforge_project: linguistics
+project_pubdir: /usr/local/www/public/code
+project_pubhost: deveiate
+project_homepage: http://deveiate.org/projects/Linguistics/
+rubyforge_group: deveiate
 project_requirements: {}
 
+author_name: Michael Granger
 project_description: |-
   in any language. It includes a generic language-independant front end, a
   module for mapping language codes into language names, and a module which
   contains various English-language utilities.
-rubyforge_group: deveiate
-author_name: Michael Granger
-project_homepage: http://deveiate.org/projects/Linguistics/
 project_dependencies: {}
 
 project_summary: a framework for building linguistic utilities for Ruby objects
-project_name: Linguistics
 version_file: linguistics.rb
 additional_pkgfiles: 
 - examples/*.rb
 - README.english
 dev_dependencies: 
-  wordnet: ">=1.0.5"
-  linkparser: ">=1.0.2"
+  wordnet: ">=0.0.5"
+  linkparser: ">=1.0.3"
 author_email: ged@FaerieMUD.org
+post_install_message: ""
+project_name: Linguistics
+rubyforge_project: linguistics