1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
#! /usr/bin/env rake
#--
# Color
# Colour Management with Ruby
# http://rubyforge.org/projects/color
#
# Licensed under a MIT-style licence. See Licence.txt in the main
# distribution for full licensing information.
#
# Copyright (c) 2005 - 2007 Austin Ziegler and Matt Lyon
#
# $Id: History.txt 50 2007-02-03 20:26:19Z austin $
#++
require 'rubygems'
require 'hoe'
$LOAD_PATH.unshift('lib')
require 'color'
PKG_NAME = 'color'
PKG_VERSION = Color::COLOR_VERSION
PKG_DIST = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_TAR = "pkg/#{PKG_DIST}.tar.gz"
MANIFEST = File.read("Manifest.txt").split
Hoe.new PKG_NAME, PKG_VERSION do |p|
p.rubyforge_name = PKG_NAME
# This is a lie becasue I will continue to use Archive::Tar::Minitar.
p.need_tar = false
# need_zip - Should package create a zipfile? [default: false]
p.author = [ "Austin Ziegler", "Matt Lyon" ]
p.email = %W(austin@rubyforge.org matt@postsomnia.com)
p.url = "http://color.rubyforge.org/"
p.summary = "Colour management with Ruby"
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.description = p.paragraphs_of("Readme.txt", 1..1).join("\n\n")
p.extra_deps << [ "archive-tar-minitar", "~>0.5.1" ]
p.clean_globs << "coverage"
p.spec_extras[:extra_rdoc_files] = MANIFEST.grep(/txt$/) -
["Manifest.txt"]
end
desc "Build a Color .tar.gz distribution."
task :tar => [ PKG_TAR ]
file PKG_TAR => [ :test ] do |t|
require 'archive/tar/minitar'
require 'zlib'
files = MANIFEST.map { |f|
fn = File.join(PKG_DIST, f)
tm = File.stat(f).mtime
if File.directory?(f)
{ :name => fn, :mode => 0755, :dir => true, :mtime => tm }
else
mode = if f =~ %r{^bin}
0755
else
0644
end
data = File.read(f)
{ :name => fn, :mode => mode, :data => data, :size => data.size,
:mtime => tm }
end
}
begin
unless File.directory?(File.dirname(t.name))
require 'fileutils'
File.mkdir_p File.dirname(t.name)
end
tf = File.open(t.name, 'wb')
gz = Zlib::GzipWriter.new(tf)
tw = Archive::Tar::Minitar::Writer.new(gz)
files.each do |entry|
if entry[:dir]
tw.mkdir(entry[:name], entry)
else
tw.add_file_simple(entry[:name], entry) { |os|
os.write(entry[:data])
}
end
end
ensure
tw.close if tw
gz.close if gz
end
end
task :package => [ PKG_TAR ]
desc "Build the manifest file from the current set of files."
task :build_manifest do |t|
require 'find'
paths = []
Find.find(".") do |path|
next if File.directory?(path)
next if path =~ /\.svn/
next if path =~ /\.swp$/
next if path =~ %r{coverage/}
next if path =~ /~$/
paths << path.sub(%r{^\./}, '')
end
File.open("Manifest.txt", "w") do |f|
f.puts paths.sort.join("\n")
end
puts paths.sort.join("\n")
end
|