Rakefile in cairo-1.5.1 vs Rakefile in cairo-1.6.0
- old
+ new
@@ -1,6 +1,6 @@
-# -*- ruby -*-
+# -*- coding: utf-8; mode: ruby -*-
require 'English'
require 'find'
require 'fileutils'
@@ -23,11 +23,11 @@
manifest_contents = []
base_dir_included_components = %w(AUTHORS COPYING ChangeLog GPL
NEWS README Rakefile
extconf.rb pkg-config.rb)
excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg)
-excluded_suffixes = %w(.png .ps .pdf .o .so .txt)
+excluded_suffixes = %w(.png .ps .pdf .o .so .txt .~)
Find.find(base_dir) do |target|
target = truncate_base_dir[target]
components = target.split(File::SEPARATOR)
if components.size == 1 and !File.directory?(target)
next unless base_dir_included_components.include?(components[0])
@@ -38,11 +38,17 @@
end
File.open(manifest, "w") do |f|
f.puts manifest_contents.sort.join("\n")
end
+
+# For Hoe's no user friendly default behavior. :<
+File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
+FileUtils.cp("NEWS", "History.txt")
at_exit do
+ FileUtils.rm_f("README.txt")
+ FileUtils.rm_f("History.txt")
FileUtils.rm_f(manifest)
end
ENV["VERSION"] ||= Cairo.bindings_version
version = ENV["VERSION"]
@@ -72,10 +78,13 @@
project.remote_rdoc_dir = "doc"
end
project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
+# fix Hoe's overwork.
+task(:release).prerequisites.delete_if {|prerequisite| prerequisite == "clean"}
+
# fix Hoe's incorrect guess.
project.spec.executables.clear
project.lib_files = project.spec.files.grep(%r|^src/lib/|)
# fix Hoe's install and uninstall task.
@@ -107,13 +116,14 @@
end
end
# for releasing
-task :dist do
+task :dist => [:docs] do
sh "./dist.sh", version
end
+task :gem => [:docs]
# for documentation
langs = [
["en", "English"],
["ja", "日本語"],
@@ -126,15 +136,15 @@
doc_index = File.join(doc_dir, "index.html")
doc_css = File.join(doc_dir, "doc.css")
doc_title_image = File.join(doc_dir, "rcairo-title.png")
task(doc_index).instance_variable_get("@actions").clear
-file doc_index => doc_dir do
+file doc_dir do
mkdir_p doc_dir
end
-file doc_title_image => rcairo_doc_title_image do
+file doc_title_image => [doc_dir, rcairo_doc_title_image] do
cp rcairo_doc_title_image, doc_title_image
end
file doc_css => [rcairo_doc_css, doc_title_image] do
cp rcairo_doc_css, doc_css
@@ -171,12 +181,16 @@
EOH
end
end
langs.each do |lang,|
- lang_doc_index = File.join(doc_dir, lang, "index.html")
+ lang_doc_dir = File.join(doc_dir, lang)
+ file lang_doc_dir do
+ mkdir_p lang_doc_dir
+ end
+ lang_doc_index = File.join(lang_doc_dir, "index.html")
task doc_index => lang_doc_index
- file lang_doc_index do
+ file lang_doc_index => [lang_doc_dir] do
lang_doc_dir = File.join(doc_dir, lang)
lang_rcairo_doc_dir = File.join(rcairo_doc_dir, lang)
mkdir_p lang_doc_dir
cp Dir[File.join(lang_rcairo_doc_dir, "*.rd")], lang_doc_dir
ruby File.join(rcairo_doc_dir, "update-html.rb"), lang_doc_dir