define()
public
Create the tasks defined by this task
library.
Show source
def define
fail "Version required (or :noversion)" if @version.nil?
@version = nil if :noversion == @version
desc "Build all the packages"
task :package
desc "Force a rebuild of the package files"
task :repackage => [:clobber_package, :package]
desc "Remove package products"
task :clobber_package do
rm_r package_dir rescue nil
end
task :clobber => [:clobber_package]
[
[need_tar, tgz_file, "z"],
[need_tar_gz, tar_gz_file, "z"],
[need_tar_bz2, tar_bz2_file, "j"]
].each do |(need, file, flag)|
if need
task :package => ["#{package_dir}/#{file}"]
file "#{package_dir}/#{file}" =>
[package_dir_path] + package_files do
chdir(package_dir) do
sh @tar_command, "#{flag}cvf", file, package_name
end
end
end
end
if need_zip
task :package => ["#{package_dir}/#{zip_file}"]
file "#{package_dir}/#{zip_file}" =>
[package_dir_path] + package_files do
chdir(package_dir) do
sh @zip_command, "-r", zip_file, package_name
end
end
end
directory package_dir_path => @package_files do
@package_files.each do |fn|
f = File.join(package_dir_path, fn)
fdir = File.dirname(f)
mkdir_p(fdir) unless File.exist?(fdir)
if File.directory?(fn)
mkdir_p(f)
else
rm_f f
safe_ln(fn, f)
end
end
end
self
end