-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
40 lines (35 loc) · 870 Bytes
/
Rakefile
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
DOWNLOAD_DIR = 'download'
KINDLE_DIR = 'kindle'
magnify_factor = 1.0
if ENV['MAG']
f = ENV['MAG'].to_f
magnify_factor = f if f > 1.0
end
task :default => %i(download setupfile mobi)
desc 'download file'
task :download do
mkpath DOWNLOAD_DIR
chdir DOWNLOAD_DIR do
# download ファイル名の旧→新変換
unless Dir['p=*'].empty?
puts 'update names of downloaded files'
sh 'ruby ../update_name.rb'
end
sh 'ruby -I.. ../download.rb'
end
end
desc'setup files from downloaded files'
task :setupfile do
mkpath KINDLE_DIR
chdir DOWNLOAD_DIR do
sh "ruby -I.. ../setupfile.rb #{KINDLE_DIR}"
end
end
desc 'make mobi'
task :mobi do
chdir KINDLE_DIR do
sh 'ruby -I.. ../make_kindle.rb'
sh "ruby -I.. ../magnify_image.rb #{magnify_factor}" if magnify_factor > 1.0
sh 'kindlegen rubima.opf -verbose'
end
end