-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathRakefile
92 lines (73 loc) · 2.38 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
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
# Ensure that the lib/ directory is used before the one installed in
# the system to get the right version, then require the library
# itself.
$:.insert(0, File.expand_path("../lib", __FILE__))
require 'elf'
ManpagesList = FileList["manpages/*.1.xml"].collect { |file|
file.sub(/\.1\.xml$/, ".1")
}
desc "Build the man pages for the installed tools"
task :manpages => ManpagesList
desc "Remove manpages products"
task :clobber_manpages do
FileList["manpages/*.1"].each do |file|
File.unlink(file)
end
end
begin
def git_tagged?
unless File.exists?(".git")
raise Exception.new("Can't execute this task outside of Ruby-Elf git repository")
end
IO.popen("git tag -l #{Elf::VERSION}").read == "#{Elf::VERSION}\n"
end
def git_dirty?
unless File.exists?(".git")
raise Exception.new("Can't execute this task outside of Ruby-Elf git repository")
end
IO.popen("git status --porcelain --untracked-files=no").read != ""
end
desc "Tag and publish the release"
task :package => ManpagesList do
if git_tagged?
$stderr.puts "The current release is already tagged; did you forget to bump the version?"
exit 1
end
if git_dirty?
$stderr.puts "The git repository contains modifications that are not committed."
exit 1
end
sh "gem", "build", "ruby-elf.gemspec"
sh "git", "tag", "-m", "Release #{Elf::VERSION}", "#{Elf::VERSION}"
sh "gem", "push", "ruby-elf-#{Elf::VERSION}.gem"
end
rescue Exception => e
# This can happen for instance if you're not running from within a
# git checkout. In that case we ignore the whole file.
raise unless e.message == "Can't execute this task outside of Ruby-Elf git repository"
end
XSL_NS_ROOT="http://docbook.sourceforge.net/release/xsl-ns/current"
rule '.1' => [ '.1.xml' ] + FileList["manpages/*.xmli"] do |t|
sh "xsltproc", "--stringparam", "man.copyright.section.enabled", "0", \
"--xinclude", "-o", t.name, "#{XSL_NS_ROOT}/manpages/docbook.xsl", \
t.source
end
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs = ["lib", "test"]
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.libs = ["lib", "test"]
end
rescue LoadError
$stderr.puts "Unable to find rcov, coverage won't be available"
end
task :default => [:test]
# Local Variables:
# mode: ruby
# mode: flyspell-prog
# ispell-local-dictionary: "english"
# End: