File: Rakefile

package info (click to toggle)
ruby-rgfa 1.3.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 820 kB
  • sloc: ruby: 5,649; makefile: 9
file content (62 lines) | stat: -rw-r--r-- 1,539 bytes parent folder | download | duplicates (4)
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
require "rake/testtask"

$rgfaversion=Gem::Specification.load("rgfa.gemspec").version.to_s

Rake::TestTask.new do |t|
  t.libs << 'test'
  t.pattern = "test/test_*.rb"
  t.verbose = true
end

desc "Run tests"
task :default => :test

desc "Build gem"
task :build do
  system("gem build rgfa.gemspec")
end

desc "Install gem"
task :install => :build do
  system("gem install rgfa")
end

desc "Rm files created by rake build"
task :clean do
  system("rm -f rgfa-*.gem")
end

# make documentation generation tasks
# available only if yard gem is installed
begin
  require "yard"
  YARD::Tags::Library.define_tag("Developer notes", :developer)
  YARD::Rake::YardocTask.new do |t|
    t.files   = ['lib/**/*.rb']
    t.stats_options = ['--list-undoc']
  end
rescue LoadError
end

desc "Typeset cheatsheet"
task :cheatsheet do
  system("echo #$rgfaversion > cheatsheet/version")
  system("latexmk cheatsheet/rgfa-cheatsheet.tex "+
         "-pdf -outdir=cheatsheet")
  system("mv cheatsheet/rgfa-cheatsheet.pdf"+
         "   cheatsheet/rgfa-cheatsheet-#$rgfaversion.pdf")
end

desc "Create a PDF documentation"
task :pdf do
  require "erb"
  File.open("pdfdoc/cover.html", "w") do |f|
    f.puts ERB.new(IO.read("pdfdoc/cover.html.erb")).result(binding)
  end
  system("yard2.0 --one-file -o pdfdoc")
  system("wkhtmltopdf cover pdfdoc/cover.html "+
                     "toc "+
                     "pdfdoc/index.html "+
                     "--user-style-sheet pdfdoc/print.css "+
                     "pdfdoc/rgfa-api-#$rgfaversion.pdf")
end