rakali 0.0.9 → 0.0.13
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 +4 -4
- data/lib/rakali/converter.rb +0 -1
- data/lib/rakali/document.rb +14 -10
- data/lib/rakali/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: 61880376d29fc0fdb0368399bc35d6dcd5fe2c29
|
4
|
+
data.tar.gz: fcbdb2a0aedfaf6b35bdaa198c104a509208533f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d5350972bd0a27a3fb2665a27f8da0aba715a4b6f411fb41f43d02132194f188689d61778bbc6326f29e03d7e2e017c6ecb2dd1e55405f4e5f542cf3103fe62
|
7
|
+
data.tar.gz: 0b1e9ff6bcd298c6a0d593cda0433afa717c157e7308b020192ca6b51dffcae2119ec95904a381bdef706eaf8ce4e42c21d98aedbd952ea07a2ea73e1d35c802
|
data/lib/rakali/converter.rb
CHANGED
@@ -31,7 +31,6 @@ module Rakali
|
|
31
31
|
from_folder = @config.fetch('from').fetch('folder')
|
32
32
|
from_format = @config.fetch('from').fetch('format')
|
33
33
|
documents = Dir.glob("#{from_folder}/*.#{from_format}")
|
34
|
-
puts documents
|
35
34
|
documents.each { |document| Rakali::Document.new(document, @config) }
|
36
35
|
rescue KeyError => e
|
37
36
|
Rakali.logger.abort_with "Fatal:", "Configuration #{e.message}."
|
data/lib/rakali/document.rb
CHANGED
@@ -13,7 +13,6 @@ module Rakali
|
|
13
13
|
@from_format = @config.fetch('from').fetch('format')
|
14
14
|
@to_folder = @config.fetch('to').fetch('folder') || @from_folder
|
15
15
|
@to_format = @config.fetch('to').fetch('format')
|
16
|
-
#config_path = File.expand_path("../config.yml", __FILE__)
|
17
16
|
|
18
17
|
# for destination filename use source name with new extension
|
19
18
|
@source = File.basename(document)
|
@@ -45,17 +44,22 @@ module Rakali
|
|
45
44
|
end
|
46
45
|
|
47
46
|
def convert(string = nil, dir, args)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
captured_stdout = ''
|
48
|
+
captured_stderr = ''
|
49
|
+
exit_status = Open3::popen3("pandoc #{args}", chdir: dir) do |stdin, stdout, stderr, wait_thr|
|
50
|
+
stdin.puts string unless string.nil?
|
51
|
+
stdin.close
|
52
|
+
|
53
|
+
captured_stdout = stdout.read
|
54
|
+
captured_stderr = stderr.read
|
55
|
+
wait_thr.value
|
56
|
+
end
|
53
57
|
|
54
|
-
|
55
|
-
|
58
|
+
# abort with log message if non-zero exit_status
|
59
|
+
Rakali.logger.abort_with "Fatal:", "#{captured_stderr}." unless exit_status.success?
|
56
60
|
|
57
|
-
|
58
|
-
|
61
|
+
# otherwise return stdout
|
62
|
+
captured_stdout
|
59
63
|
end
|
60
64
|
|
61
65
|
def validate
|
data/lib/rakali/version.rb
CHANGED