rakali 0.0.9 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05303f10b7f68ab07498fa1cb4c402a9d39bae44
4
- data.tar.gz: 792d3c75ce0a169f7cedb94ff3b03a03521d2cb7
3
+ metadata.gz: 61880376d29fc0fdb0368399bc35d6dcd5fe2c29
4
+ data.tar.gz: fcbdb2a0aedfaf6b35bdaa198c104a509208533f
5
5
  SHA512:
6
- metadata.gz: 54fd644bbb32c599bdbd49a74b051912bde72fbf2f92be8d8eba06a8fbfeb3d4cccf9fc56c9ddd47d25f21154a3a596eeab105e8a3d827282602aafa9c484456
7
- data.tar.gz: 6d140bb017c06478060ffdc1d5462822625724ce8bf970889da091cccedcf94d6e83fd02cbce8cab9f02e3eb419bf020514d779e85ad2871b7624249785d378a
6
+ metadata.gz: 4d5350972bd0a27a3fb2665a27f8da0aba715a4b6f411fb41f43d02132194f188689d61778bbc6326f29e03d7e2e017c6ecb2dd1e55405f4e5f542cf3103fe62
7
+ data.tar.gz: 0b1e9ff6bcd298c6a0d593cda0433afa717c157e7308b020192ca6b51dffcae2119ec95904a381bdef706eaf8ce4e42c21d98aedbd952ea07a2ea73e1d35c802
@@ -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}."
@@ -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
- Open3::popen3("pandoc #{args}", chdir: dir) do |stdin, stdout, stderr, wait_thr|
49
- unless string.nil?
50
- stdin.puts string
51
- stdin.close
52
- end
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
- # abort with log message if exit_status of command not 0
55
- Rakali.logger.abort_with "Fatal:", "#{stderr.read}." if wait_thr.value.exitstatus > 0
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
- stdout.read
58
- end
61
+ # otherwise return stdout
62
+ captured_stdout
59
63
  end
60
64
 
61
65
  def validate
@@ -1,3 +1,3 @@
1
1
  module Rakali
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakali
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner