pandocomatic 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64a6d28368a126d0db126154df753827ee3d79bc678dd570164da442cde462eb
|
4
|
+
data.tar.gz: 556a96419582f0f3a8d5a2ffb1679181bcb2d36ac917278b02cd50385eed3f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0b032a03165acc0fdae449d501d849925254a54c8bd88c27160672f0ca1aad189cf927c2ed10617b74d961e873a57019ddbaf8c47119d71b0830c455514b482
|
7
|
+
data.tar.gz: f111513bafd58c972ca246fdb07f6236b898058202542f6baf10d5dce54d26c15cc3acecd4e4dc9504ec7fabb52f586be56fe74b2f25dc63350c14c4346f16bb
|
@@ -72,23 +72,23 @@ module Pandocomatic
|
|
72
72
|
Dir.foreach @src_dir do |filename|
|
73
73
|
src = File.join @src_dir, filename
|
74
74
|
|
75
|
-
next if config.skip? src
|
75
|
+
next if @config.skip? src
|
76
76
|
|
77
77
|
@errors.push IOError.new(:file_or_directory_does_not_exist, nil, src) unless File.exist? src
|
78
78
|
|
79
79
|
dst = File.join @dst_dir, filename
|
80
80
|
|
81
|
-
if File.symlink?(src) &&
|
81
|
+
if File.symlink?(src) && !@config.follow_links?
|
82
82
|
subcommand = CreateLinkCommand.new(src, dst)
|
83
83
|
elsif File.directory? src
|
84
|
-
subcommand = if config.recursive?
|
85
|
-
ConvertDirCommand.new(config, src, dst)
|
84
|
+
subcommand = if @config.recursive?
|
85
|
+
ConvertDirCommand.new(@config, src, dst)
|
86
86
|
else
|
87
87
|
SkipCommand.new(src, :skipping_directory)
|
88
88
|
end
|
89
89
|
elsif File.file? src
|
90
|
-
if config.convert? src
|
91
|
-
subcommand = ConvertFileMultipleCommand.new(config, src, dst)
|
90
|
+
if @config.convert? src
|
91
|
+
subcommand = ConvertFileMultipleCommand.new(@config, src, dst)
|
92
92
|
elsif !modified_only? || file_modified?(src, dst)
|
93
93
|
subcommand = CopyFileCommand.new(src, dst)
|
94
94
|
end
|
@@ -149,7 +149,7 @@ module Pandocomatic
|
|
149
149
|
if File.exist? config_file
|
150
150
|
current_config.reconfigure config_file
|
151
151
|
else
|
152
|
-
current_config
|
152
|
+
current_config.clone
|
153
153
|
end
|
154
154
|
end
|
155
155
|
end
|
@@ -255,24 +255,33 @@ module Pandocomatic
|
|
255
255
|
def reconfigure(filename)
|
256
256
|
settings = PandocomaticYAML.load_file filename
|
257
257
|
new_config = Marshal.load(Marshal.dump(self))
|
258
|
-
new_config.configure settings, filename
|
258
|
+
new_config.configure settings, filename, recursive: true
|
259
259
|
new_config
|
260
260
|
rescue StandardError => e
|
261
261
|
raise ConfigurationError.new(:unable_to_load_config_file, e, filename)
|
262
262
|
end
|
263
263
|
|
264
|
+
# Create a copy of this configuration
|
265
|
+
#
|
266
|
+
# @return [Configuration] copy
|
267
|
+
def clone
|
268
|
+
Marshal.load(Marshal.dump(self))
|
269
|
+
end
|
270
|
+
|
264
271
|
# Configure pandocomatic based on a settings Hash
|
265
272
|
#
|
266
273
|
# @param settings [Hash] a settings Hash to mixin in this
|
267
274
|
# @param path [String] the configuration's path or filename
|
268
275
|
# Configuration.
|
269
|
-
|
276
|
+
# @param recursive [Boolean] should this configuration be configured
|
277
|
+
# recursively? I.e., when running on a directory?
|
278
|
+
def configure(settings, path, recursive: false)
|
270
279
|
reset_settings settings['settings'] if settings.key? 'settings'
|
271
280
|
|
272
281
|
return unless settings.key? 'templates'
|
273
282
|
|
274
283
|
settings['templates'].each do |name, template|
|
275
|
-
reset_template Template.new(name, template, path)
|
284
|
+
reset_template Template.new(name, template, path), recursive:
|
276
285
|
end
|
277
286
|
end
|
278
287
|
|
@@ -719,16 +728,18 @@ module Pandocomatic
|
|
719
728
|
resolved_template
|
720
729
|
end
|
721
730
|
|
722
|
-
# Reset the template with name in this Configuration based on a new
|
731
|
+
# Reset the template with same name in this Configuration based on a new
|
723
732
|
# template
|
724
733
|
#
|
725
734
|
# @param template [Template] the template to use to update the template in
|
726
|
-
# this
|
727
|
-
|
735
|
+
# this Configuration with
|
736
|
+
# @param recursive [Boolean] should this configuration be configured
|
737
|
+
# recursively? I.e., when running on a directory?
|
738
|
+
def reset_template(template, recursive: false)
|
728
739
|
name = template.name
|
729
740
|
extended_template = extend_template template
|
730
741
|
|
731
|
-
if @templates.key?
|
742
|
+
if recursive && @templates.key?(name)
|
732
743
|
@templates[name].merge! extended_template
|
733
744
|
else
|
734
745
|
@templates[name] = extended_template
|
@@ -771,11 +782,11 @@ module Pandocomatic
|
|
771
782
|
end
|
772
783
|
|
773
784
|
def marshal_dump
|
774
|
-
[@data_dir, @settings, @templates, @convert_patterns]
|
785
|
+
[@data_dir, @settings, @templates, @convert_patterns, @root_path]
|
775
786
|
end
|
776
787
|
|
777
788
|
def marshal_load(array)
|
778
|
-
@data_dir, @settings, @templates, @convert_patterns = array
|
789
|
+
@data_dir, @settings, @templates, @convert_patterns, @root_path = array
|
779
790
|
end
|
780
791
|
|
781
792
|
def to_stdout?(options)
|
@@ -216,6 +216,8 @@ module Pandocomatic
|
|
216
216
|
ErrorPrinter.new(e).print
|
217
217
|
exit ERROR_STATUS + 1
|
218
218
|
rescue StandardError => e
|
219
|
+
warn e
|
220
|
+
warn e.backtrace
|
219
221
|
# An unexpected error has occurred; break off the program drastically
|
220
222
|
# for now. This is likely a bug: ask the user to report it.
|
221
223
|
UnknownErrorPrinter.new(e).print
|
data/lib/pandocomatic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pandocomatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huub de Beer
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: logger
|
@@ -220,7 +219,6 @@ licenses:
|
|
220
219
|
- GPL-3.0
|
221
220
|
metadata:
|
222
221
|
rubygems_mfa_required: 'true'
|
223
|
-
post_install_message:
|
224
222
|
rdoc_options: []
|
225
223
|
require_paths:
|
226
224
|
- lib
|
@@ -236,8 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
234
|
version: '0'
|
237
235
|
requirements:
|
238
236
|
- pandoc, a universal document converter
|
239
|
-
rubygems_version: 3.
|
240
|
-
signing_key:
|
237
|
+
rubygems_version: 3.6.7
|
241
238
|
specification_version: 4
|
242
239
|
summary: Automate the use of pandoc
|
243
240
|
test_files: []
|