Class: JekyllImport::Importers::Dotclear
Class Method Summary
collapse
inherited, run, stringify_keys, subclasses
Class Method Details
.process(opts) ⇒ Object
40
41
42
43
44
|
# File 'lib/jekyll-import/importers/dotclear.rb', line 40
def process(opts)
import_posts
import_assets(opts["mediafolder"])
Jekyll.logger.info "", "and, done!"
end
|
.specify_options(c) ⇒ Object
7
8
9
10
|
# File 'lib/jekyll-import/importers/dotclear.rb', line 7
def specify_options(c)
c.option "datafile", "--datafile PATH", "Dotclear export file."
c.option "mediafolder", "--mediafolder DIR", "Dotclear media export folder (unpacked media.zip)."
end
|
.validate(opts) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/jekyll-import/importers/dotclear.rb', line 16
def validate(opts)
file_path = opts["datafile"]
log_undefined_flag_error("datafile") if file_path.nil? || file_path.empty?
file_path = File.expand_path(file_path)
if File.open(file_path, "rb", &:readline).start_with?("///DOTCLEAR|")
@data = read_export(file_path)
Jekyll.logger.info "Export File:", file_path
else
Jekyll.logger.abort_with "Import Error:", "#{file_path.inspect} is not a valid Dotclear export file!"
end
assets = @data["media"]
return if !assets || assets.empty?
Jekyll.logger.info "", "Media files detected in export data."
media_dir = opts["mediafolder"]
log_undefined_flag_error("mediafolder") if media_dir.nil? || media_dir.empty?
media_dir = File.expand_path(media_dir)
log_invalid_media_dir_error(media_dir) if !File.directory?(media_dir) || Dir.empty?(media_dir)
end
|