1
1
namespace :book do
2
- def exec_or_raise ( command )
3
- puts `#{ command } `
4
- if ( ! $?. success? )
5
- raise "'#{ command } ' failed"
6
- end
7
- end
8
2
9
3
# Variables referenced for build
10
4
version_string = `git describe --tags` . chomp
@@ -28,7 +22,7 @@ namespace :book do
28
22
puts "Hash on header of contributors list (#{ header_hash } ) matches the current HEAD (#{ current_head_hash } )"
29
23
else
30
24
puts "Hash on header of contributors list (#{ header_hash } ) does not match the current HEAD (#{ current_head_hash } ), refreshing"
31
- ` rm book/contributors.txt`
25
+ sh " rm book/contributors.txt"
32
26
# Reenable and invoke task again
33
27
Rake ::Task [ 'book/contributors.txt' ] . reenable
34
28
Rake ::Task [ 'book/contributors.txt' ] . invoke
@@ -58,16 +52,16 @@ namespace :book do
58
52
desc 'generate contributors list'
59
53
file 'book/contributors.txt' do
60
54
puts 'Generating contributors list'
61
- `echo " Contributors as of #{ header_hash } :\n " > book/contributors.txt`
62
- ` git shortlog -s | grep -v -E " (Straub|Chacon|dependabot)" | cut -f 2- | column -c 120 >> book/contributors.txt`
55
+ sh "echo ' Contributors as of #{ header_hash } :\n ' > book/contributors.txt"
56
+ sh " git shortlog -s | grep -v -E ' (Straub|Chacon|dependabot)' | cut -f 2- | column -c 120 >> book/contributors.txt"
63
57
end
64
58
65
59
desc 'build HTML format'
66
60
task :build_html => 'book/contributors.txt' do
67
61
check_contrib ( )
68
62
69
63
puts 'Converting to HTML...'
70
- ` bundle exec asciidoctor #{ params } -a data-uri progit.asc`
64
+ sh " bundle exec asciidoctor #{ params } -a data-uri progit.asc"
71
65
puts ' -- HTML output at progit.html'
72
66
73
67
end
@@ -77,7 +71,7 @@ namespace :book do
77
71
check_contrib ( )
78
72
79
73
puts 'Converting to EPub...'
80
- ` bundle exec asciidoctor-epub3 #{ params } progit.asc`
74
+ sh " bundle exec asciidoctor-epub3 #{ params } progit.asc"
81
75
puts ' -- Epub output at progit.epub'
82
76
83
77
end
@@ -87,7 +81,7 @@ namespace :book do
87
81
check_contrib ( )
88
82
89
83
puts "Converting to Mobi (kf8)..."
90
- ` bundle exec asciidoctor-epub3 #{ params } -a ebook-format=kf8 progit.asc`
84
+ sh " bundle exec asciidoctor-epub3 #{ params } -a ebook-format=kf8 progit.asc"
91
85
puts " -- Mobi output at progit.mobi"
92
86
end
93
87
@@ -96,16 +90,16 @@ namespace :book do
96
90
check_contrib ( )
97
91
98
92
puts 'Converting to PDF... (this one takes a while)'
99
- ` bundle exec asciidoctor-pdf #{ params } progit.asc 2>/dev/null`
93
+ sh " bundle exec asciidoctor-pdf #{ params } progit.asc 2>/dev/null"
100
94
puts ' -- PDF output at progit.pdf'
101
95
end
102
96
103
97
desc 'Check generated books'
104
98
task :check => [ :build_html , :build_epub ] do
105
99
puts 'Checking generated books'
106
100
107
- exec_or_raise ( ' htmlproofer --check-html progit.html' )
108
- exec_or_raise ( ' epubcheck progit.epub' )
101
+ sh " htmlproofer --check-html progit.html"
102
+ sh " epubcheck progit.epub"
109
103
end
110
104
111
105
desc 'Clean all generated files'
0 commit comments