Rakefile in rbcdio-0.04 vs Rakefile in rbcdio-0.05
- old
+ new
@@ -1,52 +1,79 @@
-SO_NAME = "rubcdio.so"
+#!/usr/bin/env rake
+# -*- Ruby -*-
+require 'rubygems'
-# ------- Default Package ----------
-CDIO_VERSION = open("VERSION").read.chomp
-PKG_NAME = 'rbcdio'
+ROOT_DIR = File.dirname(__FILE__)
-FILES = FileList[
- 'AUTHORS',
- 'COPYING',
- 'ChangeLog',
- 'INSTALL',
- 'Makefile.am',
- 'Makefile.in',
- 'NEWS',
- 'README',
- 'Rakefile',
- 'THANKS',
- 'VERSION',
- 'VERSION.in',
- 'config.guess',
- 'config.sub',
- 'configure',
- 'configure.ac',
- 'data/**/*',
- 'doc/*',
- 'example/*',
- 'ext/**/*.c',
- 'ext/**/Makefile',
- 'ext/**/extconf.rb',
- 'install-sh',
- 'lib/*.rb',
- 'lib/Makefile',
- 'missing',
- 'rubycdio.m4',
- 'swig/*.swg',
- 'swig/Makefile',
- 'test/*.rb',
- 'test/Makefile',
- 'test/Rakefile',
- 'test/cdda.bin',
- 'test/cdda.cue',
- 'test/cdda.toc'
-]
+def gemspec
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
+end
require 'rake/gempackagetask'
-task :default => [:all]
+desc "Build the gem"
+task :package=>:gem
+task :gem=>:gemspec do
+ Dir.chdir(ROOT_DIR) do
+ sh "gem build .gemspec"
+ FileUtils.mkdir_p 'pkg'
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
+ end
+end
+desc "Install the gem locally"
+task :install => :gem do
+ Dir.chdir(ROOT_DIR) do
+ sh %{gem install --local pkg/#{gemspec.name}-#{gemspec.version}}
+ end
+end
+
+desc 'Create a GNU-style ChangeLog via git2cl'
+task :ChangeLog do
+ system('git log --pretty --numstat --summary | git2cl > ChangeLog')
+end
+
+require 'rake/testtask'
+desc "Test everything."
+Rake::TestTask.new('test') do |t|
+ t.pattern = 'test/*.rb'
+ t.warning = true
+end
+task :test => [:lib, :all]
+
+desc "same as test"
+task :check => :test
+
+desc "Generate the gemspec"
+task :generate do
+ puts gemspec.to_ruby
+end
+
+desc "Validate the gemspec"
+task :gemspec do
+ gemspec.validate
+end
+
+# --------- RDoc Documentation ------
+require 'rake/rdoctask'
+Rake::RDocTask.new("rdoc") do |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "rbcdio"
+ # Show source inline with line numbers
+ rdoc.options += ("--exclude data --exclude test --exclude lib/cdio/ " +
+ "--exclude lib/iso9660/ --exclude pkg/" ).split()
+ # Make the readme file the start page for the generated html
+ rdoc.options << '--main' << 'README'
+ rdoc.rdoc_files.include('lib/*.rb',
+ 'example/*.rb',
+ 'example/README',
+ 'README')
+end
+desc "Same as rdoc"
+task :doc => :rdoc
+
+task :default => :test
+
# --- Redo Rake::PackageTask::define so tar uses -h to include
# files of a symbolic link.
module Rake
class PackageTask < TaskLib
# Create the tasks defined by this task library.
@@ -110,125 +137,15 @@
self
end
end
end
-# --------- GEM package ------
-require 'rubygems'
-desc "Create GEM spec file"
-default_spec = Gem::Specification.new do |spec|
- spec.name = PKG_NAME
-
- spec.homepage = "http://rubyforge.org/projects/rbcdio/"
- spec.summary = "Ruby to libcdio (CD Input and Control library)"
- spec.description = <<-EOF
-A library for CD-ROM and CD image access. Applications wishing to be
-oblivious of the OS- and device-dependent properties of a CD-ROM or of
-the specific details of various CD-image formats may benefit from
-using this library. A library for working with ISO-9660 filesystems
-is included.
-EOF
-
- spec.version = CDIO_VERSION
-
- spec.author = "Rocky Bernstein"
- spec.email = "rocky@gnu.org"
- spec.platform = Gem::Platform::RUBY
- spec.require_path = "lib"
- spec.bindir = "bin"
- spec.executables = []
- spec.extensions = ["ext/cdio/extconf.rb", "ext/iso9660/extconf.rb"]
- spec.autorequire = "rubycdio"
- spec.files = FILES.to_a
- spec.test_files = FileList['tests/**/*']
-
- spec.required_ruby_version = '>= 1.8.2'
- spec.date = Time.now
- spec.rubyforge_project = 'rbcdio'
-
- # rdoc
- spec.has_rdoc = true
-end
-
-# Rake task to build the default package
-desc "Build all the packages (gem, tgz, zip)"
-Rake::GemPackageTask.new(default_spec) do |pkg|
- pkg.need_zip = true
- pkg.need_tar = true
-end
-
-### Windows specification
-##win_spec = default_spec.clone
-##win_spec.extensions = []
-##win_spec.platform = Gem::Platform::WIN32
-##win_spec.files += ["lib/#{SO_NAME}"]
-##
-##desc "Create Windows Gem"
-##task :win32_gem do
-## # Copy the win32 extension the top level directory
-## current_dir = File.expand_path(File.dirname(__FILE__))
-## source = File.join(current_dir, "ext", "win32", SO_NAME)
-## target = File.join(current_dir, "lib", SO_NAME)
-## cp(source, target)
-##
-## # Create the gem, then move it to pkg
-## Gem::Builder.new(win_spec).build
-## gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
-## mv(gem_file, "pkg/#{gem_file}")
-##
-## # Remove win extension fro top level directory
-## rm(target)
-##end
-
-
-# --------- Publish ------
-desc "Publish rubycdio to RubyForge."
-task :publish do
- require 'rake/contrib/sshpublisher'
-
- # Get ruby-debug path
- ruby_debug_path = File.expand_path(File.dirname(__FILE__))
-
- publisher = Rake::SshDirPublisher.new("rockyb@rubyforge.org",
- "/var/www/gforge-projects/rbcdio", ruby_debug_path)
-end
-
desc "Create shared objects"
task :all do
sh "./configure"
sh "make"
end
desc "Clear temp files"
task :clean do
sh "make clean"
end
-
-# --------- RDoc Documentation ------
-require 'rake/rdoctask'
-Rake::RDocTask.new("rdoc") do |rdoc|
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "rbcdio-debug"
- # Show source inline with line numbers
- rdoc.options += ("--exclude data --exclude test --exclude lib/cdio/ " +
- "--exclude lib/iso9660/ --exclude pkg/" ).split()
- # Make the readme file the start page for the generated html
- rdoc.options << '--main' << 'README'
- rdoc.rdoc_files.include('lib/*.rb',
- 'example/*.rb',
- 'example/README',
- 'README')
-end
-
-# --------- Regression tests ------
-require 'rake/testtask'
-Rake::TestTask.new('test') do |t|
- t.pattern = 'test/*.rb'
- t.warning = true
-end
-
-# 'check' is an the same thing as 'test'
-Rake::TestTask.new('check') do |t|
- t.pattern = 'test/*.rb'
- t.warning = true
-end
-