rakali 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rakali/cli.rb +0 -6
- data/lib/rakali/converter.rb +2 -1
- data/lib/rakali/document.rb +4 -4
- 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: 05303f10b7f68ab07498fa1cb4c402a9d39bae44
|
4
|
+
data.tar.gz: 792d3c75ce0a169f7cedb94ff3b03a03521d2cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54fd644bbb32c599bdbd49a74b051912bde72fbf2f92be8d8eba06a8fbfeb3d4cccf9fc56c9ddd47d25f21154a3a596eeab105e8a3d827282602aafa9c484456
|
7
|
+
data.tar.gz: 6d140bb017c06478060ffdc1d5462822625724ce8bf970889da091cccedcf94d6e83fd02cbce8cab9f02e3eb419bf020514d779e85ad2871b7624249785d378a
|
data/lib/rakali/cli.rb
CHANGED
@@ -10,12 +10,6 @@ module Rakali
|
|
10
10
|
|
11
11
|
def convert(file)
|
12
12
|
converter = Rakali::Converter.new(file)
|
13
|
-
|
14
|
-
# don't proceed unless input validates against schema
|
15
|
-
unless converter.valid?
|
16
|
-
message = "Error: input did not validate with schema #{converter.schema["title"]}\n" + converter.errors.join("\n")
|
17
|
-
raise Thor::Error, message
|
18
|
-
end
|
19
13
|
end
|
20
14
|
|
21
15
|
default_task :convert
|
data/lib/rakali/converter.rb
CHANGED
@@ -31,7 +31,8 @@ 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
|
-
|
34
|
+
puts documents
|
35
|
+
documents.each { |document| Rakali::Document.new(document, @config) }
|
35
36
|
rescue KeyError => e
|
36
37
|
Rakali.logger.abort_with "Fatal:", "Configuration #{e.message}."
|
37
38
|
rescue => e
|
data/lib/rakali/document.rb
CHANGED
@@ -20,7 +20,7 @@ module Rakali
|
|
20
20
|
@destination = @source.sub(/\.#{@from_format}$/, ".#{@to_format}")
|
21
21
|
|
22
22
|
# convert source document into JSON version of native AST
|
23
|
-
@content = convert(nil, "#{@
|
23
|
+
@content = convert(nil, @from_folder, "#{@source} -t json")
|
24
24
|
|
25
25
|
# read in JSON schema
|
26
26
|
@schema = IO.read(@config.fetch('schema'))
|
@@ -29,7 +29,7 @@ module Rakali
|
|
29
29
|
@errors = validate
|
30
30
|
|
31
31
|
# convert to destination document from JSON version of native AST
|
32
|
-
@output = convert(@content, "-f json -o #{@
|
32
|
+
@output = convert(@content, @to_folder, "-f json -o #{@destination}")
|
33
33
|
Rakali.logger.abort_with "Fatal:", "Writing file #{@destination} failed" unless created?
|
34
34
|
|
35
35
|
if @errors.empty?
|
@@ -44,8 +44,8 @@ module Rakali
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def convert(string = nil, args)
|
48
|
-
Open3::popen3("pandoc #{args}") do |stdin, stdout, stderr, wait_thr|
|
47
|
+
def convert(string = nil, dir, args)
|
48
|
+
Open3::popen3("pandoc #{args}", chdir: dir) do |stdin, stdout, stderr, wait_thr|
|
49
49
|
unless string.nil?
|
50
50
|
stdin.puts string
|
51
51
|
stdin.close
|
data/lib/rakali/version.rb
CHANGED