-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRakefile
83 lines (65 loc) · 1.71 KB
/
Rakefile
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
# Rakefile for project management (from chris2) -*-ruby-*-
Project = 'project-template'
require 'rake/rdoctask'
require 'rake/testtask'
desc "Build and test"
task :default => [:build, :test]
desc "Do predistribution stuff"
task :predist => [:chmod, :changelog, :doc]
desc "Build"
task :build do
#ruby "ext/extconf.rb"
#system "make"
end
task :test => :build
desc "Run all the tests"
Rake::TestTask.new do |t|
t.libs << "tests"
t.libs << "lib"
t.test_files = FileList['tests/test_*.rb']
t.verbose = true
end
desc "Make an archive as .tar.gz"
task :dist => :test do
system "export DARCS_REPO=#{File.expand_path "."}; " +
"darcs dist -d #{Project}#{get_darcs_tree_version}"
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a ChangeLog"
task :changelog do
system "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
end
desc "Generate RDoc documentation"
Rake::RDocTask.new(:doc) do |rdoc|
rdoc.options << '--line-numbers --inline-source'
rdoc.rdoc_dir = "rdoc"
rdoc.rdoc_files.include("lib/**/*.rb", "lib/*.rb")
end
desc "Clean to distribution pristine"
task :distclean do
#system 'make distclean'
end
# Helper to retrieve the "revision number" of the darcs tree.
def get_darcs_tree_version
return "" unless File.directory? "_darcs"
changes = `darcs changes`
count = 0
tag = "0.0"
changes.each("\n\n") { |change|
head, title, desc = change.split("\n", 3)
if title =~ /^ \*/
# Normal change.
count += 1
elsif title =~ /tagged (.*)/
# Tag. We look for these.
tag = $1
break
else
warn "Unparsable change: #{change}"
end
}
"-" + tag + "." + count.to_s
end