27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/ragerender/jekyll.rb', line 27
def init_with_program(jekyll)
jekyll.command :pack do |pack|
pack.syntax 'pack'
pack.description 'Create a ComicFury layout backup from this site'
pack.action do |args, options|
config = configuration_from_options(options)
filename = "#{(config['title'] || File.basename(config['source']))} #{Time.now.to_s}.cflxml"
puts "Outputting backup file #{filename}"
File.open(filename, 'w') do |file|
RageRender.pack config['layouts_dir'], config['source'], file
end
end
end
jekyll.command :unpack do |unpack|
unpack.syntax 'unpack <file>'
unpack.description 'Overwrite HTML and CSS from a ComicFury layout backup'
unpack.action do |args, options|
raise ArgumentError, 'unpack requires one cflxml file' unless args.one?
config = configuration_from_options(options)
File.open(args.first, 'r') do |file|
RageRender.unpack file, config['layouts_dir'], config['source']
end
end
end
end
|