-
Notifications
You must be signed in to change notification settings - Fork 68
/
Rakefile
80 lines (63 loc) · 1.82 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
# Rakefile for Bacon. -*-ruby-*-
require 'rdoc/task'
require 'rake/testtask'
desc "Run all the tests"
task :default => [:test]
desc "Do predistribution stuff"
task :predist => [:chmod, :changelog, :rdoc]
desc "Make an archive as .tar.gz"
task :dist => [:test, :predist] do
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
sh "pax -waf #{release}.tar -s ':^:#{release}/:' RDOX ChangeLog doc"
sh "gzip -f -9 #{release}.tar"
end
# Helper to retrieve the "revision number" of the git tree.
def git_tree_version
if File.directory?(".git")
@tree_version ||= `git describe`.strip.sub('-', '.')
@tree_version << ".0" unless @tree_version.count('.') == 2
else
$: << "lib"
require 'bacon'
@tree_version = Bacon::VERSION
end
@tree_version
end
def gem_version
git_tree_version.gsub(/-.*/, '')
end
def release
"bacon-#{git_tree_version}"
end
def manifest
`git ls-files`.split("\n") - [".gitignore"]
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a ChangeLog"
task :changelog do
sh "git log --format='%ad %an <%ae>%n%w(79,2,4)* %s%n%n%w(76,4,4)%b' |grep -v darcs-hash: |cat -s >ChangeLog"
end
desc "Generate RDox"
task "RDOX" do
sh "bin/bacon -Ilib --automatic --specdox >RDOX"
end
desc "Run all the tests"
task :test do
ruby "bin/bacon -w -Ilib --automatic --quiet"
end
desc "Generate RDoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source' <<
'--main' << 'README.rdoc' <<
'--title' << 'Bacon Documentation' <<
'--charset' << 'utf-8'
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include 'README.rdoc'
rdoc.rdoc_files.include 'COPYING'
rdoc.rdoc_files.include 'RDOX'
rdoc.rdoc_files.include('lib/bacon.rb')
end
task :rdoc => ["RDOX"]