Skip to content

Commit 86dd110

Browse files
committed
Merge branch 'rails6'
2 parents e378ed7 + 51d4464 commit 86dd110

File tree

76 files changed

+43866
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+43866
-75
lines changed

Gemfile.lock

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,39 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
Ascii85 (1.0.3)
5-
addressable (2.5.2)
5+
addressable (2.6.0)
66
public_suffix (>= 2.0.2, < 4.0)
77
afm (0.2.2)
8-
asciidoctor (1.5.8)
9-
asciidoctor-epub3 (1.5.0.alpha.8)
10-
asciidoctor (~> 1.5.0)
11-
gepub (~> 0.6.9.2)
8+
asciidoctor (2.0.10)
9+
asciidoctor-epub3 (1.5.0.alpha.9)
10+
asciidoctor (>= 1.5.0, < 3.0.0)
11+
concurrent-ruby (~> 1.1.5)
12+
gepub (~> 1.0.2)
1213
thread_safe (~> 0.3.6)
13-
asciidoctor-pdf (1.5.0.alpha.16)
14-
asciidoctor (>= 1.5.0)
15-
prawn (>= 1.3.0, < 2.3.0)
16-
prawn-icon (= 1.3.0)
17-
prawn-svg (>= 0.21.0, < 0.28.0)
18-
prawn-table (= 0.2.2)
19-
prawn-templates (>= 0.0.3, <= 0.1.1)
20-
safe_yaml (~> 1.0.4)
21-
thread_safe (~> 0.3.6)
22-
treetop (= 1.5.3)
23-
concurrent-ruby (1.1.4)
24-
css_parser (1.6.0)
14+
asciidoctor-pdf (1.5.0.alpha.18)
15+
asciidoctor (>= 1.5.3, < 3.0.0)
16+
concurrent-ruby (~> 1.1.0)
17+
prawn (~> 2.2.0)
18+
prawn-icon (~> 2.3.0)
19+
prawn-svg (~> 0.29.0)
20+
prawn-table (~> 0.2.0)
21+
prawn-templates (~> 0.1.0)
22+
safe_yaml (~> 1.0.0)
23+
thread_safe (~> 0.3.0)
24+
treetop (~> 1.5.0)
25+
concurrent-ruby (1.1.5)
26+
css_parser (1.7.0)
2527
addressable
26-
gepub (0.6.9.2)
27-
nokogiri (~> 1.6.1)
28+
gepub (1.0.4)
29+
nokogiri (>= 1.8.2, < 1.11)
2830
rubyzip (>= 1.1.1)
2931
hashery (2.1.2)
3032
kindlegen (3.0.3)
3133
rake
3234
rubyzip
33-
mini_portile2 (2.1.0)
34-
nokogiri (1.6.8.1)
35-
mini_portile2 (~> 2.1.0)
35+
mini_portile2 (2.4.0)
36+
nokogiri (1.10.3)
37+
mini_portile2 (~> 2.4.0)
3638
pdf-core (0.7.0)
3739
pdf-reader (2.2.0)
3840
Ascii85 (~> 1.0.0)
@@ -44,22 +46,22 @@ GEM
4446
prawn (2.2.2)
4547
pdf-core (~> 0.7.0)
4648
ttfunk (~> 1.5)
47-
prawn-icon (1.3.0)
49+
prawn-icon (2.3.0)
4850
prawn (>= 1.1.0, < 3.0.0)
49-
prawn-svg (0.27.1)
50-
css_parser (~> 1.3)
51+
prawn-svg (0.29.1)
52+
css_parser (~> 1.6)
5153
prawn (>= 0.11.1, < 3)
5254
prawn-table (0.2.2)
5355
prawn (>= 1.3.0, < 3.0.0)
5456
prawn-templates (0.1.1)
5557
pdf-reader (~> 2.0)
5658
prawn (~> 2.2)
57-
public_suffix (3.0.3)
59+
public_suffix (3.1.0)
5860
rake (12.3.2)
59-
rouge (3.3.0)
61+
rouge (3.4.1)
6062
ruby-rc4 (0.1.5)
61-
rubyzip (1.2.2)
62-
safe_yaml (1.0.4)
63+
rubyzip (1.2.3)
64+
safe_yaml (1.0.5)
6365
thread_safe (0.3.6)
6466
treetop (1.5.3)
6567
polyglot (~> 0.3)
@@ -69,9 +71,9 @@ PLATFORMS
6971
ruby
7072

7173
DEPENDENCIES
72-
asciidoctor (~> 1.5)
74+
asciidoctor (~> 2.0.10)
7375
asciidoctor-epub3 (~> 1.5.alpha.8)
74-
asciidoctor-pdf (~> 1.5.alpha.16)
76+
asciidoctor-pdf (~> 1.5.alpha.18)
7577
concurrent-ruby (~> 1.1)
7678
kindlegen (~> 3.0)
7779
rouge (~> 3.3)

README.md

Lines changed: 14 additions & 9 deletions

Rakefile

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,93 @@
1+
require 'asciidoctor'
2+
require 'asciidoctor-pdf'
3+
14
LANGS = %w[en fr].freeze
5+
VERSIONS = %w[5 6].freeze
6+
OUTPUT_DIR = File.join __dir__, 'build'
7+
THEMES_DIR = File.join __dir__, 'themes'
8+
FONTS_DIR = File.join __dir__, 'fonts'
29

3-
def parse_lang(args)
10+
def check_args(args)
411
lang = args[:lang]
512
unless LANGS.include?(lang)
613
msg = format('Lang not availaible. Select on of theses langs: %s', LANGS.join(', '))
714
raise ArgumentError, msg
815
end
916

17+
version = args[:version]
18+
unless VERSIONS.include?(version)
19+
msg = format('Version not availaible. Select on of theses versions: %s', VERSIONS.join(', '))
20+
raise ArgumentError, msg
21+
end
22+
1023
lang
1124
end
1225

13-
def out_filename(lang, extension)
14-
"api_on_rails-#{lang}.#{extension}"
26+
def in_filename(args)
27+
format('rails%s/%s/api_on_rails.adoc', args[:version], args[:lang])
28+
end
29+
30+
def out_filename(args, extension)
31+
format("api_on_rails_%s-%s.%s",args[:version], args[:lang], extension)
1532
end
1633

1734
namespace :build do
1835
desc 'Build all versions'
19-
task :all, [:lang] do |_task, args|
20-
lang = parse_lang(args)
21-
Rake::Task['build:pdf'].invoke(lang)
22-
Rake::Task['build:epub'].invoke(lang)
23-
Rake::Task['build:mobi'].invoke(lang)
36+
task :all, [:version, :lang] do |_task, args|
37+
check_args(args)
38+
Rake::Task['build:pdf'].invoke(args[:version], args[:lang])
39+
Rake::Task['build:epub'].invoke(args[:version], args[:lang])
40+
Rake::Task['build:mobi'].invoke(args[:version], args[:lang])
2441
end
2542

2643
desc 'Build a PDF version'
27-
task :pdf, [:lang] do |_task, args|
28-
lang = parse_lang(args)
29-
filename = out_filename lang, 'pdf'
30-
`asciidoctor-pdf #{lang}/api_on_rails.adoc --destination-dir build --out-file #{filename}`
31-
puts "Book compiled on build/#{filename}"
44+
task :pdf, [:version, :lang] do |_task, args|
45+
check_args(args)
46+
47+
input = in_filename args
48+
output = out_filename args, 'pdf'
49+
50+
Asciidoctor.convert_file input,
51+
safe: :unsafe,
52+
backend: 'pdf',
53+
to_dir: OUTPUT_DIR,
54+
mkdirs: true,
55+
to_file: output,
56+
attributes: {
57+
'pdf-stylesdir' => THEMES_DIR,
58+
'pdf-style' => 'my',
59+
'pdf-fontsdir' => FONTS_DIR,
60+
}
61+
62+
63+
# `asciidoctor-pdf #{input} --destination-dir build --out-file #{output}`
64+
puts "Book compiled on build/#{output}"
3265
end
3366

3467
desc 'Build an HTML version'
35-
task :html, [:lang] do |_task, args|
36-
lang = parse_lang(args)
37-
filename = out_filename lang, 'html'
38-
`asciidoctor #{lang}/api_on_rails.adoc --destination-dir build --out-file #{filename}`
39-
puts "Book compiled on build/#{filename}"
68+
task :html, [:version, :lang] do |_task, args|
69+
check_args(args)
70+
input = in_filename args
71+
output = out_filename args, 'html'
72+
`asciidoctor #{input} --destination-dir build --out-file #{output}`
73+
puts "Book compiled on build/#{output}"
4074
end
4175

4276
desc 'Build an EPUB version'
43-
task :epub, [:lang] do |_task, args|
44-
lang = parse_lang(args)
45-
filename = out_filename lang, 'epub'
46-
`asciidoctor-epub3 #{lang}/api_on_rails.adoc --destination-dir build --out-file #{filename}`
47-
puts "Book compiled on build/#{filename}"
77+
task :epub, [:version, :lang] do |_task, args|
78+
check_args(args)
79+
input = in_filename args
80+
output = out_filename args, 'epub'
81+
`asciidoctor-epub3 #{input} --destination-dir build --out-file #{output}`
82+
puts "Book compiled on build/#{output}"
4883
end
4984

5085
desc 'Build a MOBI version'
51-
task :mobi, [:lang] do |_task, args|
52-
lang = parse_lang(args)
53-
filename = out_filename lang, 'mobi'
54-
`asciidoctor-epub3 #{lang}/api_on_rails.adoc --destination-dir build -a ebook-format=kf8 --out-file #{filename}`
55-
`rm build/api_on_rails-#{lang}-kf8.epub`
56-
puts "Book compiled on build/api_on_rails-#{lang}.mobi"
86+
task :mobi, [:version, :lang] do |_task, args|
87+
check_args(args)
88+
input = in_filename args
89+
output = out_filename args, 'mobi'
90+
`asciidoctor-epub3 #{input} --destination-dir build -a ebook-format=kf8 --out-file #{output}`
91+
puts "Book compiled on build/#{output}"
5792
end
5893
end

fonts/iAWriterDuospace-Bold.ttf

192 KB
Binary file not shown.
210 KB
Binary file not shown.

fonts/iAWriterDuospace-Italic.ttf

213 KB
Binary file not shown.

fonts/iAWriterDuospace-Regular.ttf

198 KB
Binary file not shown.

0 commit comments

Comments
 (0)