source2epub 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +4 -0
- data/lib/source2epub/configuration.rb +1 -1
- data/lib/source2epub/exporter.rb +20 -18
- data/lib/source2epub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d5b12cf8b5ad412833dea86bfa538106755c2b
|
4
|
+
data.tar.gz: bacbd2e2844ed886a3c8f58125fcdac77f1fe70c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9deec68b5c3e2d2d012ca8d14228b642256b0258b1f163db61f9dc7a43e25b09e2978038cd33d9f44c446a9ae4a12cbdfb05a39bf9923c899919f0f598d8fe67
|
7
|
+
data.tar.gz: 93bcf378e58cf94442936c91f06f47e2631da95b12d62ba4203262e38ad2f99921bcce446e7dc37d66bcf53d34bb746b823401d2b1e1b2dd9982ad49b8334b26
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/source2epub/exporter.rb
CHANGED
@@ -12,6 +12,7 @@ module Source2Epub
|
|
12
12
|
:theme,
|
13
13
|
:command,
|
14
14
|
:epub_title
|
15
|
+
|
15
16
|
attr_reader :base_dir,
|
16
17
|
:repo_name,
|
17
18
|
:output_path
|
@@ -49,7 +50,7 @@ module Source2Epub
|
|
49
50
|
cleanup
|
50
51
|
end
|
51
52
|
|
52
|
-
|
53
|
+
private
|
53
54
|
|
54
55
|
def clone
|
55
56
|
if File.exist?(output_path)
|
@@ -96,33 +97,19 @@ module Source2Epub
|
|
96
97
|
# Convert list of html to list of epub file
|
97
98
|
def htmls2epub
|
98
99
|
input_file = File.expand_path("#{output_path}/vim_printer_#{repo_name}.tar.gz")
|
99
|
-
|
100
100
|
if File.exist?(input_file)
|
101
|
-
FileUtils.mkdir_p
|
102
|
-
AgileUtils::FileUtil.gunzip
|
101
|
+
FileUtils.mkdir_p(output_dir)
|
102
|
+
AgileUtils::FileUtil.gunzip(input_file, output_dir)
|
103
103
|
xhtml_files = CodeLister.files base_dir: output_dir,
|
104
104
|
recursive: true,
|
105
105
|
exts: %w[xhtml],
|
106
106
|
non_exts: []
|
107
107
|
project_dir = File.expand_path(File.dirname(output_dir) + "../../#{Source2Epub::TMP_DIR}/#{repo_name}")
|
108
|
-
|
109
108
|
xhtml_files.map! do |f|
|
110
109
|
File.expand_path(f.gsub(/^\./, project_dir))
|
111
110
|
end
|
112
|
-
|
113
111
|
nav_list = nav_index(xhtml_files, project_dir)
|
114
|
-
|
115
|
-
title = epub_title
|
116
|
-
epub = EeePub.make do
|
117
|
-
title title
|
118
|
-
creator Source2Epub.configuration.creator
|
119
|
-
publisher Source2Epub.configuration.publisher
|
120
|
-
date Source2Epub.configuration.published_date
|
121
|
-
identifier Source2Epub.configuration.identifier, scheme: "URL"
|
122
|
-
files(xhtml_files)
|
123
|
-
nav nav_list
|
124
|
-
end
|
125
|
-
epub.save(output_filename)
|
112
|
+
create_epub(xhtml_files, nav_list)
|
126
113
|
end
|
127
114
|
end
|
128
115
|
|
@@ -184,5 +171,20 @@ module Source2Epub
|
|
184
171
|
# Also remove the 'vim_printer_#{repo_name}.tar.gz' if we have one
|
185
172
|
FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{repo_name}/vim_printer_#{repo_name}.tar.gz")
|
186
173
|
end
|
174
|
+
|
175
|
+
def create_epub(xhtml_files, nav_list)
|
176
|
+
# Note: need to assign the local varaiable for this to work
|
177
|
+
title = epub_title
|
178
|
+
epub = EeePub.make do
|
179
|
+
title title
|
180
|
+
creator Source2Epub.configuration.creator
|
181
|
+
publisher Source2Epub.configuration.publisher
|
182
|
+
date Source2Epub.configuration.published_date
|
183
|
+
identifier Source2Epub.configuration.identifier, scheme: "URL"
|
184
|
+
files(xhtml_files)
|
185
|
+
nav nav_list
|
186
|
+
end
|
187
|
+
epub.save(output_filename)
|
188
|
+
end
|
187
189
|
end
|
188
190
|
end
|
data/lib/source2epub/version.rb
CHANGED