forked from theforeman/hammer-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (44 loc) · 1.27 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
require 'rake/testtask'
require 'bundler/gem_tasks'
require 'ci/reporter/rake/minitest'
PREFIX = ENV['PREFIX'] || '/usr/local'
DATAROOTDIR = ENV['DATAROOTDIR'] || "#{PREFIX}/share"
MANDIR = ENV['MANDIR'] || "#{DATAROOTDIR}/man"
Rake::TestTask.new do |t|
t.libs.push "lib"
t.test_files = Dir.glob('test/**/*_test.rb')
t.verbose = true
end
file "man/hammer.1.gz" => "man/hammer.1.asciidoc" do |t|
sh "which a2x" do |ok, res|
if !ok
puts "asciidoc is not installed... leaving"
exit
end
end
sh "a2x -d manpage -f manpage -D man/ #{t.prerequisites[0]}"
sh "gzip -f9 man/hammer.1"
end
task :build => ["man/hammer.1.gz"]
task :install => :build do |t|
begin
Rake::Task["man:install"].invoke
rescue SystemCallError => e
warn "Unable to install man page. #{e}. Skipping. You can try 'sudo rake man:install' to proceed."
end
end
namespace :man do
desc 'Install man page'
task :install do |t|
mkdir_p "#{MANDIR}/man1"
cp "man/hammer.1.gz", "#{MANDIR}/man1/"
end
end
require "hammer_cli/version"
require "hammer_cli/i18n"
require "hammer_cli/i18n/find_task"
HammerCLI::I18n::FindTask.define(HammerCLI::I18n::LocaleDomain.new, HammerCLI.version)
namespace :pkg do
desc 'Generate package source gem'
task :generate_source => :build
end