Rakefile
author Mahlon E. Smith <mahlon@martini.nu>
Fri, 23 Jun 2017 10:54:26 -0700
changeset 26 a89d91d4b157
parent 21 1ebc33d48c85
permissions -rw-r--r--
Don't mutate the caller's argument.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
     1
#!/usr/bin/env rake
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
     2
# vim: set nosta noet ts=4 sw=4:
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     3
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
     4
require 'pathname'
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     5
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
     6
begin
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
     7
	require 'rake/extensiontask'
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
     8
rescue LoadError
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
     9
	abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    10
end
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    11
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    12
PROJECT = 'ezmlm'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    13
BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    14
LIBDIR  = BASEDIR + 'lib'
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    15
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    16
if Rake.application.options.trace
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    17
    $trace = true
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    18
    $stderr.puts '$trace is enabled'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    19
end
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    20
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    21
# parse the current library version
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    22
$version = ( LIBDIR + "#{PROJECT}.rb" ).read.split(/\n/).
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    23
	select{|line| line =~ /VERSION =/}.first.match(/([\d|.]+)/)[1]
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    24
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    25
task :default => [ :spec, :docs, :package ]
20
9d59d30685cb Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents: 17
diff changeset
    26
task :spec    => [ :compile ]
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    27
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    28
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    29
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    30
### P A C K A G I N G
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    31
########################################################################
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    32
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    33
require 'rubygems'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    34
require 'rubygems/package_task'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    35
spec = Gem::Specification.new do |s|
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    36
	s.email        = 'mahlon@martini.nu'
21
1ebc33d48c85 aaaaaand fix the homepage link. Case matters.
Mahlon E. Smith <mahlon@laika.com>
parents: 20
diff changeset
    37
	s.homepage     = 'https://bitbucket.org/mahlon/ruby-ezmlm'
20
9d59d30685cb Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents: 17
diff changeset
    38
	s.authors      = [ 'Mahlon E. Smith', 'Michael Granger', 'Jeremiah Jordan' ]
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    39
	s.platform     = Gem::Platform::RUBY
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    40
	s.summary      = "Interact with Ezmlm-IDX mailing lists."
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    41
	s.name         = PROJECT
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    42
	s.version      = $version
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    43
	s.license      = 'BSD-3-Clause'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    44
	s.has_rdoc     = true
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    45
	s.require_path = 'lib'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    46
	s.bindir       = 'bin'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    47
	s.files        = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    48
	# s.executables  = %w[]
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    49
	s.description  = <<-EOF
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    50
This is a ruby interface for interacting with ezmlm-idx, an email list
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    51
manager for use with the Qmail MTA, and the messages contained therein.
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    52
(The -idx provides an extended feature set over the original ezmlm
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    53
environment.)
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    54
	EOF
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    55
	s.extensions = FileList[ "ext/**/extconf.rb" ]
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
    56
	s.required_ruby_version = '>= 2.1'
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    57
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    58
	s.add_dependency 'mail', "~> 2.6"
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
    59
	s.add_development_dependency 'rake-compiler', "~> 1.0"
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    60
end
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    61
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    62
Gem::PackageTask.new( spec ) do |pkg|
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    63
	pkg.need_zip = true
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    64
	pkg.need_tar = true
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    65
end
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    66
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    67
# Build the C extension for hashing addresses.
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    68
Rake::ExtensionTask.new( 'ezmlm/hash', spec )
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
    69
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    70
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    71
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    72
### D O C U M E N T A T I O N
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    73
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    74
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    75
begin
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    76
	require 'rdoc/task'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    77
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    78
	desc 'Generate rdoc documentation'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    79
	RDoc::Task.new do |rdoc|
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    80
		rdoc.name       = :docs
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    81
		rdoc.rdoc_dir   = 'docs'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    82
		rdoc.main       = "README.rdoc"
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    83
		# rdoc.options    = [ '-f', 'fivefish' ]
20
9d59d30685cb Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents: 17
diff changeset
    84
		rdoc.rdoc_files = [ 'lib', *FileList['ext/**.c'], *FileList['*.rdoc'], *FileList['*.md'] ]
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    85
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    86
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    87
	RDoc::Task.new do |rdoc|
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    88
		rdoc.name       = :doc_coverage
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    89
		rdoc.options    = [ '-C1' ]
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    90
	end
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    91
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    92
rescue LoadError
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    93
	$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    94
end
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    95
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    96
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    97
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    98
### T E S T I N G
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
    99
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   100
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   101
begin
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   102
    require 'rspec/core/rake_task'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   103
    task :test => :spec
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   104
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   105
    desc "Run specs"
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   106
    RSpec::Core::RakeTask.new do |t|
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   107
        t.pattern = "spec/**/*_spec.rb"
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   108
    end
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   109
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   110
    desc "Build a coverage report"
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   111
    task :coverage do
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   112
        ENV[ 'COVERAGE' ] = "yep"
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   113
        Rake::Task[ :spec ].invoke
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   114
    end
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   115
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   116
rescue LoadError
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   117
    $stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
11
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
   118
end
7fc2d1713795 Updated to new build system.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
   119
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   120
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   121
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   122
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   123
### M A N I F E S T
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   124
########################################################################
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   125
__END__
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   126
ext/ezmlm/hash/hash.c
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   127
ext/ezmlm/hash/hash.h
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   128
ext/ezmlm/hash/extconf.rb
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
   129
lib/ezmlm/list.rb
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   130
lib/ezmlm/list/message.rb
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   131
lib/ezmlm/list/thread.rb
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   132
lib/ezmlm/list/author.rb
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 13
diff changeset
   133
lib/ezmlm.rb
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 11
diff changeset
   134