Skip to content

Commit 22084d2

Browse files
authored
Merge pull request #1672 from slonopotamus/kindlegen
resolves #1671 install Kindlegen so .mobi output can be produced
2 parents a291101 + d6d46fe commit 22084d2

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ gem 'pygments.rb', '2.2.0'
1414
gem 'thread_safe', '0.3.6'
1515
gem 'epubcheck-ruby', '4.2.5.0'
1616
gem 'html-proofer', '3.19.2'
17+
gem 'kindlegen', '3.1.1'

Rakefile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
namespace :book do
2-
def exec_or_raise(command)
3-
puts `#{command}`
4-
if (! $?.success?)
5-
raise "'#{command}' failed"
6-
end
7-
end
82

93
# Variables referenced for build
104
version_string = `git describe --tags`.chomp
@@ -28,7 +22,7 @@ namespace :book do
2822
puts "Hash on header of contributors list (#{header_hash}) matches the current HEAD (#{current_head_hash})"
2923
else
3024
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"
3226
# Reenable and invoke task again
3327
Rake::Task['book/contributors.txt'].reenable
3428
Rake::Task['book/contributors.txt'].invoke
@@ -58,16 +52,16 @@ namespace :book do
5852
desc 'generate contributors list'
5953
file 'book/contributors.txt' do
6054
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"
6357
end
6458

6559
desc 'build HTML format'
6660
task :build_html => 'book/contributors.txt' do
6761
check_contrib()
6862

6963
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"
7165
puts ' -- HTML output at progit.html'
7266

7367
end
@@ -77,7 +71,7 @@ namespace :book do
7771
check_contrib()
7872

7973
puts 'Converting to EPub...'
80-
`bundle exec asciidoctor-epub3 #{params} progit.asc`
74+
sh "bundle exec asciidoctor-epub3 #{params} progit.asc"
8175
puts ' -- Epub output at progit.epub'
8276

8377
end
@@ -87,7 +81,7 @@ namespace :book do
8781
check_contrib()
8882

8983
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"
9185
puts " -- Mobi output at progit.mobi"
9286
end
9387

@@ -96,16 +90,16 @@ namespace :book do
9690
check_contrib()
9791

9892
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"
10094
puts ' -- PDF output at progit.pdf'
10195
end
10296

10397
desc 'Check generated books'
10498
task :check => [:build_html, :build_epub] do
10599
puts 'Checking generated books'
106100

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"
109103
end
110104

111105
desc 'Clean all generated files'

0 commit comments

Comments
 (0)