require 'rake/gempackagetask'
require 'rbconfig'

include Config

PKG_NAME = 'lazylist'
PKG_VERSION = File.read('VERSION').chomp
PKG_FILES = FileList['**/*'].exclude(/^doc/).exclude(/^CVS/).exclude(/^pkg/)

task :default => :test

desc "Run unit tests"
task :test  do
  cd 'tests' do
    ruby %{-I../ext runner.rb}
  end
end

desc "Installing library"
task :install  do
  ruby 'install.rb'
end

desc "Creating documentation"
task :doc do
  ruby 'make_doc.rb'
end

desc "Removing generated files"
task :clean do
  rm_rf 'doc'
  rm_rf 'tests/coverage'
end

spec = Gem::Specification.new do |s|
  #### Basic information.

  s.name = 'lazylist'
  s.version = PKG_VERSION
  s.summary = "Implementation of lazy lists for Ruby"
  s.description = ""

  #### Dependencies and requirements.

  #s.add_dependency('log4r', '> 1.0.4')
  #s.requirements << ""

  s.files = PKG_FILES

  #### C code extensions.

  #s.extensions << "ext/extconf.rb"

  #### Load-time details: library and application (you will need one or both).

  s.require_path = 'lib'             # Use these for libraries.
  s.autorequire = 'lazylist'

  #s.bindir = "bin"                 # Use these for applications.
  #s.executables = ["bla.rb"]
  #s.default_executable = "bla.rb"

  #### Documentation and testing.

  s.has_rdoc = true
  s.extra_rdoc_files = [ 'lib/lazylist.rb' ]
  s.rdoc_options <<
    '--title' <<  'LazyList -- Infinite lists in Ruby' <<
    '--main' << 'LazyList' <<
    '--line-numbers'
  s.test_files << 'tests/test.rb'

  #### Author and project details.

  s.author = "Florian Frank"
  s.email = "flori@ping.de"
  s.homepage = "http://lazylist.rubyforge.org"
  s.rubyforge_project = "lazylist"
end

Rake::GemPackageTask.new(spec) do |pkg|
  pkg.need_tar = true
  pkg.package_files += PKG_FILES
end

task :release => [ :clean, :package ]
  # vim: set et sw=2 ts=2:
