Updated to new build system.

This commit is contained in:
Michael Granger 2008-09-05 23:58:48 +00:00
parent bcb0f14ed0
commit 0c8f66ac29
3 changed files with 269 additions and 109 deletions

44
LICENSE
View file

@ -1,29 +1,27 @@
Copyright (c) 2008, LAIKA, Inc. Copyright (c) 2008, LAIKA Information Systems
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are Redistribution and use in source and binary forms, with or without
permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice,
list of conditions and the following disclaimer. this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this * Redistributions in binary form must reproduce the above copyright notice,
list of conditions and the following disclaimer in the documentation and/or this list of conditions and the following disclaimer in the documentation
other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of LAIKA, nor the names of its contributors may be used to * Neither the name of the author/s, nor the names of the project's
endorse or promote products derived from this software without specific prior contributors may be used to endorse or promote products derived from this
written permission. software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

303
Rakefile
View file

@ -1,149 +1,290 @@
#!rake -*- ruby -*- #!rake
# #
# Ruby-Ezmlm rakefile # Ruby-Ezmlm rakefile
# #
# Based on Ben Bleything's Rakefile for Linen (URL?) # Based on various other Rakefiles, especially one by Ben Bleything
# #
# Copyright (c) 2007 LAIKA, Inc. # Copyright (c) 2008 The FaerieMUD Consortium
# #
# Mistakes: # Authors:
# * Michael Granger <mgranger@laika.com> # * LAIKA Information Systems <opensource@laika.com>
# #
BEGIN { BEGIN {
require 'pathname' require 'pathname'
basedir = Pathname.new( __FILE__ ).dirname basedir = Pathname.new( __FILE__ ).dirname
libdir = basedir + 'lib'
libdir = basedir + "lib"
extdir = basedir + "ext"
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s ) $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
} }
require 'rbconfig'
require 'rubygems' require 'rubygems'
require 'rake' require 'rake'
require 'tmpdir' require 'rake/rdoctask'
require 'pathname' require 'rake/testtask'
require 'rake/packagetask'
require 'rake/clean'
$dryrun = false $dryrun = false
# Pathname constants ### Config constants
BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd ) BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
BINDIR = BASEDIR + 'bin' BINDIR = BASEDIR + 'bin'
LIBDIR = BASEDIR + 'lib' LIBDIR = BASEDIR + 'lib'
EXTDIR = BASEDIR + 'ext'
DOCSDIR = BASEDIR + 'docs' DOCSDIR = BASEDIR + 'docs'
VARDIR = BASEDIR + 'var'
WWWDIR = VARDIR + 'www'
MANUALDIR = DOCSDIR + 'manual'
RDOCDIR = DOCSDIR + 'rdoc'
STATICWWWDIR = WWWDIR + 'static'
PKGDIR = BASEDIR + 'pkg' PKGDIR = BASEDIR + 'pkg'
ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || '' )
RAKE_TASKDIR = BASEDIR + 'rake'
TEXT_FILES = %w( Rakefile README LICENSE ). PROJECT_NAME = 'Ruby-Ezmlm'
collect {|filename| BASEDIR + filename } PKG_NAME = PROJECT_NAME.downcase
PKG_SUMMARY = 'A programmatic interface to ezmlm-idx lists'
VERSION_FILE = LIBDIR + 'ezmlm.rb'
PKG_VERSION = VERSION_FILE.read[ /VERSION = '(\d+\.\d+\.\d+)'/, 1 ]
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
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/ }
SPECDIR = BASEDIR + 'spec' SPECDIR = BASEDIR + 'spec'
SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ). SPECLIBDIR = SPECDIR + 'lib'
delete_if {|item| item =~ /\.svn/ } SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ).delete_if {|item| item =~ /\.svn/ } +
# Ideally, this should be automatically generated. Pathname.glob( SPECLIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ }
SPEC_EXCLUDES = 'spec,monkeypatches,/Library/Ruby,/var/lib,/usr/local/lib'
BIN_FILES = Pathname.glob( BINDIR + '*'). TESTDIR = BASEDIR + 'tests'
delete_if {|item| item =~ /\.svn/ } TEST_FILES = Pathname.glob( TESTDIR + '**/*.tests.rb' ).delete_if {|item| item =~ /\.svn/ }
LIB_FILES = Pathname.glob( LIBDIR + '**/*.rb').
delete_if {|item| item =~ /\.svn/ }
RELEASE_FILES = BIN_FILES + TEXT_FILES + LIB_FILES + SPEC_FILES RAKE_TASKDIR = BASEDIR + 'rake'
RAKE_TASKLIBS = Pathname.glob( RAKE_TASKDIR + '*.rb' )
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
EXTRA_PKGFILES = []
RELEASE_FILES = TEXT_FILES +
SPEC_FILES +
TEST_FILES +
BIN_FILES +
LIB_FILES +
EXT_FILES +
RAKE_TASKLIBS +
EXTRA_PKGFILES
RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
RCOV_OPTS = [
'--exclude', RCOV_EXCLUDES,
'--xrefs',
'--save',
'--callsites',
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
]
# Subversion constants -- directory names for releases and tags
SVN_TRUNK_DIR = 'trunk'
SVN_RELEASES_DIR = 'releases'
SVN_BRANCHES_DIR = 'branches'
SVN_TAGS_DIR = 'tags'
SVN_DOTDIR = BASEDIR + '.svn'
SVN_ENTRIES = SVN_DOTDIR + 'entries'
### Load some task libraries that need to be loaded early
require RAKE_TASKDIR + 'helpers.rb' require RAKE_TASKDIR + 'helpers.rb'
### Package constants
PKG_NAME = 'ruby-ezmlm'
PKG_VERSION_FROM = LIBDIR + 'ezmlm.rb'
PKG_VERSION = find_pattern_in_file( /VERSION = '(\d+\.\d+\.\d+)'/, PKG_VERSION_FROM ).first
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
RELEASE_NAME = "REL #{PKG_VERSION}"
require RAKE_TASKDIR + 'svn.rb' require RAKE_TASKDIR + 'svn.rb'
require RAKE_TASKDIR + 'verifytask.rb' require RAKE_TASKDIR + 'verifytask.rb'
if Rake.application.options.trace # Define some constants that depend on the 'svn' tasklib
$trace = true PKG_BUILD = get_svn_rev( BASEDIR ) || 0
log "$trace is enabled" SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
end SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
if Rake.application.options.dryrun # Documentation constants
$dryrun = true RDOCDIR = DOCSDIR + 'api'
log "$dryrun is enabled" RDOC_OPTIONS = [
Rake.application.options.dryrun = false '-w', '4',
end '-SHN',
'-i', '.',
'-m', 'README',
'-W', 'http://opensource.laika.com/wiki/ruby-ezmlm/browser/trunk/'
]
### Project Gemspec # Release constants
GEMSPEC = Gem::Specification.new do |gem| SMTP_HOST = 'mail.faeriemud.org'
pkg_build = get_svn_rev( BASEDIR ) || 0 SMTP_PORT = 465 # SMTP + SSL
gem.name = PKG_NAME # Project constants
gem.version = "%s.%s" % [ PKG_VERSION, pkg_build ] PROJECT_HOST = 'deveiate.org'
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}"
gem.summary = "A Ruby programmatic interface to ezmlm-idx" # Rubyforge stuff
gem.description = "Ruby-Ezmlm is a Ruby programmatic interface to ezmlm-idx " + RUBYFORGE_GROUP = 'laika'
"mailing lists, message archives, and command-line tools." RUBYFORGE_PROJECT = 'ezmlm'
gem.authors = "Michael Granger, Jeremiah Jordan" # Gem dependencies: gemname => version
gem.email = "opensource@laika.com" DEPENDENCIES = {
gem.homepage = "http://opensource.laika.com/wiki/ruby-ezmlm" 'tmail' => '>=1.2.3.1',
}
gem.rubyforge_project = 'laika' # Developer Gem dependencies: gemname => version
DEVELOPMENT_DEPENDENCIES = {
'amatch' => '>= 0.2.3',
'rake' => '>= 0.8.1',
'rcodetools' => '>= 0.7.0.0',
'rcov' => '>= 0',
'RedCloth' => '>= 4.0.3',
'rspec' => '>= 0',
'rubyforge' => '>= 0',
'termios' => '>= 0',
'text-format' => '>= 1.0.0',
'tmail' => '>= 1.2.3.1',
'ultraviolet' => '>= 0.10.2',
'libxml-ruby' => '>= 0.8.3',
}
gem.has_rdoc = true # Non-gem requirements: packagename => version
REQUIREMENTS = {
'ezmlm-idx' => '>=0',
}
gem.files = RELEASE_FILES. # RubyGem specification
GEMSPEC = Gem::Specification.new do |gem|
gem.name = PKG_NAME.downcase
gem.version = PKG_VERSION
gem.summary = PKG_SUMMARY
gem.description = <<-EOD
Ruby-Ezmlm provides a programmatic interface to ezmlm-idx lists, their archives, and the command
line utilities that interact with them. The library is intended to provide two sets of
functionality: the management and setup of lists, and programmatic access to the message archive.
EOD
gem.authors = 'LAIKA Information Systems'
gem.email = 'opensource@laika.com'
gem.homepage = 'http://opensource.laika.com/wiki/ruby-ezmlm'
gem.rubyforge_project = RUBYFORGE_PROJECT
gem.has_rdoc = true
gem.rdoc_options = RDOC_OPTIONS
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
gem.files = RELEASE_FILES.
collect {|f| f.relative_path_from(BASEDIR).to_s } collect {|f| f.relative_path_from(BASEDIR).to_s }
gem.test_files = SPEC_FILES. gem.test_files = SPEC_FILES.
collect {|f| f.relative_path_from(BASEDIR).to_s } collect {|f| f.relative_path_from(BASEDIR).to_s }
gem.add_dependency( 'tmail', '>= 1.2.3.1' ) DEPENDENCIES.each do |name, version|
version = '>= 0' if version.length.zero?
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 )
end
REQUIREMENTS.each do |name, version|
gem.requirements << [ name, version ].compact.join(' ')
end
end end
# Manual-generation config
MANUALDIR = DOCSDIR + 'manual'
# Load task plugins $trace = Rake.application.options.trace ? true : false
Pathname.glob( RAKE_TASKDIR + '*.rb' ).each do |tasklib| $dryrun = Rake.application.options.dryrun ? true : false
trace "Loading task lib #{tasklib}"
require tasklib
# Load any remaining task libraries
RAKE_TASKLIBS.each do |tasklib|
next if tasklib =~ %r{/(helpers|svn|verifytask)\.rb$}
begin
require tasklib
rescue ScriptError => err
fail "Task library '%s' failed to load: %s: %s" %
[ tasklib, err.class.name, err.message ]
trace "Backtrace: \n " + err.backtrace.join( "\n " )
rescue => err
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
[ tasklib, err.class.name, err.message ]
trace "Backtrace: \n " + err.backtrace.join( "\n " )
end
end end
# Load any project-specific rules defined in 'Rakefile.local' if it exists
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
#####################################################################
### T A S K S
#####################################################################
### Default task ### Default task
task :default => [:clean, :spec, 'coverage:verify', :package] task :default => [:clean, :local, :spec, :rdoc, :package]
### Task the local Rakefile can append to -- no-op by default
task :local
### Task: clean ### Task: clean
desc "Clean pkg, coverage, and rdoc; remove .bak files" CLEAN.include 'coverage'
task :clean => [ :clobber_rdoc, :clobber_package, :clobber_coverage ] do CLOBBER.include 'artifacts', 'coverage.info', PKGDIR
files = FileList['**/*.bak']
files.clear_exclude # Target to hinge on ChangeLog updates
File.rm( files ) unless files.empty? file SVN_ENTRIES
FileUtils.rm_rf( 'artifacts' )
### Task: changelog
file 'ChangeLog' => SVN_ENTRIES.to_s do |task|
log "Updating #{task.name}"
changelog = make_svn_changelog()
File.open( task.name, 'w' ) do |fh|
fh.print( changelog )
end
end end
### Cruisecontrol task ### Task: cruise (Cruisecontrol task)
desc "Cruisecontrol build" desc "Cruisecontrol build"
task :cruise => [:clean, :coverage, :rdoc, :package] do |task| task :cruise => [:clean, :spec, :package] do |task|
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty? raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
artifact_dir = ARTIFACTS_DIR.cleanpath artifact_dir = ARTIFACTS_DIR.cleanpath
artifact_dir.mkpath artifact_dir.mkpath
$stderr.puts "Copying coverage stats..." coverage = BASEDIR + 'coverage'
FileUtils.cp_r( 'coverage', artifact_dir ) if coverage.exist? && coverage.directory?
$stderr.puts "Copying coverage stats..."
$stderr.puts "Copying documentation..." FileUtils.cp_r( 'coverage', artifact_dir )
FileUtils.cp_r( 'docs/api', artifact_dir + 'rdoc' ) end
$stderr.puts "Copying packages..." $stderr.puts "Copying packages..."
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir ) FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
end end
desc "Update the build system to the latest version"
task :update_build do
log "Updating the build system"
sh 'svn', 'up', RAKE_TASKDIR
log "Updating the Rakefile"
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
end

21
project.yml Normal file
View file

@ -0,0 +1,21 @@
---
rubyforge_project: ezmlm
project_requirements:
ezmlm-idx: ">=0"
project_description: |-
Ruby-Ezmlm provides a programmatic interface to ezmlm-idx lists, their archives, and the command
line utilities that interact with them. The library is intended to provide two sets of
functionality: the management and setup of lists, and programmatic access to the message archive.
rubyforge_group: laika
author_name: LAIKA Information Systems
project_homepage: http://opensource.laika.com/wiki/ruby-ezmlm
project_dependencies:
tmail: ">=1.2.3.1"
project_summary: A programmatic interface to ezmlm-idx lists
project_name: Ruby-Ezmlm
version_file: ezmlm.rb
additional_pkgfiles: []
dev_dependencies: {}
author_email: opensource@laika.com