Skip to content

Commit 3890ba3

Browse files
authored
Merge pull request #1031 from progit/authors
Add authors and publication date to the book
2 parents d9f2665 + eff6194 commit 3890ba3

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

Rakefile

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@ namespace :book do
22
desc 'build basic book formats'
33
task :build do
44

5-
puts "Generating contributors list"
6-
`git shortlog -s master| grep -v -E "(Straub|Chacon)" | cut -f 2- | column -c 120 > book/contributors.txt`
5+
`cp progit.asc progit.asc.bak`
6+
begin
7+
version_string = ENV['TRAVIS_TAG'] || '0'
8+
text = File.read('progit.asc')
9+
new_contents = text.gsub("$$VERSION$$", version_string).gsub("$$DATE$$", Time.now.strftime("%Y-%m-%d"))
10+
File.open("progit.asc", "w") {|file| file.puts new_contents }
711

8-
puts "Converting to HTML..."
9-
`bundle exec asciidoctor progit.asc`
10-
puts " -- HTML output at progit.html"
12+
puts "Generating contributors list"
13+
`git shortlog -s master| grep -v -E "(Straub|Chacon)" | cut -f 2- | column -c 120 > book/contributors.txt`
1114

12-
puts "Converting to EPub..."
13-
`bundle exec asciidoctor-epub3 progit.asc`
14-
puts " -- Epub output at progit.epub"
15+
puts "Converting to HTML..."
16+
`bundle exec asciidoctor progit.asc`
17+
puts " -- HTML output at progit.html"
1518

16-
puts "Converting to Mobi (kf8)..."
17-
`bundle exec asciidoctor-epub3 -a ebook-format=kf8 progit.asc`
18-
puts " -- Mobi output at progit.mobi"
19+
puts "Converting to EPub..."
20+
`bundle exec asciidoctor-epub3 progit.asc`
21+
puts " -- Epub output at progit.epub"
1922

20-
puts "Converting to PDF... (this one takes a while)"
21-
`bundle exec asciidoctor-pdf progit.asc 2>/dev/null`
22-
puts " -- PDF output at progit.pdf"
23+
puts "Converting to Mobi (kf8)..."
24+
`bundle exec asciidoctor-epub3 -a ebook-format=kf8 progit.asc`
25+
puts " -- Mobi output at progit.mobi"
26+
27+
puts "Converting to PDF... (this one takes a while)"
28+
`bundle exec asciidoctor-pdf progit.asc 2>/dev/null`
29+
puts " -- PDF output at progit.pdf"
30+
31+
ensure
32+
`mv progit.asc.bak progit.asc`
33+
end
2334
end
2435
end
2536

progit.asc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Pro Git
22
=======
3+
Scott Chacon; Ben Straub
4+
$$VERSION$$, $$DATE$$
35
:doctype: book
46
:docinfo:
57
:toc:

0 commit comments

Comments
 (0)