Added support for the --image_dir and --font_dir command line switches.
[redact.git] / Rakefile
1 # $Id: Rakefile 42 2005-06-08 17:16:09Z tilman $
2
3 require "rake/clean"
4 require "rake/testtask"
5 require "rake/rdoctask"
6 require "rake/packagetask"
7 require "rake/contrib/compositepublisher.rb"
8 require "rake/contrib/sshpublisher"
9
10 # make sure we run at least Rake 0.5.0
11 if (RAKEVERSION.split(".").map { |p| p.to_i } <=> [0, 5, 0]) < 0
12         raise("Rake 0.5.0 or greater required")
13 end
14
15 PKG_NAME = "redact"
16 PKG_VERSION = File.read("lib/redact/redact.rb").
17               match(/^\s*VERSION = \"(.*)\"\s*$/).captures.first
18
19 CLOBBER.include("test/*.edj")
20
21 task :install do |t|
22         sitelibdir = Config::CONFIG["sitelibdir"]
23         destdir = "#{ENV["DESTDIR"]}"
24         prefix = ENV["PREFIX"] || "/usr/local"
25
26         ddir = destdir + prefix + "/bin"
27         FileUtils::Verbose.install("bin/redact", ddir, :mode => 0755)
28
29         ddir = destdir + sitelibdir + "/redact"
30
31         FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
32         FileUtils::Verbose.install(Dir["lib/redact/*.rb"], ddir,
33                                    :mode => 0644)
34 end
35
36 task :test
37
38 Rake::TestTask.new do |t|
39         t.libs << "lib"
40         t.test_files = FileList["test/test*.rb"]
41         t.verbose = true
42 end
43
44 Rake::RDocTask.new do |t|
45         t.rdoc_dir = "doc"
46         t.title = "Redact - An Edje Compiler written in Ruby"
47         t.options = ["--line-numbers", "--inline-source", "--main", "README"]
48         t.rdoc_files.include("README", "COPYING", "AUTHORS", "ChangeLog",
49                              "TODO", "NEWS", "lib/redact/redact.rb",
50                              "lib/redact/part.rb", "lib/redact/program.rb")
51 end
52
53 Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t|
54         t.need_tar_gz = true
55         t.package_files.include("[A-Z]*", "bin/redact", "lib/redact/*.rb",
56                                 "test/*.rb")
57 end
58
59 task :publish => [:rdoc, :package] do
60         p = Rake::CompositePublisher.new
61         p.add(Rake::SshFreshDirPublisher.new("code-monkey.de",
62                                              "public_html/docs/" +
63                                              PKG_NAME, "doc"))
64         p.add(Rake::SshFilePublisher.new("code-monkey.de",
65                                          ".", "pkg",
66                                          "#{PKG_NAME}-#{PKG_VERSION}.tar.gz"))
67         p.upload
68 end