@@ -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
2435end
2536
0 commit comments